org.apache.pluto.internal.impl
Class PortletResponseImpl

java.lang.Object
  extended by javax.servlet.ServletResponseWrapper
      extended by javax.servlet.http.HttpServletResponseWrapper
          extended by org.apache.pluto.internal.impl.PortletResponseImpl
All Implemented Interfaces:
PortletResponse, javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse, InternalPortletResponse
Direct Known Subclasses:
MimeResponseImpl, StateAwareResponseImpl

public abstract class PortletResponseImpl
extends javax.servlet.http.HttpServletResponseWrapper
implements PortletResponse, InternalPortletResponse

Abstract javax.portlet.PortletResponse implementation. This class also implements InternalPortletResponse.


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
PortletResponseImpl(PortletContainer container, InternalPortletWindow internalPortletWindow, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
           
 
Method Summary
 void addCookie(javax.servlet.http.Cookie arg0)
           
 void addProperty(javax.servlet.http.Cookie cookie)
           
 void addProperty(java.lang.String key, org.w3c.dom.Element element)
          Adds an XML DOM element property to the response.
 void addProperty(java.lang.String name, java.lang.String value)
          Adds a String property to an existing key to be returned to the portal.
 void addProperty(java.lang.String name, java.lang.String value, int scope)
           
 boolean containsHeader(java.lang.String arg0)
           
 PortletURL createActionURL()
           
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Creates an element of the type specified to be used in the addProperty method.
 PortletURL createRenderURL()
           
 ResourceURL createResourceURL()
           
 ResourceURL createResourceURL(boolean markupContainsPortletURLs)
           
 java.lang.String encodeRedirectUrl(java.lang.String arg0)
           
 java.lang.String encodeRedirectURL(java.lang.String arg0)
           
 java.lang.String encodeUrl(java.lang.String url)
           
 java.lang.String encodeURL(java.lang.String path)
          Returns the encoded URL of the resource, like servlets, JSPs, images and other static files, at the given path.
protected  PortletContainer getContainer()
          Returns the portlet container.
protected  javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Returns the nested HttpServletRequest instance.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Returns the nested HttpServletResponse instance.
 InternalPortletWindow getInternalPortletWindow()
           
 java.lang.String getNamespace()
          The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.
 javax.servlet.ServletOutputStream getOutputStream()
          TODO: javadoc about why we are using a wrapped writer here.
 java.io.PrintWriter getWriter()
           
 boolean isForwarded()
           
 boolean isIncluded()
          Returns true if a jsp or servlet is included.
 void sendError(int arg0)
           
 void sendError(int arg0, java.lang.String arg1)
           
 void setForwarded(boolean forwared)
           
 void setIncluded(boolean included)
          Is set true when a jsp, servlet is included.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets a String property to be returned to the portal.
 
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper
addDateHeader, addHeader, addIntHeader, sendRedirect, setDateHeader, setHeader, setIntHeader, setStatus, setStatus
 
Methods inherited from class javax.servlet.ServletResponseWrapper
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletResponse
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale
 

Constructor Detail

PortletResponseImpl

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

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: PortletResponse
Adds a String property to an existing key to be returned to the portal. If there are no property values already associated with the key, a new key is created.

This method allows response properties to have multiple values.

Properties can be used by portlets to provide vendor specific information to the portal.

Specified by:
addProperty in interface PortletResponse
Parameters:
name - the key of the property to be returned to the portal
value - the value of the property to be returned to the portal

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value,
                        int scope)

addProperty

public void addProperty(java.lang.String key,
                        org.w3c.dom.Element element)
Description copied from interface: PortletResponse
Adds an XML DOM element property to the response.

If a DOM element with the provided key already exists the provided element will be stored in addition to the existing element under the same key.

If the element is null the key is removed from the response.

Properties can be used by portlets to provide vendor specific information to the portal.

Specified by:
addProperty in interface PortletResponse
Parameters:
key - the key of the property to be returned to the portal
element - the XML DOM element to be added to the response

addProperty

public void addProperty(javax.servlet.http.Cookie cookie)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: PortletResponse
Sets a String property to be returned to the portal.

Properties can be used by portlets to provide vendor specific information to the portal.

This method resets all properties previously added with the same key.

Specified by:
setProperty in interface PortletResponse
Parameters:
name - the key of the property to be returned to the portal
value - the value of the property to be returned to the portal

encodeURL

public java.lang.String encodeURL(java.lang.String path)
Description copied from interface: PortletResponse
Returns the encoded URL of the resource, like servlets, JSPs, images and other static files, at the given path.

Portlets should encode all resource URLs pointing to resources in the portlet application via this method in order to ensure that they get served via the portal application.

Some portal/portlet-container implementation may require those URLs to contain implementation specific data encoded in it. Because of that, portlets should use this method to create such URLs.

