summaryrefslogtreecommitdiff
path: root/BKUOnline/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'BKUOnline/src/main/java/at')
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java93
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java144
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java23
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java5
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java197
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java127
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java61
7 files changed, 271 insertions, 379 deletions
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
index 660fee78..d9be0981 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -32,6 +33,7 @@ import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.bku.binding.BindingProcessor;
import at.gv.egiz.bku.binding.HTTPBindingProcessor;
import at.gv.egiz.bku.binding.HttpUtil;
import at.gv.egiz.bku.binding.IdFactory;
@@ -43,14 +45,16 @@ import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
*
*/
public class BKURequestHandler extends SpringBKUServlet {
+ public static final String BKU_APPLET_JSP = "BKUApplet";
private static final long serialVersionUID = 1L;
- public final static String REDIRECT_URL = "appletPage.jsp";
+ public final static String REDIRECT_URL_SESSION_ATTRIBUTE="redirectUrl";
protected Log log = LogFactory.getLog(BKURequestHandler.class);
- private static String getStringFromStream(InputStream is, String encoding) throws IOException {
+ private static String getStringFromStream(InputStream is, String encoding)
+ throws IOException {
if (is == null) {
return null;
}
@@ -61,28 +65,41 @@ public class BKURequestHandler extends SpringBKUServlet {
StreamUtil.copyStream(is, os);
return new String(os.toByteArray(), encoding);
}
-
-
+
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, java.io.IOException {
- log.debug("Got new request");
- HttpSession session = req.getSession();
- String lang = req.getHeader("Accept-Language");
- Locale locale = AcceptLanguage.getLocale(lang);
- log.debug("Using locale: " + locale);
-
+ log.debug("Received new request");
+
+ HttpSession session = req.getSession(false);
if (session != null) {
log.warn("Already a session with id: " + session.getId()
- + " active, deleting this one");
- getBindingProcessorManager().removeBindingProcessor(
+ + " active, trying to get Bindingprocessor");
+ BindingProcessor bp = getBindingProcessorManager().getBindingProcessor(
IdFactory.getInstance().createId(session.getId()));
+ if (bp != null) {
+ log.debug("Found binding processor, using this one");
+ RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(
+ BKU_APPLET_JSP);
+ log.debug("forward to applet");
+ dispatcher.forward(req, resp);
+ return;
+ }
+ log.debug("Did not find a binding processor, creating new ...");
}
- String id = req.getSession(true).getId();
- log.debug("Using session id: " + id);
- HTTPBindingProcessor bindingProcessor;
+ session = req.getSession(true);
+ if (log.isDebugEnabled()) {
+ log.debug("Using session id: " + session.getId());
+ }
+
+ String acceptLanguage = req.getHeader("Accept-Language");
+ Locale locale = AcceptLanguage.getLocale(acceptLanguage);
+ log.debug("Accept-Language locale: " + locale);
+ HTTPBindingProcessor bindingProcessor;
bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
- .createBindingProcessor(req.getRequestURL().toString(), id, locale);
+ .createBindingProcessor(req.getRequestURL().toString(),
+ session.getId(), locale);
Map<String, String> headerMap = new HashMap<String, String>();
for (Enumeration<String> headerName = req.getHeaderNames(); headerName
@@ -102,13 +119,20 @@ public class BKURequestHandler extends SpringBKUServlet {
bindingProcessor.consumeRequestStream(req.getInputStream());
req.getInputStream().close();
getBindingProcessorManager().process(bindingProcessor);
-
+
log.trace("Trying to find applet parameters in request");
- String width = getStringFromStream(bindingProcessor.getFormData("appletWidth"), charset);
- String height = getStringFromStream(bindingProcessor.getFormData("appletHeight"), charset);
- String background = getStringFromStream(bindingProcessor.getFormData("appletBackground"), charset);
- String guiStyle = getStringFromStream(bindingProcessor.getFormData("appletGuiStyle"), charset);
- String hashDataDisplay = getStringFromStream(bindingProcessor.getFormData("appletHashDataDisplay"), charset);
+ String width = getStringFromStream(bindingProcessor
+ .getFormData("appletWidth"), charset);
+ String height = getStringFromStream(bindingProcessor
+ .getFormData("appletHeight"), charset);
+ String background = getStringFromStream(bindingProcessor
+ .getFormData("appletBackground"), charset);
+ String guiStyle = getStringFromStream(bindingProcessor
+ .getFormData("appletGuiStyle"), charset);
+ String hashDataDisplay = getStringFromStream(bindingProcessor
+ .getFormData("appletHashDataDisplay"), charset);
+ String localeFormParam = getStringFromStream(bindingProcessor
+ .getFormData("locale"), charset);
if (width != null) {
try {
log.trace("Found applet width parameter: " + width);
@@ -139,11 +163,30 @@ public class BKURequestHandler extends SpringBKUServlet {
log.trace("Found applet hash data display parameter: " + hashDataDisplay);
session.setAttribute("appletHashDataDisplay", hashDataDisplay);
}
- String redirectUrl = REDIRECT_URL+";jsessionid="+session.getId();
- log.debug("Redirecting to: "+redirectUrl);
- resp.sendRedirect(redirectUrl);
+ if (localeFormParam != null) {
+ log.debug("overrule accept-language locale " + locale
+ + " with form param " + localeFormParam);
+ locale = new Locale(localeFormParam);
+ }
+ if (locale != null) {
+ log.debug("Using locale " + locale);
+ session.setAttribute("locale", locale.toString());
+ }
+
+ // handle server side redirect url after processing
+ String redirectUrl = bindingProcessor.getRedirectURL();
+ if ( redirectUrl != null) {
+ log.debug("Got redirect URL "+redirectUrl+". Deferring browser redirect.");
+ session.setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl);
+ }
+ // TODO error if no dispatcher found
+ RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(
+ BKU_APPLET_JSP);
+ log.debug("forward to applet");
+ dispatcher.forward(req, resp);
}
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, java.io.IOException {
doPost(req, resp);
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java
deleted file mode 100644
index c095fcc8..00000000
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.online.webapp;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.List;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.binding.BindingProcessor;
-import at.gv.egiz.bku.binding.Id;
-import at.gv.egiz.bku.binding.IdFactory;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-import at.gv.egiz.bku.utils.StreamUtil;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.STAL;
-import at.gv.egiz.stal.service.impl.STALRequestBroker;
-
-public class HashDataInputServlet extends SpringBKUServlet {
-
- private static Log log = LogFactory.getLog(HashDataInputServlet.class);
-
- public HashDataInputServlet() {
-
- }
-
- private STALRequestBroker getSTAL(Id id) {
- BindingProcessor bp = getBindingProcessorManager().getBindingProcessor(id);
- if (bp == null) {
- return null;
- }
- STAL stal = bp.getSTAL();
- if (stal instanceof STALRequestBroker) {
- return (STALRequestBroker) stal;
- } else {
- throw new SLRuntimeException("Unexpected STAL type");
- }
- }
-
- private static boolean isMSIE(HttpServletRequest req) {
- String useragent = req.getHeader("User-Agent");
- String user = useragent.toLowerCase();
- return (user.indexOf("msie") != -1);
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- if ((req.getSession() == null) && (req.getSession().getId() != null)) {
- log.warn("Got request for hashdatainput without session info");
- resp.sendRedirect("expired.html");
- return;
- }
- Id sessionId = IdFactory.getInstance().createId(req.getSession().getId());
- log.debug("Got request for hashdata for session " + sessionId);
- STALRequestBroker rb = getSTAL(sessionId);
- if (rb == null) {
- log.info("STAL instance not found for session: " + sessionId);
- resp.sendRedirect("expired.html");
- return;
- }
- List<HashDataInput> hdi = rb.getHashDataInput();
- log.debug("Got hashdata list with " + hdi.size() + " entries");
- String param = req.getParameter("refId");
- log.debug("Got request for refId:" + param);
- if ((param == null) && (hdi.size() > 1)) {
- resp.sendRedirect("multiHashDataInput.html");
- return;
- }
-
- if ((param == null) && (hdi.size() == 1)) {
- param = hdi.get(0).getReferenceId();
- log.debug("Request parameter not set, setting to: " + param);
- }
- for (HashDataInput hd : hdi) {
- if (hd.getReferenceId().equals(param)) {
- log.debug("Found hashdatainput for refId:" + param);
- resp.setContentType(hd.getMimeType());
-
- String charSet = hd.getEncoding();
- if (charSet == null) {
- charSet = "UTF-8";
- }
- resp.setCharacterEncoding(charSet);
- if (isMSIE(req)) {
- String fileExt = hd.getMimeType().equalsIgnoreCase("text/plain") ? ".txt"
- : ".xhtml";
- if (fileExt.equals(".xhtml")) {
- if (req.getParameter("ieCType") == null) {
- resp.sendRedirect("ieView.html");
- return;
- } else {
- resp.setContentType(req.getParameter("ieCType"));
- if (req.getParameter("ieCType").equals("application/xhtml+xml")) {
- resp.addHeader("content-disposition", "attachment; filename="
- + param + ".xhtml");
- }
- }
- }
- }
- Reader r = new InputStreamReader(hd.getHashDataInput(), charSet);
- Writer w = new OutputStreamWriter(resp.getOutputStream(), charSet);
- StreamUtil.copyStream(r, w);
- w.flush();
- return;
-
- }
- }
- log.error("Cannot find hashdata for id:" + param);
- resp.sendError(404);
- return;
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- doGet(req, resp);
- }
-
-}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
index 9e69099d..f271dfc9 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java
@@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.binding.HTTPBindingProcessor;
import at.gv.egiz.bku.binding.HttpUtil;
import at.gv.egiz.bku.binding.IdFactory;
-import at.gv.egiz.bku.conf.Configurator;
+import at.gv.egiz.bku.utils.NullOutputStream;
/**
* Delivers the result to the browser
@@ -99,9 +99,20 @@ public class ResultServlet extends SpringBKUServlet {
resp.sendRedirect(expiredPage);
return;
}
-
- if (bp.getRedirectURL() != null) {
- resp.sendRedirect(bp.getRedirectURL());
+ String redirectUrl = (String) session
+ .getAttribute(BKURequestHandler.REDIRECT_URL_SESSION_ATTRIBUTE);
+ if (redirectUrl == null) {
+ redirectUrl = bp.getRedirectURL();
+ }
+ if (redirectUrl != null) {
+ try {
+ bp.writeResultTo(new NullOutputStream(), encoding);
+ getBindingProcessorManager().removeBindingProcessor(bp.getId());
+ } finally {
+ log.debug("Executing deferred browser redirect to: " + redirectUrl);
+ resp.sendRedirect(redirectUrl);
+ session.invalidate();
+ }
return;
}
resp.setStatus(bp.getResponseCode());
@@ -109,8 +120,8 @@ public class ResultServlet extends SpringBKUServlet {
resp.setHeader("Pragma", "no-cache"); // HTTP 1.0
resp.setDateHeader("Expires", 0);
if (configurator.getProperty(USER_AGENT_PROPERTY_KEY) != null) {
- resp.setHeader(HttpUtil.HTTP_HEADER_USER_AGENT, configurator.getProperty(
- USER_AGENT_PROPERTY_KEY));
+ resp.setHeader(HttpUtil.HTTP_HEADER_USER_AGENT, configurator
+ .getProperty(USER_AGENT_PROPERTY_KEY));
} else {
resp.setHeader(HttpUtil.HTTP_HEADER_USER_AGENT,
"citizen-card-environment/1.2 MOCCA Unknown");
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java
index d1fe045a..b77f7660 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java
@@ -22,6 +22,7 @@ import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import java.util.List;
+import javax.xml.bind.JAXBElement;
/**
*
@@ -32,9 +33,9 @@ public interface STALRequestBroker extends STAL {
public static final int ERR_4500 = 4500;
public static final long DEFAULT_TIMEOUT_MS = 1000*60*5; //5mn
- public List<RequestType> connect();
+ public List<JAXBElement<? extends RequestType>> connect();
- public List<RequestType> nextRequest(List<ResponseType> response);
+ public List<JAXBElement<? extends RequestType>> nextRequest(List<JAXBElement<? extends ResponseType>> responses);
public List<HashDataInput> getHashDataInput();
}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
index e7fb928a..252327d3 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
@@ -25,6 +25,7 @@ import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.service.types.InfoboxReadRequestType;
+import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
@@ -34,6 +35,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
+import javax.xml.bind.JAXBElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,14 +54,12 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class);
-// private boolean expectingResponse = false;
+ private ObjectFactory stalObjFactory = new ObjectFactory();
+
private boolean interrupted = false;
-// private final RequestsMonitor reqMon = new RequestsMonitor();
-// private final ResponsesMonitor respMon = new ResponsesMonitor();
-
- protected ArrayList<RequestType> requests;
- protected ArrayList<ResponseType> responses;
+ protected final ArrayList<JAXBElement<? extends RequestType>> requests;
+ protected final ArrayList<JAXBElement<? extends ResponseType>> responses;
protected ArrayList<HashDataInput> hashDataInputs;
@@ -69,8 +69,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
if (timeoutMillisec <= 0)
timeoutMillisec = DEFAULT_TIMEOUT_MS;
timeout = timeoutMillisec;
- requests = new ArrayList<RequestType>();
- responses = new ArrayList<ResponseType>();
+ requests = new ArrayList<JAXBElement<? extends RequestType>>();
+ responses = new ArrayList<JAXBElement<? extends ResponseType>>();
hashDataInputs = new ArrayList<HashDataInput>();
}
@@ -85,7 +85,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
* @pre requests: either single SignRequest, QuitRequest or multiple ReadInfoboxRequests
*/
@Override
- public List<STALResponse> handleRequest(List<STALRequest> stalRequests) {
+ public List<STALResponse> handleRequest(List<? extends STALRequest> stalRequests) {
if (interrupted) {
return null;
}
@@ -95,36 +95,39 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
requests.clear();
hashDataInputs.clear();
-// reqMon.produce(requests);
-// reqMon.setHashDataInput(null);
for (STALRequest stalRequest : stalRequests) {
if (stalRequest instanceof SignRequest) {
log.trace("Received SignRequest, keep HashDataInput.");
- SignRequestType req = new SignRequestType();
- req.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
- req.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
+ SignRequestType reqT = stalObjFactory.createSignRequestType();
+ reqT.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
+ reqT.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
+ JAXBElement<SignRequestType> req = stalObjFactory.createGetNextRequestResponseTypeSignRequest(reqT);
requests.add(req);
//DataObjectHashDataInput with reference caching enabled DataObject
hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
break;
} else if (stalRequest instanceof InfoboxReadRequest) {
log.trace("Received InfoboxReadRequest");
- InfoboxReadRequestType req = new InfoboxReadRequestType();
- req.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier());
- req.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier());
+ InfoboxReadRequestType reqT = new InfoboxReadRequestType();
+ reqT.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier());
+ reqT.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier());
+ JAXBElement<InfoboxReadRequestType> req = stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(reqT);
requests.add(req);
} else if (stalRequest instanceof QuitRequest) {
log.trace("Received QuitRequest, do not wait for responses.");
- requests.add(new QuitRequestType());
+ QuitRequestType reqT = stalObjFactory.createQuitRequestType();
+ JAXBElement<QuitRequestType> req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT);
+ requests.add(req);
log.trace("notifying request consumers");
requests.notify();
-// reqMon.notify();
return new ArrayList<STALResponse>();
} else {
log.error("Received unsupported STAL request: " + stalRequest.getClass().getName() + ", send QUIT");
requests.clear();
- requests.add(new QuitRequestType());
+ QuitRequestType reqT = stalObjFactory.createQuitRequestType();
+ JAXBElement<QuitRequestType> req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT);
+ requests.add(req);
log.trace("notifying request consumers");
requests.notify();
return new ArrayList<STALResponse>();
@@ -132,32 +135,25 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
}
log.trace("notifying request consumers");
requests.notify();
-// reqMon.notify();
}
- synchronized (responses) { //respMon) {
+ synchronized (responses) {
long beforeWait = System.currentTimeMillis();
-// while (respMon.responses == null) {
while (responses.isEmpty()) {
log.trace("waiting to consume response");
-// respMon.wait(timeout);
responses.wait(timeout);
if (System.currentTimeMillis() - beforeWait >= timeout) {
log.warn("timeout while waiting to consume response, cleanup requests");
-// reqMon.consume(); //TODO check deadlock?
-// reqMon.setHashDataInput(null);
- requests.clear(); //TODO sync on requests?
+ requests.clear();
hashDataInputs.clear();
return Collections.singletonList((STALResponse) new ErrorResponse(ERR_4500));
}
}
log.trace("consuming responses");
-// List<STALResponse> responses = respMon.consume();
List<STALResponse> resps = STALTranslator.toSTAL(responses);
responses.clear();
log.trace("notifying response producers");
responses.notify();
-// respMon.notify();
return resps;
}
@@ -169,7 +165,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
}
@Override
- public List<RequestType> connect() {
+ public List<JAXBElement<? extends RequestType>> connect() {
if (interrupted) {
return null;
}
@@ -181,15 +177,9 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
requests.wait(timeout);
if (System.currentTimeMillis() - beforeWait >= timeout) {
log.warn("timeout while waiting to consume request");
- return Collections.singletonList((RequestType) new QuitRequestType());
+ return createSingleQuitRequest();
}
}
-
-// log.trace("consume request");
-// List<RequestType> reqs = new ArrayList<RequestType>();
-// reqs.addAll(requests);
-// requests.clear();
-// return reqs;
log.trace("don't consume request now, leave for further connect calls");
return requests;
}
@@ -212,7 +202,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
* @return QUIT if expected responses are not provided
*/
@Override
- public List<RequestType> nextRequest(List<ResponseType> resps) {
+ public List<JAXBElement<? extends RequestType>> nextRequest(List<JAXBElement<? extends ResponseType>> resps) {
if (interrupted) {
return null;
}
@@ -227,69 +217,43 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
}
}
- synchronized (responses) { //respMon) {
+ synchronized (responses) {
if (resps != null && resps.size() > 0) {
-// if (!expectingResponse) {
-// log.warn("Received unexpected response in nextRequest(), return QUIT");
-// return Collections.singletonList((RequestType) new QuitRequestType());
-// }
long beforeWait = System.currentTimeMillis();
-// while (respMon.responses != null) {
while (!responses.isEmpty()) {
log.trace("waiting to produce response");
-// respMon.wait(timeout);
responses.wait(timeout);
if (System.currentTimeMillis() - beforeWait >= timeout) {
log.warn("timeout while waiting to produce response");
- return Collections.singletonList((RequestType) new QuitRequestType());
+ return createSingleQuitRequest();
}
}
log.trace("produce response");
-// respMon.produce(resps);
responses.addAll(resps);
//reset HashDataInputCallback iff SignResponse
if (log.isTraceEnabled()) {
- for (ResponseType response : resps) {
- log.trace("Received STAL response: " + response.getClass().getName());
+ for (JAXBElement<? extends ResponseType> response : resps) {
+ log.trace("Received STAL response: " + response.getValue().getClass().getName());
}
}
log.trace("notifying response consumers");
-// respMon.notify();
responses.notify();
} else {
-// if (expectingResponse) {
-// log.warn("Did not receive expected response(s) in nextRequest(), return QUIT");
-// return Collections.singletonList((RequestType) new QuitRequestType());
-// }
-// log.trace("expecting non-null response in next nextRequest(response)");
-// expectingResponse = true;
log.error("Received NextRequest without responses, return QUIT");
- return Collections.singletonList((RequestType) new QuitRequestType());
+ return createSingleQuitRequest();
}
}
- synchronized (requests) { //reqMon) {
+ synchronized (requests) {
long beforeWait = System.currentTimeMillis();
-// while (reqMon.requests == null) {
while (requests.isEmpty()) {
log.trace("waiting to consume request");
-// reqMon.wait(timeout);
requests.wait(timeout);
if (System.currentTimeMillis() - beforeWait >= timeout) {
log.warn("timeout while waiting to consume request");
- return Collections.singletonList((RequestType) new QuitRequestType());
+ return createSingleQuitRequest();
}
}
-// log.trace("consume request");
-// List<RequestType> reqs = new ArrayList<RequestType>(); // reqMon.consume();
-// reqs.addAll(requests);
-//
-//// if (requests.size() > 0 && requests.get(0) instanceof QuitRequestType) {
-//// log.trace("expecting no response in next nextRequest()");
-//// expectingResponse = false;
-//// }
-// requests.clear();
-// return reqs;
log.trace("don't consume request now, but on next response delivery");
return requests;
}
@@ -304,92 +268,19 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
public List<HashDataInput> getHashDataInput() {
synchronized (requests) {
log.trace("return " + hashDataInputs.size() + " current HashDataInput(s) ");
- return hashDataInputs; //reqMon.getHashDataInput();
+ return hashDataInputs;
}
}
@Override
public void setLocale(Locale locale) {
}
-
-// class RequestsMonitor {
-// List<STALRequest> requests;
-// List<HashDataInput> hashDataInput;
-//
-// void produce(List<STALRequest> req) {
-// requests = req;
-// }
-//
-// synchronized List<at.gv.egiz.stal.service.types.STALRequest> consume() {
-// List<at.gv.egiz.stal.service.types.STALRequest> reqs = new ArrayList<at.gv.egiz.stal.service.types.STALRequest>();
-// for (STALRequest request : requests) {
-// if (request instanceof SignRequest) {
-// at.gv.egiz.stal.service.types.SignRequest r = new at.gv.egiz.stal.service.types.SignRequest();
-// r.setKeyIdentifier(((SignRequest) request).getKeyIdentifier());
-// r.setSignedInfo(((SignRequest) request).getSignedInfo());
-// reqs.add(r);
-// } else if (request instanceof InfoboxReadRequest) {
-// at.gv.egiz.stal.service.types.InfoboxReadRequest r = new at.gv.egiz.stal.service.types.InfoboxReadRequest();
-// r.setDomainIdentifier(((InfoboxReadRequest) request).getDomainIdentifier());
-// r.setInfoboxIdentifier(((InfoboxReadRequest) request).getInfoboxIdentifier());
-// reqs.add(r);
-// } else if (request instanceof QuitRequest) {
-// at.gv.egiz.stal.service.types.QuitRequest r = new at.gv.egiz.stal.service.types.QuitRequest();
-// reqs.add(r);
-// } else {
-// log.error("unknown STAL request type: " + request.getClass());
-// requests = null;
-// return Collections.singletonList((at.gv.egiz.stal.service.types.STALRequest) new at.gv.egiz.stal.service.types.QuitRequest());
-// }
-// }
-// requests = null;
-// return reqs;
-// }
-//
-// void setHashDataInput(List<HashDataInput> hdi) {
-// hashDataInput = hdi;
-// }
-//
-// List<HashDataInput> getHashDataInput() {
-// return hashDataInput;
-// }
-// }
-//
-// /** TODO: now, that responses are not nulled, synchronize directly on responses? */
-// class ResponsesMonitor {
-// List<at.gv.egiz.stal.service.types.STALResponse> responses;
-//
-// void produce(List<at.gv.egiz.stal.service.types.STALResponse> resp) {
-// responses = resp;
-// }
-//
-// synchronized List<STALResponse> consume() {
-// List<STALResponse> resps = new ArrayList<STALResponse>();
-//
-// for (at.gv.egiz.stal.service.types.STALResponse response : responses) {
-// if (response instanceof at.gv.egiz.stal.service.types.InfoboxReadResponse) {
-// InfoboxReadResponse r = new InfoboxReadResponse();
-// r.setInfoboxValue(((at.gv.egiz.stal.service.types.InfoboxReadResponse) response).getInfoboxValue());
-// resps.add(r);
-// } else if (response instanceof at.gv.egiz.stal.service.types.SignResponse) {
-// SignResponse r = new SignResponse();
-// r.setSignatureValue(((at.gv.egiz.stal.service.types.SignResponse) response).getSignatureValue());
-// resps.add(r);
-// } else if (response instanceof at.gv.egiz.stal.service.types.ErrorResponse) {
-// ErrorResponse r = new ErrorResponse();
-// r.setErrorCode(((at.gv.egiz.stal.service.types.ErrorResponse) response).getErrorCode());
-// r.setErrorMessage(((at.gv.egiz.stal.service.types.ErrorResponse) response).getErrorMessage());
-// resps.add(r);
-// } else {
-// log.error("unknown STAL response type: " + response.getClass());
-// ErrorResponse r = new ErrorResponse(4000);
-// r.setErrorMessage("unknown STAL response type: " + response.getClass());
-// responses = null;
-// return Collections.singletonList((STALResponse) r);
-// }
-// }
-// responses = null;
-// return resps;
-// }
-// }
+
+ private List<JAXBElement<? extends RequestType>> createSingleQuitRequest() {
+ QuitRequestType quitT = stalObjFactory.createQuitRequestType();
+ JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
+ ArrayList<JAXBElement<? extends RequestType>> l = new ArrayList<JAXBElement<? extends RequestType>>();
+ l.add(quit);
+ return l;
+ }
}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
index 05a3f5e5..45629869 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package at.gv.egiz.stal.service.impl;
+//import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType;
+//import at.buergerkarte.namespaces.cardchannel.service.ScriptType;
import at.gv.egiz.bku.binding.BindingProcessor;
import at.gv.egiz.bku.binding.BindingProcessorManager;
import at.gv.egiz.bku.binding.Id;
@@ -36,6 +37,7 @@ import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.service.types.SignRequestType;
+import com.sun.xml.ws.developer.UsesJAXBContext;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -46,6 +48,7 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.servlet.ServletContext;
+import javax.xml.bind.JAXBElement;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import org.apache.commons.logging.Log;
@@ -56,46 +59,45 @@ import org.apache.commons.logging.LogFactory;
* @author clemens
*/
@WebService(endpointInterface = "at.gv.egiz.stal.service.STALPortType")
+@UsesJAXBContext(STALXJAXBContextFactory.class)
public class STALServiceImpl implements STALPortType {
public static final String BINDING_PROCESSOR_MANAGER = "bindingProcessorManager";
public static final Id TEST_SESSION_ID = IdFactory.getInstance().createId("TestSession");
-
protected static final Log log = LogFactory.getLog(STALServiceImpl.class);
-
+
+
static {
-
if (log.isTraceEnabled()) {
log.trace("enabling webservice communication dump");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
} else {
System.setProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "false");
}
-
}
-
@Resource
- WebServiceContext wsContext;
+ protected WebServiceContext wsContext;
protected IdFactory idF = IdFactory.getInstance();
+ private at.gv.egiz.stal.service.types.ObjectFactory stalObjFactory = new at.gv.egiz.stal.service.types.ObjectFactory();
+// private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory();
-
@Override
public GetNextRequestResponseType connect(String sessId) {
-
+
if (sessId == null) {
throw new NullPointerException("No session id provided");
}
-
+
Id sessionId = idF.createId(sessId);
if (log.isDebugEnabled()) {
log.debug("Received Connect [" + sessionId + "]");
}
-
+
if (TEST_SESSION_ID.equals(sessionId)) {
return getTestSessionNextRequestResponse(null);
}
-
+
GetNextRequestResponseType response = new GetNextRequestResponseType();
response.setSessionId(sessionId.toString());
@@ -103,7 +105,7 @@ public class STALServiceImpl implements STALPortType {
if (stal != null) {
- List<RequestType> requestsOut = ((STALRequestBroker) stal).connect();
+ List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).connect();
response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut);
if (log.isDebugEnabled()) {
@@ -112,29 +114,32 @@ public class STALServiceImpl implements STALPortType {
sb.append("] containing ");
sb.append(requestsOut.size());
sb.append(" requests: ");
- for (RequestType reqOut : requestsOut) {
- sb.append(reqOut.getClass());
+ for (JAXBElement<? extends RequestType> reqOut : requestsOut) {
+ sb.append(reqOut.getValue().getClass());
sb.append(' ');
}
log.debug(sb.toString());
}
} else {
log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType());
+ QuitRequestType quitT = stalObjFactory.createQuitRequestType();
+ JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
+ response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit);
}
return response;
}
-
+
@Override
public GetNextRequestResponseType getNextRequest(GetNextRequestType request) {
if (request.getSessionId() == null) {
throw new NullPointerException("No session id provided");
}
-
+
Id sessionId = idF.createId(request.getSessionId());
- List<ResponseType> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();//getResponse();
+ List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();
+// List<ResponseType> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();//getResponse();
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("Received GetNextRequest [");
@@ -142,25 +147,25 @@ public class STALServiceImpl implements STALPortType {
sb.append("] containing ");
sb.append(responsesIn.size());
sb.append(" responses: ");
- for (ResponseType respIn : responsesIn) {
+ for (Object respIn : responsesIn) {
sb.append(respIn.getClass());
sb.append(' ');
}
log.debug(sb.toString());
}
-
+
if (TEST_SESSION_ID.equals(sessionId)) {
return getTestSessionNextRequestResponse(responsesIn);
}
GetNextRequestResponseType response = new GetNextRequestResponseType();
response.setSessionId(sessionId.toString());
-
+
STALRequestBroker stal = getStal(sessionId);
if (stal != null) {
- List<RequestType> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn);
+ List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn);
response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut);
if (log.isDebugEnabled()) {
@@ -169,15 +174,17 @@ public class STALServiceImpl implements STALPortType {
sb.append("] containing ");
sb.append(requestsOut.size());
sb.append(" requests: ");
- for (RequestType reqOut : requestsOut) {
- sb.append(reqOut.getClass());
+ for (JAXBElement<? extends RequestType> reqOut : requestsOut) {
+ sb.append(reqOut.getValue().getClass());
sb.append(' ');
}
log.debug(sb.toString());
}
} else {
log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType());
+ QuitRequestType quitT = stalObjFactory.createQuitRequestType();
+ JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
+ response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit);
}
return response;
}
@@ -188,7 +195,7 @@ public class STALServiceImpl implements STALPortType {
if (request.getSessionId() == null) {
throw new NullPointerException("No session id provided");
}
-
+
Id sessionId = idF.createId(request.getSessionId());
if (log.isDebugEnabled()) {
@@ -197,13 +204,13 @@ public class STALServiceImpl implements STALPortType {
GetHashDataInputResponseType response = new GetHashDataInputResponseType();
response.setSessionId(sessionId.toString());
-
+
if (TEST_SESSION_ID.equals(sessionId)) {
log.debug("Received GetHashDataInput for session " + TEST_SESSION_ID + ", return DummyHashDataInput");
GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference();
ref.setID("signed-data-reference-0-1214921968-27971781-24309"); //Reference-" + TEST_SESSION_ID + "-001");
ref.setMimeType("text/plain");
-
+
Charset charset;
try {
charset = Charset.forName("iso-8859-15");
@@ -316,30 +323,52 @@ public class STALServiceImpl implements STALPortType {
return (bp == null) ? null : (bp.isFinished() ? null : (STALRequestBroker) bp.getSTAL());
}
- private GetNextRequestResponseType getTestSessionNextRequestResponse(List<ResponseType> responsesIn) {
+ private GetNextRequestResponseType getTestSessionNextRequestResponse(List<JAXBElement<? extends ResponseType>> responsesIn) {
GetNextRequestResponseType response = new GetNextRequestResponseType();
response.setSessionId(TEST_SESSION_ID.toString());
-
- if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0) instanceof ErrorResponseType) {
- log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType());
+
+ List<JAXBElement<? extends RequestType>> reqs = response.getInfoboxReadRequestOrSignRequestOrQuitRequest();
+
+ if (responsesIn == null) {
+ log.info("[TestSession] received CONNECT, return dummy requests ");
+// ScriptType scriptT = ccObjFactory.createScriptType();
+// CommandAPDUType cmd = ccObjFactory.createCommandAPDUType();
+// cmd.setValue("TestSession CardChannelCMD 1234".getBytes());
+// scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd);
+// reqs.add(ccObjFactory.createScript(scriptT));
+ addDummyRequests(reqs);
+ } else if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0).getValue() instanceof ErrorResponseType) {
+ log.info("[TestSession] received ErrorResponse, return QUIT request");
+ QuitRequestType quitT = stalObjFactory.createQuitRequestType();
+ reqs.add(stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT));
} else {
- log.info("Received TestSession GetNextRequest, returning SignRequest and 3 InfoboxReadRequests ");
- InfoboxReadRequestType req = new InfoboxReadRequestType();
- req.setInfoboxIdentifier("IdentityLink");
- req.setDomainIdentifier("hansiwurzel");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req);
- SignRequestType sig = new SignRequestType();
- sig.setKeyIdentifier("SecureSignatureKeypair");
- sig.setSignedInfo("<dsig:SignedInfo xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes());
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig);
- req = new InfoboxReadRequestType();
- req.setInfoboxIdentifier("CertifiedKeypair");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req);
- req = new InfoboxReadRequestType();
- req.setInfoboxIdentifier("SecureSignatureKeypair");
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req);
+ log.info("[TestSession] received " + responsesIn.size() + " response(s), return dummy requests" );
+ addDummyRequests(reqs);
}
return response;
}
+
+ private void addDummyRequests(List<JAXBElement<? extends RequestType>> reqs) {
+// log.info("[TestSession] add READ request for Infobox IdentityLink");
+// InfoboxReadRequestType ibrT1 = stalObjFactory.createInfoboxReadRequestType();
+// ibrT1.setInfoboxIdentifier("IdentityLink");
+// reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT1));
+
+ log.info("[TestSession] add READ request for Infobox CertifiedKeypair");
+ InfoboxReadRequestType ibrT2 = stalObjFactory.createInfoboxReadRequestType();
+ ibrT2.setInfoboxIdentifier("CertifiedKeypair");
+ reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT2));
+
+ log.info("[TestSession] add READ request for Infobox SecureSignatureKeypair");
+ InfoboxReadRequestType ibrT3 = stalObjFactory.createInfoboxReadRequestType();
+ ibrT3.setInfoboxIdentifier("SecureSignatureKeypair");
+ reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT3));
+
+ log.info("[TestSession] add SIGN request");
+ SignRequestType sigT1 = stalObjFactory.createSignRequestType();
+ sigT1.setKeyIdentifier("SecureSignatureKeypair");
+ sigT1.setSignedInfo("<dsig:SignedInfo xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes());
+ reqs.add(stalObjFactory.createGetNextRequestResponseTypeSignRequest(sigT1));
+ }
+
}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java
new file mode 100644
index 00000000..92559254
--- /dev/null
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.stal.service.impl;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.ws.api.model.SEIModel;
+import com.sun.xml.ws.developer.JAXBContextFactory;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.JAXBException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class STALXJAXBContextFactory implements JAXBContextFactory {
+
+ private static final Log log = LogFactory.getLog(STALXJAXBContextFactory.class);
+
+ @Override
+ public JAXBRIContext createJAXBContext(SEIModel sei, List<Class> classesToBind, List<TypeReference> typeReferences) throws JAXBException {
+ if (log.isTraceEnabled()) {
+ log.trace("JAXBContext seed for SEI " + sei.getTargetNamespace() + ":");
+ for (Class class1 : classesToBind) {
+ log.trace(" " + class1);
+ }
+ for (TypeReference typeReference : typeReferences) {
+ log.trace(" typeRef " + typeReference.tagName + " -> " + typeReference.type);
+ }
+ }
+ List<Class> classes = new ArrayList<Class>();
+ classes.addAll(classesToBind);
+// Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class;
+// if (!classes.contains(ccOF)) {
+// log.debug("adding " + ccOF + " to JAXBContext seed");
+// classes.add(ccOF);
+// }
+
+ //TODO add typeReference?
+
+ return JAXBRIContext.newInstance(classes.toArray(new Class[classes.size()]),
+ typeReferences, null, sei.getTargetNamespace(), false, null);
+ }
+}