public void sendError(int errorCode, String errorMessage) throws IOException { failIfCommitted(); committed = true; closed = true; hasError = true; this.errorCode = errorCode; this.errorMessage = errorMessage; }
public boolean containsHeader(String name) { // Note: Portlet Spec 2.0 demands this to always return false... return isMimeResponse && getHeaderList(name, false) != null; }
public void reset() { resetBuffer(); // fails if committed headers = null; cookies = null; hasStatus = false; contentLength = -1; if (printWriter == null) { contentType = null; characterEncoding = null; locale = null; } }
addResponseCookie(cookie); if (locale != null) { try { setResponseLocale(locale); } catch (UnsupportedOperationException usoe) { if (characterEncoding != null) { if (setContentTypeAfterEncoding) { setResponseCharacterEncoding(characterEncoding); setResponseContentType(contentType); } else { setResponseContentType(contentType); setResponseCharacterEncoding(characterEncoding); setResponseContentType(contentType); setResponseCharacterEncoding(characterEncoding); for (Map.Entry<String, List<String>> entry : headers.entrySet()) { for (String value : entry.getValue()) { addResponseHeader(entry.getKey(), value); setResponseStatus(statusCode); setResponseContentLength(contentLength); } catch (UnsupportedOperationException usoe) { addResponseHeadElement(entry.getValue(), entry.getKey());
public void addIntHeader(String name, int value) { addHeader(name, Integer.toString(value)); }
public void sendError(int errorCode) throws IOException { sendError(errorCode, null); }
public void addDateHeader(String name, long date) { addHeader(name, Long.toString(date)); }
public void sendRedirect(String redirectLocation) throws IOException { if (isActionResponse || isMimeResponse) { failIfCommitted(); closed = true; committed = true; if (isMimeResponse) { } this.redirectLocation = redirectLocation; } }
public void addHeader(String name, String value) { if (isMimeResponse && !committed) { getHeaderList(name, true).add(value); } }
public void setStatus(int statusCode) { if (!committed) { if (response instanceof HstResponse) { ((HstResponse) response).setStatus(statusCode); } else { this.statusCode = statusCode; hasStatus = true; resetBuffer(); } } }
public void forward(String pathInfo) throws IOException { if (isRenderResponse) { if (response instanceof HstResponse) { ((HstResponse) response).forward(pathInfo); } else { failIfCommitted(); closed = true; committed = true; forwardPathInfo = pathInfo; } } }
public void setHeader(String name, String value) { if (isMimeResponse && !committed) { List<String> headerList = getHeaderList(name, true); headerList.clear(); headerList.add(value); } }
public void resetBuffer() { failIfCommitted(); if (outputStream != null) { try { outputStream.flush(); } catch (Exception e) { } byteOutputBuffer.reset(); } else if (printWriter != null) { printWriter.flush(); charOutputBuffer.reset(); } }