aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java')
-rw-r--r--spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java41
1 files changed, 38 insertions, 3 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java b/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
index 806b76409..106742067 100644
--- a/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
+++ b/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/ExternalURIResolver.java
@@ -1,5 +1,8 @@
package at.gv.egovernment.moa.spss.server.invoke;
+import iaik.ixsil.exceptions.URIException;
+import iaik.ixsil.util.URI;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
@@ -7,10 +10,9 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-import iaik.ixsil.exceptions.URIException;
-import iaik.ixsil.util.URI;
-
import at.gv.egovernment.moa.spss.MOAApplicationException;
+import at.gv.egovernment.moa.spss.server.transaction.TransactionContext;
+import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager;
/**
* Resolve external URIs and provide them as a stream.
@@ -52,6 +54,39 @@ public class ExternalURIResolver {
throw new MOAApplicationException("2213", new Object[] { uriStr });
}
+ // if we have local content (SOAP with attachments)
+ if ("formdata".equals(uri.getScheme())) {
+ TransactionContext context = TransactionContextManager.getInstance().getTransactionContext();
+ if (context==null) {
+ //no transaction
+ throw new MOAApplicationException("2282", new Object[] { uri });
+ } else {
+
+ InputStream attachmentIs = context.getAttachmentInputStream(uri);
+ if (attachmentIs != null) {
+ setContentType(context.getAttachmentContentType(uri.getPath()));
+ return attachmentIs;
+ } else {
+ //maybe attachments provided but no suiting attachment found
+ throw new MOAApplicationException("2282", new Object[] { uri });
+ }
+/*
+ try {
+ InputStream attachmentIs = context.getAttachment(uri).getInputStream();
+ if (attachmentIs != null) {
+ setContentType(context.getAttachmentContentType(uri.getPath()));
+ return attachmentIs;
+ } else {
+ //maybe attachments provided but no suiting attachment found
+ throw new MOAApplicationException("2282", new Object[] { uri });
+ }
+ } catch (IOException e) {
+ throw new MOAApplicationException("2208", new Object[] { uri }, e);
+ }
+*/
+ }
+ }
+
// convert URI to URL
try {
// create the URL