summaryrefslogtreecommitdiff
path: root/bkucommon
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java1
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java20
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java25
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java8
4 files changed, 46 insertions, 8 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
index 0082de26..22ee0d1d 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java
@@ -187,6 +187,7 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager {
}
BindingProcessor bindingProcessor = new HTTPBindingProcessor(aSessionId,
commandInvokerClass.newInstance(), url);
+ stalFactory.setLocale(locale);
STAL stal = stalFactory.createSTAL();
bindingProcessor.init(stal, commandInvokerClass.newInstance());
if (locale != null) {
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
index bb0314b5..775f4136 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
@@ -36,6 +36,8 @@ import javax.net.ssl.HttpsURLConnection;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.binding.multipart.InputStreamPartSource;
import at.gv.egiz.bku.binding.multipart.SLResultPart;
@@ -49,6 +51,8 @@ import at.gv.egiz.bku.utils.binding.Protocol;
*
*/
public class DataUrlConnectionImpl implements DataUrlConnectionSPI {
+
+ private final static Log log = LogFactory.getLog(DataUrlConnectionImpl.class);
public final static Protocol[] SUPPORTED_PROTOCOLS = { Protocol.HTTP,
Protocol.HTTPS };
@@ -80,10 +84,6 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI {
*/
public void connect() throws SocketTimeoutException, IOException {
connection = (HttpURLConnection) url.openConnection();
-
- // FIXXME move this to config.
- HttpURLConnection.setFollowRedirects(false);
-
connection.setDoOutput(true);
Set<String> headers = requestHttpHeaders.keySet();
Iterator<String> headerIt = headers.iterator();
@@ -146,10 +146,14 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI {
Part[] parts = new Part[formParams.size()];
Part.sendParts(os, formParams.toArray(parts), boundary.getBytes());
os.close();
- // MultipartRequestEntity PostMethod
- result = new DataUrlResponse(url.toString(), connection.getResponseCode(),
- connection.getInputStream());
-
+ // MultipartRequestEntity PostMethod
+ InputStream is = null;
+ try {
+ is = connection.getInputStream();
+ } catch (IOException iox) {
+ log.info(iox);
+ }
+ result = new DataUrlResponse(url.toString(), connection.getResponseCode(), is);
Map<String, String> responseHttpHeaders = new HashMap<String, String>();
Map<String, List<String>> httpHeaders = connection.getHeaderFields();
for (Iterator<String> keyIt = httpHeaders.keySet().iterator(); keyIt
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
index 2330ed3f..8baa0137 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
@@ -463,6 +463,31 @@ public class Signature {
log.trace("Reference caching is not enabled.");
}
}
+ for (Reference reference : getReferences()) {
+ if (reference.getType() != null) {
+ InputStream digestInputStream = reference.getDigestInputStream();
+ if (digestInputStream != null) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("DigestInput for Reference with id='");
+ sb.append(reference.getId());
+ sb.append("'; Type:");
+ sb.append(reference.getType());
+ sb.append("):\n");
+ try {
+ byte[] b = new byte[512];
+ for (int l; (l = digestInputStream.read(b)) != -1;) {
+ sb.append(new String(b, 0, l));
+ }
+ } catch (IOException e) {
+ log.error(e);
+ }
+ log.trace(sb.toString());
+ } else {
+ log.trace("Reference caching is not enabled.");
+ }
+
+ }
+ }
}
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java
index 45dcdc3a..f832f364 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java
@@ -16,6 +16,8 @@
*/
package at.gv.egiz.bku.binding;
+import java.util.Locale;
+
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
@@ -25,6 +27,12 @@ public class DummyStalFactory implements STALFactory {
public STAL createSTAL() {
// TODO Auto-generated method stub
return new at.gv.egiz.stal.dummy.DummySTAL();
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ // TODO Auto-generated method stub
+
}
}