diff --git a/iceland/core/src/main/java/org/n52/iceland/coding/encode/ResponseWriter.java b/iceland/core/src/main/java/org/n52/iceland/coding/encode/ResponseWriter.java index 2d1d3f509..c2cf6aedd 100644 --- a/iceland/core/src/main/java/org/n52/iceland/coding/encode/ResponseWriter.java +++ b/iceland/core/src/main/java/org/n52/iceland/coding/encode/ResponseWriter.java @@ -72,6 +72,19 @@ default boolean isSetContentType() { */ void write(T t, OutputStream out, ResponseProxy responseProxy) throws IOException, EncodingException; + /** + * Write object t to {@link OutputStream} out + * + * @param t Object to write + * @param out {@link OutputStream} to be written to + + * + * @throws IOException If an error occurs during writing + * @throws EncodingException if an errors occurs during encoding + * + */ + void write(T t, OutputStream out) throws IOException, EncodingException; + /** * Check if GZip is supported by this writer * diff --git a/iceland/core/src/main/java/org/n52/iceland/response/EXIResponseWriter.java b/iceland/core/src/main/java/org/n52/iceland/response/EXIResponseWriter.java index 54dbdf43f..0aa577635 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/EXIResponseWriter.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/EXIResponseWriter.java @@ -78,6 +78,11 @@ public Set getKeys() { @Override public void write(EXIObject exiObject, OutputStream out, ResponseProxy responseProxy) throws IOException, EncodingException { + write(exiObject, out); + } + + @Override + public void write(EXIObject exiObject, OutputStream out) throws IOException, EncodingException { byte[] bytes = getBytes(exiObject); try (InputStream is = new ByteArrayInputStream(bytes)) { EXIResult result = new EXIResult(this.exiFactory.get()); diff --git a/iceland/core/src/main/java/org/n52/iceland/response/JSONResponseWriter.java b/iceland/core/src/main/java/org/n52/iceland/response/JSONResponseWriter.java index 87fea4673..eedd97d7b 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/JSONResponseWriter.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/JSONResponseWriter.java @@ -54,6 +54,11 @@ public Set getKeys() { @Override public void write(JsonNode t, OutputStream out, ResponseProxy responseProxy) throws IOException { + write(t, out); + } + + @Override + public void write(JsonNode t, OutputStream out) throws IOException { Json.print(out, t); } diff --git a/iceland/core/src/main/java/org/n52/iceland/response/ServiceResponse.java b/iceland/core/src/main/java/org/n52/iceland/response/ServiceResponse.java index 0852a91ec..0dc3f1cc6 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/ServiceResponse.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/ServiceResponse.java @@ -24,13 +24,12 @@ import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import org.n52.iceland.service.CommunicationObjectWithSoapHeader; import org.n52.janmayen.http.HTTPStatus; import org.n52.janmayen.http.MediaType; import org.n52.shetland.w3c.soap.SoapHeader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; import com.google.common.collect.Maps; diff --git a/iceland/core/src/main/java/org/n52/iceland/response/SoapChainResponseWriter.java b/iceland/core/src/main/java/org/n52/iceland/response/SoapChainResponseWriter.java index 72adaab60..39124955f 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/SoapChainResponseWriter.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/SoapChainResponseWriter.java @@ -72,7 +72,8 @@ public void write(SoapChain chain, OutputStream out, ResponseProxy responseProxy } } - private void write(SoapChain chain, OutputStream out) throws EncodingException, IOException { + @Override + public void write(SoapChain chain, OutputStream out) throws EncodingException, IOException { String namespace = chain.getSoapResponse().getSoapNamespace(); EncoderKey key = CodingHelper.getEncoderKey(namespace, chain.getSoapResponse()); Encoder encoder = getEncoder(key); diff --git a/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriter.java b/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriter.java index 60b324633..632193c60 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriter.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriter.java @@ -55,6 +55,11 @@ public Set getKeys() { @Override public void write(XmlObject xml, OutputStream out, ResponseProxy responseProxy) throws IOException { + write(xml, out); + } + + @Override + public void write(XmlObject xml, OutputStream out) throws IOException { xml.save(out, this.xmlOptions.get()); } diff --git a/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriterFactory.java b/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriterFactory.java index 8a2d5206e..da2fae99b 100644 --- a/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriterFactory.java +++ b/iceland/core/src/main/java/org/n52/iceland/response/XmlResponseWriterFactory.java @@ -19,7 +19,6 @@ import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlOptions; - import org.n52.iceland.coding.encode.ResponseWriter; import org.n52.iceland.coding.encode.ResponseWriterFactory; import org.n52.iceland.coding.encode.ResponseWriterKey;