Overview Package Class Tree Serialized Deprecated Index Help PREV class NEXT class SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
org.apache.jetspeed.portlet
Interface PortletResponse
- All Superinterfaces:
- javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse
- public interface PortletResponse
- extends javax.servlet.http.HttpServletResponse
The PortletResponse interface represents the response sent to the client device.
It is up to the portlet container to enhance, extend, or modify the response as required before it is actually sent to the client device.
- Since:
- 4.1
- See Also:
- PortletRequest
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_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
Method Summary void addCookie(javax.servlet.http.Cookie cookie)
Adds the specified cookie to the response.void addDateHeader(java.lang.String name, long date)
Adds a response header with the given name and date-value.void addHeader(java.lang.String name, java.lang.String value)
Adds a response header with the given name and value.void addIntHeader(java.lang.String name, int value)
Adds a response header with the given name and integer value.boolean containsHeader(java.lang.String name)
Returns a boolean indicating whether the named response header has already been set.PortletURI createReturnURI()
Creates a portlet URI pointing at the referrer of the portlet.PortletURI createURI()
Creates a portlet URI pointing to the current portlet mode.PortletURI createURI(PortletWindow.State state)
Creates a portlet URI pointing to the current portlet mode and given portlet window state.java.lang.String encodeNamespace(java.lang.String aValue)
Maps the given string value into this portlet's namespace.java.lang.String encodeURI(java.lang.String path)
Deprecated. use encodeURL since version 1.1java.lang.String encodeURL(java.lang.String path)
Returns the encoded URI of the resource at the given path.java.lang.String getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response.java.lang.String getCharacterSet()
Deprecated. use getCharacterEncoding since version 1.1java.lang.String getContentType()
Returns the content type that can be used to contribute markup to the portlet response.java.io.PrintWriter getWriter()
Returns the writer object that can be used to contribute markup to the portlet response.void setDateHeader(java.lang.String name, long date)
Sets a response header with the given name and date-value.void setHeader(java.lang.String name, java.lang.String value)
Sets a response header with the given name and value.void setIntHeader(java.lang.String name, int value)
Sets a response header with the given name and integer value.
Methods inherited from interface javax.servlet.http.HttpServletResponse encodeRedirectUrl, encodeRedirectURL, encodeUrl, sendError, sendError, sendRedirect, setStatus, setStatus
Methods inherited from interface javax.servlet.ServletResponse flushBuffer, getBufferSize, getLocale, getOutputStream, isCommitted, reset, resetBuffer, setBufferSize, setContentLength, setContentType, setLocale
Method Detail getWriter
public java.io.PrintWriter getWriter() throws java.io.IOException
- Returns the writer object that can be used to contribute markup to the portlet response.
It is important to note that the markup generated by the portlet is either a full document or just a fragment of the markup. A corresponding setting in the deployment descriptor has to be made.
- Specified by:
- getWriter in interface javax.servlet.ServletResponse
- Returns:
- the print writer
- Throws:
- java.io.IOException - if the I/O operation fails
getContentType
public java.lang.String getContentType()
- Returns the content type that can be used to contribute markup to the portlet response.
- Returns:
- the content type
getCharacterEncoding
public java.lang.String getCharacterEncoding()
- Returns the name of the charset used for the MIME body sent in this response.
If no charset has been assigned, it is implicitly set to
ISO-8859-1 (
Latin-1).
See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt) for more information about character encoding and MIME.
- Specified by:
- getCharacterEncoding in interface javax.servlet.ServletResponse
- Returns:
- a
String specifying the name of the charset, for example,
ISO-8859-1
getCharacterSet
public java.lang.String getCharacterSet()
- Deprecated. use getCharacterEncoding since version 1.1
- Returns the character set that can be used to contribute markup to the portlet response.
- Returns:
- the character set
createURI
public PortletURI createURI()
- Creates a portlet URI pointing to the current portlet mode. The returned URI can be further extended by adding portlet-specific parameters and by attaching an action. Also, the portlet window will stay in the same state as before.
- Returns:
- a portlet URI
createURI
public PortletURI createURI(PortletWindow.State state)
- Creates a portlet URI pointing to the current portlet mode and given portlet window state. The returned URI can be further extended by adding portlet-specific parameters and by attaching an action.
- Parameters:
- state - the portlet window state
- Returns:
- a portlet URI
createReturnURI
public PortletURI createReturnURI()
- Creates a portlet URI pointing at the referrer of the portlet. This is normally the previous screen / URL shown in the browser. The returned URI can be further extended by adding portlet-specific parameters and/or by attaching an action. This method is very useful to return from the EDIT mode, for example.
- Returns:
- a portlet URI
encodeURI
public java.lang.String encodeURI(java.lang.String path)
- Deprecated. use encodeURL since version 1.1
- Returns the encoded URI of the resource at the given path. Encoding may include prefixing, conversion to absolute URL, etc.
To generate unprotected URI's like an image use the direct path inside of you portlet (e.g. /myportlet/myimage.gif). Otherwise, to generate protected URI's like a property file use the path inside of your portlet prefixed with /WEB-INF/ (e.g. /WEB-INF/myportlet/myportlet.jsp)
- Parameters:
- path - the path to the resource
- Returns:
- the resource URI as string
encodeURL
public java.lang.String encodeURL(java.lang.String path)
- Returns the encoded URI of the resource at the given path. Encoding may include prefixing, conversion to absolute URL, etc.
To generate unprotected URI's like an image use the direct path inside of you portlet (e.g. /myportlet/myimage.gif). Otherwise, to generate protected URI's like a property file use the path inside of your portlet prefixed with /WEB-INF/ (e.g. /WEB-INF/myportlet/myportlet.jsp)
- Specified by:
- encodeURL in interface javax.servlet.http.HttpServletResponse
- Parameters:
- path - the path to the resource
- Returns:
- the resource URI as string
encodeNamespace
public java.lang.String encodeNamespace(java.lang.String aValue)
- Maps the given string value into this portlet's namespace. Should be applied to every variable or name used in the output stream. For example, a parameter used in a form, or a function name in javascript.
- Parameters:
- aValue - the name to be mapped
- Returns:
- the mapped name
addCookie
public void addCookie(javax.servlet.http.Cookie cookie)
- Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.
The portlet container encodes the cookie name in the concrete portlet instances' namespace.
- Specified by:
- addCookie in interface javax.servlet.http.HttpServletResponse
- Parameters:
- cookie - the Cookie to return to the client
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener
containsHeader
public boolean containsHeader(java.lang.String name)
- Returns a boolean indicating whether the named response header has already been set.
- Specified by:
- containsHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the header name
- Returns:
true if the named response header has already been set;
false otherwise
setDateHeader
public void setDateHeader(java.lang.String name, long date)
- Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. If the header had already been set, the new value overwrites the previous one. The
containsHeader method can be used to test for the presence of a header before setting its value.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- setDateHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header to set
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- containsHeader(java.lang.String), addDateHeader(java.lang.String, long)
addDateHeader
public void addDateHeader(java.lang.String name, long date)
- Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- addDateHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header to set
- date -
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- setDateHeader(java.lang.String, long)
setHeader
public void setHeader(java.lang.String name, java.lang.String value)
- Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The
containsHeader method can be used to test for the presence of a header before setting its value.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- setHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header
- value - the header value
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- containsHeader(java.lang.String), addHeader(java.lang.String, java.lang.String)
addHeader
public void addHeader(java.lang.String name, java.lang.String value)
- Adds a response header with the given name and value. This method allows response headers to have multiple values.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- addHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header
- value - the additional header value
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- setHeader(java.lang.String, java.lang.String)
setIntHeader
public void setIntHeader(java.lang.String name, int value)
- Sets a response header with the given name and integer value. If the header had already been set, the new value overwrites the previous one. The
containsHeader method can be used to test for the presence of a header before setting its value.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- setIntHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header
- value - the assigned integer value
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- containsHeader(java.lang.String), addIntHeader(java.lang.String, int)
addIntHeader
public void addIntHeader(java.lang.String name, int value)
- Adds a response header with the given name and integer value. This method allows response headers to have multiple values.
We need to think about all header methods and how to solve nameclashes, etc.
- Specified by:
- addIntHeader in interface javax.servlet.http.HttpServletResponse
- Parameters:
- name - the name of the header
- value - the assigned integer value
- Throws:
- java.lang.IllegalStateException - if the portlet tries to access this function outside of the beginPage method of the PortletPageListener or if the portlet tries to set an portal-wide header
- See Also:
- setIntHeader(java.lang.String, int)
Overview Package Class Tree Serialized Deprecated Index Help PREV class NEXT class SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.