summaryrefslogtreecommitdiff
path: root/BKUOnline
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-15 18:03:25 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-15 18:03:25 +0000
commit43812f2c0d81eaba7e07ece82acf396ac35e2b5d (patch)
treed0da7da4cff429df6620c0a3630bd60daabed547 /BKUOnline
parenta288c99fa6955a2c9055b28dc1c805dacbe5fc93 (diff)
downloadmocca-43812f2c0d81eaba7e07ece82acf396ac35e2b5d.tar.gz
mocca-43812f2c0d81eaba7e07ece82acf396ac35e2b5d.tar.bz2
mocca-43812f2c0d81eaba7e07ece82acf396ac35e2b5d.zip
encoding
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@41 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline')
-rw-r--r--BKUOnline/pom.xml36
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java9
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java370
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd3
-rw-r--r--BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java16
-rw-r--r--BKUOnline/src/test/resources/appletTest.html29
6 files changed, 251 insertions, 212 deletions
diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml
index bcaf0a70..d6d26a82 100644
--- a/BKUOnline/pom.xml
+++ b/BKUOnline/pom.xml
@@ -70,9 +70,6 @@
-->
<dependency>
<groupId>com.sun.xml.ws</groupId>
- <!--
- artifactId>webservices-rt</artifactId> <version>1.2</version
- -->
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
<!--
@@ -83,11 +80,6 @@
<artifactId>saaj-impl</artifactId> </exclusion> </exclusions
-->
</dependency>
- <!--
- dependency> <groupId>at.gv.egiz</groupId>
- <artifactId>BKUApplet</artifactId> <version>1.0-SNAPSHOT</version>
- <scope>compile</scope> </dependency
- -->
</dependencies>
<properties>
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
@@ -128,20 +120,20 @@
</execution>
</executions>
</plugin>
- <!--
- plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxws-maven-plugin</artifactId> <executions> <execution>
- <goals> <goal>wsimport</goal> </goals> <configuration>
- <verbose>true</verbose>
- <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory>
- <bindingFiles> <bindingFile>stalservice-custom.xml</bindingFile>
- <bindingFile>staltypes-custom.xml</bindingFile> </bindingFiles>
- <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
- <wsdlFiles> <wsdlFile>stal.wsdl</wsdlFile> </wsdlFiles>
- <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
- <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile>
- </configuration> </execution> </executions> </plugin
- -->
+ <!--plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId> <executions> <execution>
+ <goals> <goal>wsimport</goal> </goals> <configuration>
+ <verbose>true</verbose>
+ <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory>
+ <bindingFiles> <bindingFile>stalservice-custom.xml</bindingFile>
+ <bindingFile>staltypes-custom.xml</bindingFile> </bindingFiles>
+ <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
+ <wsdlFiles> <wsdlFile>stal.wsdl</wsdlFile> </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
+ <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile>
+ </configuration> </execution> </executions>
+ </plugin-->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
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 ef0bcdd6..727e8cf4 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
@@ -53,6 +53,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
protected List<HashDataInput> currentHashDataInput;
private boolean isHandlingRequest = false;
private boolean expectingResponse = false;
+ private boolean interrupted = false;
// private Object handleRequestCondition = new Object();
// private Object gotResponsesCondition = new Object();
// public STALRequestBrokerImpl() {
@@ -75,6 +76,9 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
*/
@Override
public synchronized List<STALResponse> handleRequest(List<STALRequest> requests) {
+ if (interrupted) {
+ return null;
+ }
try {
long beforeWait = System.currentTimeMillis();
while (isHandlingRequest) {
@@ -161,6 +165,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
return resps;
} catch (InterruptedException ex) {
log.warn("interrupt in handleRequest(): " + ex.getMessage());
+ interrupted = true;
return null;
}
}
@@ -172,6 +177,9 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
*/
@Override
public synchronized List<STALRequest> nextRequest(List<STALResponse> responses) {
+ if (interrupted) {
+ return null;
+ }
try {
if (responses != null && responses.size() > 0) {
if (!expectingResponse) {
@@ -244,6 +252,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
return reqs;
} catch (InterruptedException ex) {
log.warn("interrupt in nextRequest(): " + ex.getMessage());
+ interrupted = true;
return null;
}
}
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 f4cdc7d2..385888e9 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
@@ -56,206 +56,198 @@ import org.apache.commons.logging.LogFactory;
@WebService(endpointInterface = "at.gv.egiz.stal.service.STALPortType")
public class STALServiceImpl implements STALPortType {
- public static final String BINDING_PROCESSOR_MANAGER = "bindingProcessorManager";
- public static final String TEST_SESSION_ID = "TestSession";
- protected static final Log log = LogFactory.getLog(STALServiceImpl.class);
- @Resource
- WebServiceContext wsContext;
- protected IdFactory idF = IdFactory.getInstance();
-
- @Override
- public GetNextRequestResponseType getNextRequest(GetNextRequestType request) {
-
- // HttpSession session = ((HttpServletRequest)
- // mCtx.get(MessageContext.SERVLET_REQUEST)).getSession();
- String sessId = request.getSessionId();
- List<STALResponse> responses = request.getResponse();
- if (log.isDebugEnabled()) {
- log.debug("Received GetNextRequest for session " + sessId + " containing " + responses.size() + " responses");
- }
-
- GetNextRequestResponseType response = new GetNextRequestResponseType();
- response.setSessionId(sessId);
+ 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);
+ @Resource
+ WebServiceContext wsContext;
+ protected IdFactory idF = IdFactory.getInstance();
+
+ @Override
+ public GetNextRequestResponseType getNextRequest(GetNextRequestType request) {
+
+ Id sessionId = idF.createId(request.getSessionId());
+
+ List<STALResponse> responsesIn = request.getResponse();
+
+ GetNextRequestResponseType response = new GetNextRequestResponseType();
+ response.setSessionId(sessionId.toString());
+
+ if (TEST_SESSION_ID.equals(sessionId)) {
+ if (responsesIn.size() > 0 && responsesIn.get(0) instanceof ErrorResponse) {
+ log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest");
+ response.getRequest().add(new QuitRequest());
+ } else {
+ log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest ");
+ SignRequest sig = new SignRequest();
+ 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.getRequest().add(sig);
+ InfoboxReadRequest req = new InfoboxReadRequest();
+ req.setInfoboxIdentifier("IdentityLink");
+ req.setDomainIdentifier("hansiwurzel");
+ response.getRequest().add(req);
+ req = new InfoboxReadRequest();
+ req.setInfoboxIdentifier("CertifiedKeypair");
+ response.getRequest().add(req);
+ req = new InfoboxReadRequest();
+ req.setInfoboxIdentifier("SecureSignatureKeypair");
+ response.getRequest().add(req);
+ }
+ return response;
+ }
- if (TEST_SESSION_ID.equals(sessId)) {
- if (responses.size() > 0 && responses.get(0) instanceof ErrorResponse) {
- log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest");
- response.getRequest().add(new QuitRequest());
- } else {
- log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest ");
- SignRequest sig = new SignRequest();
- 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.getRequest().add(sig);
- InfoboxReadRequest req = new InfoboxReadRequest();
- req.setInfoboxIdentifier("IdentityLink");
- req.setDomainIdentifier("hansiwurzel");
- response.getRequest().add(req);
- req = new InfoboxReadRequest();
- req.setInfoboxIdentifier("CertifiedKeypair");
- response.getRequest().add(req);
- req = new InfoboxReadRequest();
- req.setInfoboxIdentifier("SecureSignatureKeypair");
- response.getRequest().add(req);
- }
- return response;
+ STALRequestBroker stal = getStal(sessionId);
+
+ if (stal != null) {
+ if (log.isDebugEnabled()) {
+ StringBuilder sb = new StringBuilder("Received GetNextRequest [");
+ sb.append(sessionId.toString());
+ sb.append("] containing ");
+ sb.append(responsesIn.size());
+ sb.append(" responses: ");
+ for (STALResponse respIn : responsesIn) {
+ sb.append(respIn);
+ sb.append(' ');
}
-
- // get Session Id
- Id sessionId = idF.createId(sessId);
- STALRequestBroker stal = getStal(sessionId);
-
- if (stal == null) {
- log.error("Failed to get STAL for session " + sessId + ", returning QuitRequest");
- response.getRequest().add(new QuitRequest());
- } else {
- List<STALResponse> responsesIn = request.getResponse();
- for (STALResponse resp : responsesIn) {
- log.debug(resp);
- }
- List<STALRequest> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn);
- response.getRequest().addAll(requestsOut);
- if (log.isDebugEnabled()) {
- log.debug("Returning GetNextRequestResponse for session " + sessId + " containing " + requestsOut.size() + " requests");
- }
+ }
+
+ List<STALRequest> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn);
+ response.getRequest().addAll(requestsOut);
+
+ if (log.isDebugEnabled()) {
+ StringBuilder sb = new StringBuilder("Returning GetNextRequestResponse [");
+ sb.append(sessionId.toString());
+ sb.append("] containing ");
+ sb.append(requestsOut.size());
+ sb.append(" requests: ");
+ for (STALRequest reqOut : requestsOut) {
+ sb.append(reqOut);
+ sb.append(' ');
}
- return response;
+ }
+ } else {
+ log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest");
+ response.getRequest().add(new QuitRequest());
}
+ return response;
+ }
- @Override
- public GetHashDataInputResponseType getHashDataInput(
- GetHashDataInputType request) throws GetHashDataInputFault {
+ @Override
+ public GetHashDataInputResponseType getHashDataInput(GetHashDataInputType request) throws GetHashDataInputFault {
- String sessId = request.getSessionId();
- if (log.isDebugEnabled()) {
- log.debug("Received GetHashDataInputRequest for session " + sessId + " containing " + request.getReference().size() + " referencese");
- }
-
- // get Session Id
- Id sessionId = idF.createId(sessId);
- STALRequestBroker stal = getStal(sessionId);
-
- if (stal == null) {
- String msg = "Failed to get STAL for session " + sessId;
- log.error(msg);
- GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
- faultInfo.setErrorCode(1);
- faultInfo.setErrorMessage(msg);
- throw new GetHashDataInputFault(msg, faultInfo);
- } else {
-
- List<HashDataInput> hashDataInputs = stal.getHashDataInput();
-
- if (TEST_SESSION_ID.equals(sessId)) {
- log.debug("Received TestSession GetHashDataInput, setting dummy HashDataInputCallback");
-
- HashDataInput testHdi = new HashDataInput() {
+ Id sessionId = idF.createId(request.getSessionId());
- @Override
- public String getReferenceId() {
- return "hashDataInputId_" + TEST_SESSION_ID;
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Received GetHashDataInputRequest for session " + sessionId + " containing " + request.getReference().size() + " reference(s)");
+ }
- @Override
- public String getMimeType() {
- return "text/plain";
- }
+ 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("Reference-" + TEST_SESSION_ID + "-001");
+ ref.setMimeType("text/plain");
+ ref.setEncoding("UTF-8");
+ ref.setValue("hashdatainput-öäüß@€-00000000001".getBytes());
+ response.getReference().add(ref);
+ return response;
+ } else {
+ STALRequestBroker stal = getStal(sessionId);
+
+ if (stal != null) {
+ List<HashDataInput> hashDataInputs = stal.getHashDataInput();
+
+ if (hashDataInputs != null) {
+
+ Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>();
+ for (HashDataInput hdi : hashDataInputs) {
+ if (log.isTraceEnabled()) {
+ log.trace("Provided HashDataInput for reference " + hdi.getReferenceId());
+ }
+ hashDataIdMap.put(hdi.getReferenceId(), hdi);
+ }
+
+ List<GetHashDataInputType.Reference> reqRefs = request.getReference();
+ for (GetHashDataInputType.Reference reqRef : reqRefs) {
+ String reqRefId = reqRef.getID();
+ HashDataInput reqHdi = hashDataIdMap.get(reqRefId);
+ if (reqHdi == null) {
+ String msg = "Failed to resolve HashDataInput for reference " + reqRefId;
+ log.error(msg);
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(msg);
+ throw new GetHashDataInputFault(msg, faultInfo);
+ }
- @Override
- public InputStream getHashDataInput() {
- byte[] hd = ("hashDataInput_" + TEST_SESSION_ID).getBytes();
- return new ByteArrayInputStream(hd);
- }
- };
- hashDataInputs = Collections.singletonList(testHdi);
+ InputStream hashDataIS = reqHdi.getHashDataInput();
+ if (hashDataIS == null) {
+ //HashDataInput not cached?
+ String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached";
+ log.error(msg);
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(msg);
+ throw new GetHashDataInputFault(msg, faultInfo);
}
-
-
- if (hashDataInputs != null) {
-
- Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>();
- for (HashDataInput hdi : hashDataInputs) {
- if (log.isTraceEnabled()) {
- log.trace("Provided HashDataInput for reference " + hdi.getReferenceId());
- }
- hashDataIdMap.put(hdi.getReferenceId(), hdi);
- }
-
- GetHashDataInputResponseType response = new GetHashDataInputResponseType();
- response.setSessionId(sessId);
-
- List<GetHashDataInputType.Reference> reqRefs = request.getReference();
- for (GetHashDataInputType.Reference reqRef : reqRefs) {
- String reqRefId = reqRef.getID();
- HashDataInput reqHdi = hashDataIdMap.get(reqRefId);
- if (reqHdi == null) {
- String msg = "Failed to resolve HashDataInput for reference " + reqRefId;
- log.error(msg);
- GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
- faultInfo.setErrorCode(1);
- faultInfo.setErrorMessage(msg);
- throw new GetHashDataInputFault(msg, faultInfo);
- }
-
- InputStream hashDataIS = reqHdi.getHashDataInput();
- if (hashDataIS == null) {
- //HashDataInput not cached?
- String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached";
- log.error(msg);
- GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
- faultInfo.setErrorCode(1);
- faultInfo.setErrorMessage(msg);
- throw new GetHashDataInputFault(msg, faultInfo);
- }
- ByteArrayOutputStream baos = null;
- try {
- if(log.isDebugEnabled()) {
- log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ")");
- }
- baos = new ByteArrayOutputStream(hashDataIS.available());
- int c;
- while ((c = hashDataIS.read()) != -1) {
- baos.write(c);
- }
- GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference();
- ref.setID(reqRefId);
- ref.setMimeType(reqHdi.getMimeType());
- ref.setValue(baos.toByteArray());
- response.getReference().add(ref);
- } catch (IOException ex) {
- String msg = "Failed to get HashDataInput for reference " + reqRefId;
- log.error(msg, ex);
- GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
- faultInfo.setErrorCode(1);
- faultInfo.setErrorMessage(msg);
- throw new GetHashDataInputFault(msg, faultInfo, ex);
- } finally {
- try {
- baos.close();
- } catch (IOException ex) {
- }
- }
- }
- return response;
- } else {
- String msg = "Failed to resolve any HashDataInputs for session " + sessId;
- log.error(msg);
- GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
- faultInfo.setErrorCode(1);
- faultInfo.setErrorMessage(msg);
- throw new GetHashDataInputFault(msg, faultInfo);
+ ByteArrayOutputStream baos = null;
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")");
+ }
+ baos = new ByteArrayOutputStream(hashDataIS.available());
+ int c;
+ while ((c = hashDataIS.read()) != -1) {
+ baos.write(c);
+ }
+ GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference();
+ ref.setID(reqRefId);
+ ref.setMimeType(reqHdi.getMimeType());
+ ref.setEncoding(reqHdi.getEncoding());
+ ref.setValue(baos.toByteArray());
+ response.getReference().add(ref);
+ } catch (IOException ex) {
+ String msg = "Failed to get HashDataInput for reference " + reqRefId;
+ log.error(msg, ex);
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(msg);
+ throw new GetHashDataInputFault(msg, faultInfo, ex);
+ } finally {
+ try {
+ baos.close();
+ } catch (IOException ex) {
+ }
}
+ }
+ return response;
+ } else {
+ String msg = "Failed to resolve any HashDataInputs for session " + sessionId;
+ log.error(msg);
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(msg);
+ throw new GetHashDataInputFault(msg, faultInfo);
}
+ } else {
+ String msg = "Failed to get STAL for session " + sessionId;
+ log.error(msg);
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(msg);
+ throw new GetHashDataInputFault(msg, faultInfo);
+ }
}
-
- private STALRequestBroker getStal(Id sessionId) {
-// log.warn("RETURNING DUMMY STAL REQUEST BROKER");
-// return new STALRequestBrokerImpl();
-
- MessageContext mCtx = wsContext.getMessageContext();
- ServletContext sCtx = (ServletContext) mCtx.get(MessageContext.SERVLET_CONTEXT);
- BindingProcessorManager bpMgr = (BindingProcessorManager) sCtx.getAttribute(BINDING_PROCESSOR_MANAGER);
- BindingProcessor bp = bpMgr.getBindingProcessor(sessionId);
- return (bp == null) ? null : (STALRequestBroker) bp.getSTAL();
- }
+ }
+
+ private STALRequestBroker getStal(Id sessionId) {
+ MessageContext mCtx = wsContext.getMessageContext();
+ ServletContext sCtx = (ServletContext) mCtx.get(MessageContext.SERVLET_CONTEXT);
+ BindingProcessorManager bpMgr = (BindingProcessorManager) sCtx.getAttribute(BINDING_PROCESSOR_MANAGER);
+ BindingProcessor bp = bpMgr.getBindingProcessor(sessionId);
+ return (bp == null) ? null : (STALRequestBroker) bp.getSTAL();
+ }
}
diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
index c4e48e2c..b3c4841a 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
+++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
@@ -120,7 +120,8 @@
<simpleContent>
<extension base="base64Binary">
<attribute name="ID" type="string"/>
- <attribute name="MimeType" type="string"/>
+ <attribute name="MimeType" type="string" use="optional"/>
+ <attribute name="Encoding" type="string" use="optional"/>
</extension>
</simpleContent>
</complexType>
diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
index 62d6f8a6..2bcc96ae 100644
--- a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
+++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
@@ -111,6 +111,10 @@ public class STALRequestBrokerTest {
public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -152,6 +156,10 @@ public class STALRequestBrokerTest {
public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -207,6 +215,10 @@ public class STALRequestBrokerTest {
public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -231,6 +243,10 @@ public class STALRequestBrokerTest {
public InputStream getHashDataInput() {
return new ByteArrayInputStream("<xml>hashdatainput6789</xml>".getBytes());
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
r2.setHashDataInput(Collections.singletonList(hdi2));
requests2.add(r2);
diff --git a/BKUOnline/src/test/resources/appletTest.html b/BKUOnline/src/test/resources/appletTest.html
new file mode 100644
index 00000000..7e4a17cc
--- /dev/null
+++ b/BKUOnline/src/test/resources/appletTest.html
@@ -0,0 +1,29 @@
+<!--
+ 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.
+-->
+<html>
+ <body>
+ <center>
+ <applet code="at.gv.egiz.bku.online.applet.BKUApplet.class"
+ archive="../BKUOnline-1.0-SNAPSHOT/applet/BKUApplet-1.0-SNAPSHOT.jar , ../BKUOnline-1.0-SNAPSHOT/applet/commons-logging-1.1.1.jar , ../BKUOnline-1.0-SNAPSHOT/applet/iaik_jce_me4se-3.04.jar"
+ width=380 height=160>
+ <param name="WSDL_URL" value="http://localhost:8080/bkuonline/stal?wsdl"/>
+ <param name="SessionId" value="TestSession"/>
+ <param name="redirectURL" value="http://localhost:8080/bkuonline/stal?wsdl"/>
+ </applet>
+ </center>
+ </body>
+</html> \ No newline at end of file