The encodeURL method may include the session ID and other portal/portlet-container specific information into the URL. If encoding is not needed, it returns the URL unchanged.

Specified by:
encodeURL in interface PortletResponse
Specified by:
encodeURL in interface javax.servlet.http.HttpServletResponse
Overrides:
encodeURL in class javax.servlet.http.HttpServletResponseWrapper
Parameters:
path - the URI path to the resource. This must be either an absolute URL (e.g. http://my.co/myportal/mywebap/myfolder/myresource.gif) or a full path URI (e.g. /myportal/mywebap/myfolder/myresource.gif).
Returns:
the encoded resource URL as string

getInternalPortletWindow

public InternalPortletWindow getInternalPortletWindow()
Specified by:
getInternalPortletWindow in interface InternalPortletResponse

getContainer

protected PortletContainer getContainer()
Returns the portlet container.

Returns:
the portlet container.

getHttpServletRequest

protected javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns the nested HttpServletRequest instance.

Returns:
the nested HttpServletRequest instance.

getHttpServletResponse

public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Returns the nested HttpServletResponse instance.

Returns:
the nested HttpServletResponse instance.

encodeUrl

public java.lang.String encodeUrl(java.lang.String url)
Specified by:
encodeUrl in interface javax.servlet.http.HttpServletResponse
Overrides:
encodeUrl in class javax.servlet.http.HttpServletResponseWrapper

getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
                                                  throws java.lang.IllegalStateException,
                                                         java.io.IOException
TODO: javadoc about why we are using a wrapped writer here.

Specified by:
getOutputStream in interface javax.servlet.ServletResponse
Overrides:
getOutputStream in class javax.servlet.ServletResponseWrapper
Throws:
java.lang.IllegalStateException
java.io.IOException
See Also:
PrintWriterServletOutputStream

getWriter

public java.io.PrintWriter getWriter()
                              throws java.lang.IllegalStateException,
                                     java.io.IOException
Specified by:
getWriter in interface javax.servlet.ServletResponse
Overrides:
getWriter in class javax.servlet.ServletResponseWrapper
Throws:
java.lang.IllegalStateException
java.io.IOException

createRenderURL

public PortletURL createRenderURL()

createActionURL

public PortletURL createActionURL()

createResourceURL

public ResourceURL createResourceURL()

createResourceURL

public ResourceURL createResourceURL(boolean markupContainsPortletURLs)

getNamespace

public java.lang.String getNamespace()
Description copied from interface: PortletResponse
The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.

The namespace value must be constant for the lifetime of the portlet window.

Specified by:
getNamespace in interface PortletResponse
Returns:
the namespace

addCookie

public void addCookie(javax.servlet.http.Cookie arg0)
Specified by:
addCookie in interface javax.servlet.http.HttpServletResponse
Overrides:
addCookie in class javax.servlet.http.HttpServletResponseWrapper

containsHeader

public boolean containsHeader(java.lang.String arg0)
Specified by:
containsHeader in interface javax.servlet.http.HttpServletResponse
Overrides:
containsHeader in class javax.servlet.http.HttpServletResponseWrapper

encodeRedirectUrl

public java.lang.String encodeRedirectUrl(java.lang.String arg0)
Specified by:
encodeRedirectUrl in interface javax.servlet.http.HttpServletResponse
Overrides:
encodeRedirectUrl in class javax.servlet.http.HttpServletResponseWrapper

encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.String arg0)
Specified by:
encodeRedirectURL in interface javax.servlet.http.HttpServletResponse
Overrides:
encodeRedirectURL in class javax.servlet.http.HttpServletResponseWrapper

sendError

public void sendError(int arg0)
               throws java.io.IOException
Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Overrides:
sendError in class javax.servlet.http.HttpServletResponseWrapper
Throws:
java.io.IOException

sendError

public void sendError(int arg0,
                      java.lang.String arg1)
               throws java.io.IOException
Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Overrides:
sendError in class javax.servlet.http.HttpServletResponseWrapper
Throws:
java.io.IOException

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Description copied from interface: PortletResponse
Creates an element of the type specified to be used in the addProperty method.

Specified by:
createElement in interface PortletResponse
Parameters:
tagName - name of the element type to instantiate
Returns:
A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

setIncluded

public void setIncluded(boolean included)
Description copied from interface: InternalPortletResponse
Is set true when a jsp, servlet is included.

Specified by:
setIncluded in interface InternalPortletResponse
Parameters:
included - true when included

isIncluded

public boolean isIncluded()
Description copied from interface: InternalPortletResponse
Returns true if a jsp or servlet is included.

Specified by:
isIncluded in interface InternalPortletResponse
Returns:
true if a jsp or servlet is included.

isForwarded

public boolean isForwarded()
Specified by:
isForwarded in interface InternalPortletResponse

setForwarded

public void setForwarded(boolean forwared)
Specified by:
setForwarded in interface InternalPortletResponse


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