org.apache.pluto.internal.impl
Class ResourceResponseImpl

java.lang.Object
  extended by javax.servlet.ServletResponseWrapper
      extended by javax.servlet.http.HttpServletResponseWrapper
          extended by org.apache.pluto.internal.impl.PortletResponseImpl
              extended by org.apache.pluto.internal.impl.MimeResponseImpl
                  extended by org.apache.pluto.internal.impl.ResourceResponseImpl
All Implemented Interfaces:
MimeResponse, PortletResponse, ResourceResponse, javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse, InternalPortletResponse, InternalResourceResponse

public class ResourceResponseImpl
extends MimeResponseImpl
implements ResourceResponse, InternalResourceResponse


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_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Constructor Summary
ResourceResponseImpl(PortletContainer container, InternalPortletWindow internalPortletWindow, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
           
 
Method Summary
 int getBufferSize()
          Returns the actual buffer size used for the response.
 java.lang.String getCacheability()
          Returns the cache level of this resource request.
 java.lang.String getContentType()
          Returns the MIME type that can be used to contribute markup to the render response.
 void setCharacterEncoding(java.lang.String arg0)
          Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.
 void setContentLength(int arg0)
          Sets the length of the content body in the response.
 void setContentType(java.lang.String contentType)
          Sets the MIME type for the render response.
 void setLocale(java.util.Locale arg0)
          Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate.
 
Methods inherited from class org.apache.pluto.internal.impl.MimeResponseImpl
addDateHeader, addHeader, addIntHeader, flushBuffer, getCacheControl, getCharacterEncoding, getLocale, getOutputStream, getPortletOutputStream, getWriter, isCommitted, isValidContentType, reset, resetBuffer, sendRedirect, setBufferSize, setDateHeader, setHeader, setIntHeader, setStatus, setStatus
 
Methods inherited from class org.apache.pluto.internal.impl.PortletResponseImpl
addCookie, addProperty, addProperty, addProperty, addProperty, containsHeader, createActionURL, createElement, createRenderURL, createResourceURL, createResourceURL, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getContainer, getHttpServletRequest, getHttpServletResponse, getInternalPortletWindow, getNamespace, isForwarded, isIncluded, sendError, sendError, setForwarded, setIncluded, setProperty
 
Methods inherited from class javax.servlet.ServletResponseWrapper
getResponse, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.pluto.internal.InternalPortletResponse
getInternalPortletWindow, isForwarded, isIncluded, setForwarded, setIncluded
 

Constructor Detail

ResourceResponseImpl

public ResourceResponseImpl(PortletContainer container,
                            InternalPortletWindow internalPortletWindow,
                            javax.servlet.http.HttpServletRequest servletRequest,
                            javax.servlet.http.HttpServletResponse servletResponse)
Method Detail

setCharacterEncoding

public void setCharacterEncoding(java.lang.String arg0)
Description copied from interface: ResourceResponse
Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. If the character encoding has already been set by either the portlet container, setContentType(java.lang.String) or setLocale(java.util.Locale), this method overrides it. Calling setContentType(java.lang.String) with the String of text/html and calling this method with the String of UTF-8 is equivalent with calling setContentType with the String of text/html; charset=UTF-8.

This method can be called repeatedly to change the character encoding. This method has no effect if it is called after getWriter has been called or after the response has been committed.

Specified by:
setCharacterEncoding in interface ResourceResponse
Specified by:
setCharacterEncoding in interface javax.servlet.ServletResponse
Overrides:
setCharacterEncoding in class javax.servlet.ServletResponseWrapper
Parameters:
arg0 - a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)

setContentLength

public void setContentLength(int arg0)
Description copied from interface: ResourceResponse
Sets the length of the content body in the response.

Specified by:
setContentLength in interface ResourceResponse
Specified by:
setContentLength in interface javax.servlet.ServletResponse
Overrides:
setContentLength in class javax.servlet.ServletResponseWrapper
Parameters:
arg0 - an integer specifying the length of the content being returned

setLocale

public void setLocale(java.util.Locale arg0)
Description copied from interface: ResourceResponse
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. This method should be called before a call to getWriter(). By default, the response locale is the default locale provided by the portlet container.

Specified by:
setLocale in interface ResourceResponse
Specified by:
setLocale in interface javax.servlet.ServletResponse
Overrides:
setLocale in class javax.servlet.ServletResponseWrapper
Parameters:
arg0 - the new locale of the response

getBufferSize

public int getBufferSize()
Description copied from interface: MimeResponse
Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.

Specified by:
getBufferSize in interface MimeResponse
Specified by:
getBufferSize in interface javax.servlet.ServletResponse
Overrides:
getBufferSize in class javax.servlet.ServletResponseWrapper
Returns:
the actual buffer size used
See Also:
MimeResponse.setBufferSize(int), MimeResponse.flushBuffer(), MimeResponse.isCommitted(), MimeResponse.reset()

setContentType

public void setContentType(java.lang.String contentType)
                    throws java.lang.IllegalArgumentException
Description copied from interface: MimeResponse
Sets the MIME type for the render response. The portlet must set the content type before calling MimeResponse.getWriter() or MimeResponse.getPortletOutputStream().

Calling setContentType after getWriter or getOutputStream does not change the content type.

The portlet container will ignore any character encoding specified as part of the content type for render calls.

Specified by:
setContentType in interface MimeResponse
Specified by:
setContentType in interface javax.servlet.ServletResponse
Overrides:
setContentType in class javax.servlet.ServletResponseWrapper
Parameters:
contentType - the content MIME type
Throws:
java.lang.IllegalArgumentException - for render calls if the given type is not in the list returned by PortletRequest.getResponseContentTypes
See Also:
PortletRequest.getResponseContentTypes(), MimeResponse.getContentType()

getContentType

public java.lang.String getContentType()
Description copied from interface: MimeResponse
Returns the MIME type that can be used to contribute markup to the render response.

If no content type was set previously using the MimeResponse.setContentType(java.lang.String) method this method returns null.

Specified by:
getContentType in interface MimeResponse
Specified by:
getContentType in interface javax.servlet.ServletResponse
Overrides:
getContentType in class javax.servlet.ServletResponseWrapper
Returns:
the MIME type of the response, or null if no content type is set
See Also:
MimeResponse.setContentType(java.lang.String)

getCacheability

public java.lang.String getCacheability()
Description copied from interface: ResourceResponse
Returns the cache level of this resource request.

Possible return values are: ResourceURL.FULL, ResourceURL.PORTLET or ResourceURL.PAGE.

Specified by:
getCacheability in interface ResourceResponse
Returns:
the cache level of this resource request.


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.