Package org.jolokia.server.core.util
Class IoUtil
java.lang.Object
org.jolokia.server.core.util.IoUtil
- Since:
- 23.01.18
- Author:
- roland
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidstreamResponseAndClose(Writer pWriter, org.json.simple.JSONStreamAware pJson, String callback) Stream a JSON stream to a given writer, potentiall wrap it in a callback for a JSONP response and then flush & close the writer.
-
Method Details
-
streamResponseAndClose
public static void streamResponseAndClose(Writer pWriter, org.json.simple.JSONStreamAware pJson, String callback) throws IOException Stream a JSON stream to a given writer, potentiall wrap it in a callback for a JSONP response and then flush & close the writer. The writer is closed in any case, also when an exception occurs- Parameters:
pWriter- writer to write to. Must be not null.pJson- JSON response to streamcallback- the name of the callback function if JSONP should be used ornullif the answer should be streamed directly- Throws:
IOException- if the streaming fails
-