Change-Id: Ic8f29163442a1476406a1f2b617a4ecaf577ba93
}
}
+ @Override
+ public void setContentLength(int len) {
+ if (response instanceof ResourceResponse) {
+ ((ResourceResponse) response).setContentLength(len);
+ }
+
+ }
+
@Override
public PrintWriter getWriter() throws IOException {
if (response instanceof MimeResponse) {
* @see PortletResponse#addProperty(Cookie)
*/
public void addCookie(Cookie cookie);
+
+ /**
+ * Sets the length of the content body in the response In HTTP servlets,
+ * this method sets the HTTP Content-Length header. For some portlet
+ * responses, this method sets the content-length header, for others this
+ * method does nothing.
+ *
+ * @param len
+ * an integer specifying the length of the content being returned
+ * to the client
+ * @since 7.3.8
+ */
+ public void setContentLength(int len);
}
response.setHeader("Cache-Control", "no-cache");
byte[] b = json.getBytes("UTF-8");
- response.setHeader("Content-Length", String.valueOf(b.length));
+ response.setContentLength(b.length);
OutputStream outputStream = response.getOutputStream();
outputStream.write(b);