summaryrefslogtreecommitdiff
path: root/bkucommon
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-16 01:10:19 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-20 17:27:43 +0200
commite2e362adebee3f8e1e83424877dab81e447a34ca (patch)
tree0bd3ef974e9c6496c18478563220ca592190585a /bkucommon
parente77a52c99ae113365bcecc39e608381071945660 (diff)
downloadmocca-e2e362adebee3f8e1e83424877dab81e447a34ca.tar.gz
mocca-e2e362adebee3f8e1e83424877dab81e447a34ca.tar.bz2
mocca-e2e362adebee3f8e1e83424877dab81e447a34ca.zip
Refactor
Diffstat (limited to 'bkucommon')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java83
1 files changed, 41 insertions, 42 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java
index 06d0fb23..e7bc2f33 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java
@@ -465,52 +465,51 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement
case 200:
String contentType = dataUrlResponse.getContentType();
log.debug("Got dataurl response content type: {}.", contentType);
- if (contentType != null) {
- if ((contentType.startsWith(HttpUtil.APPLICATION_URL_ENCODED))
- || (contentType.startsWith(HttpUtil.MULTIPART_FORMDATA))) {
- log.debug("Detected SL Request in dataurl response.");
- // process headers and request
- setHTTPHeaders(dataUrlResponse.getResponseHeaders());
- consumeRequestStream(dataUrlResponse.getUrl(), dataUrlResponse.getStream());
- //TODO check for bindingProcessorError
- closeDataUrlConnection();
- srcContex.setSourceCertificate(serverCertificate);
- srcContex.setSourceIsDataURL(true);
- srcContex.setSourceUrl(conn.getURL());
- currentState = State.PROCESS;
- } else if (((contentType.startsWith(HttpUtil.TXT_HTML))
- || (contentType.startsWith(HttpUtil.TXT_PLAIN))
- || (contentType.startsWith(HttpUtil.TXT_XML)))
- && (dataUrlResponse.isHttpResponseXMLOK())) {
- log.info(
- "Dataurl response matches <ok/> with content type: {}.", contentType);
- currentState = State.TRANSFORM;
-
- } else if ((contentType.startsWith(HttpUtil.TXT_XML))
- && (!dataUrlResponse.isHttpResponseXMLOK())) {
- log.debug("Detected text/xml dataurl response with content != <ok/>");
- headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType);
- assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset(
- contentType, true));
- closeDataUrlConnection();
- srcContex.setSourceCertificate(serverCertificate);
- srcContex.setSourceIsDataURL(true);
- srcContex.setSourceUrl(conn.getURL());
- currentState = State.PROCESS;
- // just to be complete, actually not used
- srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders()
- .get(HttpUtil.HTTP_HEADER_REFERER));
- } else {
- resultContentType = contentType;
- responseHeaders = dataUrlResponse.getResponseHeaders();
- responseCode = dataUrlResponse.getResponseCode();
- currentState = State.FINISHED;
- }
- } else {
+ if (contentType == null) {
log.info("Content type not set in dataurl response.");
closeDataUrlConnection();
throw new SLBindingException(2007);
}
+ if ((contentType.startsWith(HttpUtil.APPLICATION_URL_ENCODED))
+ || (contentType.startsWith(HttpUtil.MULTIPART_FORMDATA))) {
+ log.debug("Detected SL Request in dataurl response.");
+ // process headers and request
+ setHTTPHeaders(dataUrlResponse.getResponseHeaders());
+ consumeRequestStream(dataUrlResponse.getUrl(), dataUrlResponse.getStream());
+ //TODO check for bindingProcessorError
+ closeDataUrlConnection();
+ srcContex.setSourceCertificate(serverCertificate);
+ srcContex.setSourceIsDataURL(true);
+ srcContex.setSourceUrl(conn.getURL());
+ currentState = State.PROCESS;
+ } else if (((contentType.startsWith(HttpUtil.TXT_HTML))
+ || (contentType.startsWith(HttpUtil.TXT_PLAIN))
+ || (contentType.startsWith(HttpUtil.TXT_XML)))
+ && (dataUrlResponse.isHttpResponseXMLOK())) {
+ log.info(
+ "Dataurl response matches <ok/> with content type: {}.", contentType);
+ currentState = State.TRANSFORM;
+
+ } else if ((contentType.startsWith(HttpUtil.TXT_XML))
+ && (!dataUrlResponse.isHttpResponseXMLOK())) {
+ log.debug("Detected text/xml dataurl response with content != <ok/>");
+ headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType);
+ assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset(
+ contentType, true));
+ closeDataUrlConnection();
+ srcContex.setSourceCertificate(serverCertificate);
+ srcContex.setSourceIsDataURL(true);
+ srcContex.setSourceUrl(conn.getURL());
+ currentState = State.PROCESS;
+ // just to be complete, actually not used
+ srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders()
+ .get(HttpUtil.HTTP_HEADER_REFERER));
+ } else {
+ resultContentType = contentType;
+ responseHeaders = dataUrlResponse.getResponseHeaders();
+ responseCode = dataUrlResponse.getResponseCode();
+ currentState = State.FINISHED;
+ }
break;
case 307: