com.caucho.portal.generic
Class HttpPortletRequestDispatcher.HttpPortletResponseWrapper

java.lang.Object
  extended by com.caucho.portal.generic.HttpPortletRequestDispatcher.HttpPortletResponseWrapper
All Implemented Interfaces:
HttpServletResponse, ServletResponse
Enclosing class:
HttpPortletRequestDispatcher

protected static class HttpPortletRequestDispatcher.HttpPortletResponseWrapper
extends java.lang.Object
implements HttpServletResponse


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY_TYPE
 
Constructor Summary
HttpPortletRequestDispatcher.HttpPortletResponseWrapper()
           
 
Method Summary
 void addCookie(Cookie cookie)
          Sends a new cookie to the client.
 void addDateHeader(java.lang.String name, long date)
          Adds a header by converting a date to a string.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds a header.
 void addIntHeader(java.lang.String name, int value)
          Adds a header by converting an integer value to a string.
 boolean containsHeader(java.lang.String name)
          Returns true if the output headers include name
 void disable()
          Disables the response
 void enable()
          Enables the response
 java.lang.String encodeRedirectUrl(java.lang.String url)
           
 java.lang.String encodeRedirectURL(java.lang.String url)
          Encodes session information in a URL suitable for sendRedirect()
 java.lang.String encodeUrl(java.lang.String path)
           
 java.lang.String encodeURL(java.lang.String path)
          Encodes session information in a URL.
 void finish()
           
 void flushBuffer()
          Flushes the buffer to the client.
 int getBufferSize()
          Returns the size of the output buffer.
 java.lang.String getCharacterEncoding()
          Returns the character encoding the response is using for output.
 java.lang.String getContentType()
          Returns the content type for the response.
 java.util.Locale getLocale()
          Returns the output locale.
 ServletOutputStream getOutputStream()
          Returns an output stream for writing to the client.
 java.io.PrintWriter getWriter()
          Returns a PrintWriter with the proper character encoding for writing text data to the client.
 boolean isCommitted()
          Returns true if some data has actually been send to the client.
 boolean isDisabled()
          Returns true if the response is disabled
 void reset()
          Resets the output stream, clearing headers and the output buffer.
 void resetBuffer()
          Resets the output stream, clearing headers and the output buffer.
 void sendError(int sc)
          Sends an HTTP error page based on the status code
 void sendError(int sc, java.lang.String msg)
          Sends an HTTP error page based on the status code
 void sendRedirect(java.lang.String location)
          Redirects the client to another page.
 void setBufferSize(int size)
          Sets the output buffer size to size.
 void setCharacterEncoding(java.lang.String enc)
          Sets the character encoding the response is using for output.
 void setContentLength(int len)
          Explicitly sets the length of the result value.
 void setContentType(java.lang.String type)
          Sets the response content type.
 void setDateHeader(java.lang.String name, long date)
          Sets a header by converting a date to a string.
 void setHeader(java.lang.String name, java.lang.String value)
          Sets a header.
 void setIntHeader(java.lang.String name, int value)
          Sets a header by converting an integer value to a string.
 void setLocale(java.util.Locale locale)
          Sets the output locale.
 void setStatus(int sc)
          Sets the HTTP status
 void setStatus(int sc, java.lang.String msg)
           
 void start(HttpServletResponse httpResponse, RenderResponse renderResponse)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpPortletRequestDispatcher.HttpPortletResponseWrapper

public HttpPortletRequestDispatcher.HttpPortletResponseWrapper()
Method Detail

start

public void start(HttpServletResponse httpResponse,
                  RenderResponse renderResponse)

finish

public void finish()

setBufferSize

public void setBufferSize(int size)
Description copied from interface: ServletResponse
Sets the output buffer size to size. The servlet engine may round the size up.

Specified by:
setBufferSize in interface ServletResponse
Parameters:
size - the new output buffer size.

getBufferSize

public int getBufferSize()
Description copied from interface: ServletResponse
Returns the size of the output buffer.

Specified by:
getBufferSize in interface ServletResponse

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Description copied from interface: ServletResponse
Flushes the buffer to the client.

Specified by:
flushBuffer in interface ServletResponse
Throws:
java.io.IOException

resetBuffer

public void resetBuffer()
Description copied from interface: ServletResponse
Resets the output stream, clearing headers and the output buffer. Calling reset() after data has been committed is illegal.

Specified by:
resetBuffer in interface ServletResponse

reset

public void reset()
Description copied from interface: ServletResponse
Resets the output stream, clearing headers and the output buffer. Calling reset() after data has been committed is illegal.

Specified by:
reset in interface ServletResponse

isCommitted

public boolean isCommitted()
Description copied from interface: ServletResponse
Returns true if some data has actually been send to the client. The data will be sent if the buffer overflows or if it's explicitly flushed.

Specified by:
isCommitted in interface ServletResponse

getOutputStream

public ServletOutputStream getOutputStream()
                                    throws java.io.IOException
Description copied from interface: ServletResponse
Returns an output stream for writing to the client. You can use the output stream to write binary data.

Specified by:
getOutputStream in interface ServletResponse
Throws:
java.io.IOException

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Description copied from interface: ServletResponse
Returns the character encoding the response is using for output. If no character encoding is specified, ISO-8859-1 will be used.

Specified by:
getCharacterEncoding in interface ServletResponse

getContentType

public java.lang.String getContentType()
Description copied from interface: ServletResponse
Returns the content type for the response.

Specified by:
getContentType in interface ServletResponse

setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)
Description copied from interface: ServletResponse
Sets the character encoding the response is using for output. If no character encoding is specified, ISO-8859-1 will be used.

