Closed kronar closed 11 years ago
Take a look at this example ( http://schipplock.de/projects/2011/005_AutoScanner/src/src/com/schipplock/autoscanner/AutoScanner.java ). Helped me to write raw data.
I've located the problem. There's a problem in the HTTP filter where it doesn't understand that the outputstream has been consumed and tries to use it. A solution could be to wrap the Outputstream and flag when close has been called. What do you guys think?
Fixed by isCommited check in MatcherFilter.
Following code
@Override public Object handle(Request request, Response response) { byte[] result = createChartImage(findByBMetric); response.status(200); response.type(JPG_CONTENT_TYPE); final HttpServletResponse rawResponse = response.raw(); rawResponse.setContentType("image/jpeg"); rawResponse.setContentLength(result.length); final ServletOutputStream outputStream = rawResponse .getOutputStream();
}
works but produces warning in console
2012-05-03 14:00:49,323 WARN - log - /stabilitygraph?metric=ru.selenium.express.web.CheckMessaging.clearRecentMessagesUser2: java.io.IOException: Closed
Possibly I writing binary content in a wrong way, please show me the correct one.