/** * Writes the given object as response body to the servlet response * <p/> * The content type will be set to {@link HttpConstants#CONTENT_TYPE_JAVA_SERIALIZED_OBJECT} * * @param response servlet response * @param target object to write * @throws IOException is thrown if error writing */ public static void writeObjectToServletResponse(ServletResponse response, Object target) throws IOException { response.setContentType(HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT); writeObjectToStream(response.getOutputStream(), target); }
HttpHelper.writeObjectToStream(bos, obj); answer = new ByteArrayRequestEntity(bos.toByteArray(), HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT); IOHelper.close(bos);