Specified by:
setCharacterEncoding in interface ServletResponse

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Description copied from interface: ServletResponse
Returns a PrintWriter with the proper character encoding for writing text data to the client.

Specified by:
getWriter in interface ServletResponse
Throws:
java.io.IOException

encodeURL

public java.lang.String encodeURL(java.lang.String path)
Description copied from interface: HttpServletResponse
Encodes session information in a URL. Calling this will enable sessions for users who have disabled cookies.

Specified by:
encodeURL in interface HttpServletResponse
Parameters:
path - the url to encode
Returns:
a url with session information encoded

encodeUrl

public java.lang.String encodeUrl(java.lang.String path)
Specified by:
encodeUrl in interface HttpServletResponse

getLocale

public java.util.Locale getLocale()
Description copied from interface: ServletResponse
Returns the output locale.

Specified by:
getLocale in interface ServletResponse

encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.String url)
Description copied from interface: HttpServletResponse
Encodes session information in a URL suitable for sendRedirect()

Specified by:
encodeRedirectURL in interface HttpServletResponse
Returns:
a url with session information encoded

encodeRedirectUrl

public java.lang.String encodeRedirectUrl(java.lang.String url)
Specified by:
encodeRedirectUrl in interface HttpServletResponse

setContentType

public void setContentType(java.lang.String type)
Description copied from interface: ServletResponse
Sets the response content type. The content type includes the character encoding. The content type must be set before calling getWriter() so the writer can use the proper character encoding.

To set the output character encoding to ISO-8859-2, use the following:

 response.setContentType("text/html; charset=ISO-8859-2");
 

Specified by:
setContentType in interface ServletResponse
Parameters:
type - the mime type of the output

setContentLength

public void setContentLength(int len)
Description copied from interface: ServletResponse
Explicitly sets the length of the result value. Normally, the servlet engine will handle this.

Specified by:
setContentLength in interface ServletResponse

setLocale

public void setLocale(java.util.Locale locale)
Description copied from interface: ServletResponse
Sets the output locale. The response will set the character encoding based on the locale. For example, setting the "kr" locale will set the character encoding to "EUC_KR".

Specified by:
setLocale in interface ServletResponse

addCookie

public void addCookie(Cookie cookie)
Description copied from interface: HttpServletResponse
Sends a new cookie to the client.

Specified by:
addCookie in interface HttpServletResponse

sendError

public void sendError(int sc)
               throws java.io.IOException
Description copied from interface: HttpServletResponse
Sends an HTTP error page based on the status code

Specified by:
sendError in interface HttpServletResponse
Parameters:
sc - the HTTP status code
Throws:
java.io.IOException

sendError

public void sendError(int sc,
                      java.lang.String msg)
               throws java.io.IOException
Description copied from interface: HttpServletResponse
Sends an HTTP error page based on the status code

Specified by:
sendError in interface HttpServletResponse
Parameters:
sc - the HTTP status code
Throws:
java.io.IOException

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
Description copied from interface: HttpServletResponse
Redirects the client to another page.

Specified by:
sendRedirect in interface HttpServletResponse
Parameters:
location - the location to redirect to.
Throws:
java.io.IOException

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
Description copied from interface: HttpServletResponse
Sets a header by converting a date to a string.

To set the page to expire in 15 seconds use the following:


 long now = System.currentTime();
 response.setDateHeader("Expires", now + 15000);
 

Specified by:
setDateHeader in interface HttpServletResponse
Parameters:
name - name of the header
date - the date in milliseconds since the epoch.

addDateHeader

public void addDateHeader(java.lang.String name,
                          long date)
Description copied from interface: HttpServletResponse
Adds a header by converting a date to a string.

Specified by:
addDateHeader in interface HttpServletResponse
Parameters:
name - name of the header
date - the date in milliseconds since the epoch.

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Description copied from interface: HttpServletResponse
Sets a header. This will override a previous header with the same name.

Specified by:
setHeader in interface HttpServletResponse
Parameters:
name - the header name
value - the header value

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Description copied from interface: HttpServletResponse
Adds a header. If another header with the same name exists, both will be sent to the client.

Specified by:
addHeader in interface HttpServletResponse
Parameters:
name - the header name
value - the header value

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Description copied from interface: HttpServletResponse
Sets a header by converting an integer value to a string.

Specified by:
setIntHeader in interface HttpServletResponse
Parameters:
name - name of the header
value - the value as an integer

addIntHeader

public void addIntHeader(java.lang.String name,
                         int value)
Description copied from interface: HttpServletResponse
Adds a header by converting an integer value to a string.

Specified by:
addIntHeader in interface HttpServletResponse
Parameters:
name - name of the header
value - the value as an integer

containsHeader

public boolean containsHeader(java.lang.String name)
Description copied from interface: HttpServletResponse
Returns true if the output headers include name

Specified by:
containsHeader in interface HttpServletResponse
Parameters:
name - the header name to test

setStatus

public void setStatus(int sc)
Description copied from interface: HttpServletResponse
Sets the HTTP status

Specified by:
setStatus in interface HttpServletResponse
Parameters:
sc - the HTTP status code

setStatus

public void setStatus(int sc,
                      java.lang.String msg)
Specified by:
setStatus in interface HttpServletResponse

disable

public void disable()
Disables the response

Specified by:
disable in interface ServletResponse
Since:
Servlet 3.0

enable

public void enable()
Enables the response

Specified by:
enable in interface ServletResponse
Since:
Servlet 3.0

isDisabled

public boolean isDisabled()
Returns true if the response is disabled

Specified by:
isDisabled in interface ServletResponse
Since:
Servlet 3.0