public class PortletRequestDispatcherWrapper extends Object implements PortletRequestDispatcher
PortletRequestDispatcherWrapper
provides a convenient
implementation of the PortletRequestDispatcher
interface
that can be subclassed by developers.
This class implements the Wrapper or Decorator pattern.
Methods default to calling through to the wrapped request object.
Modifier and Type | Field and Description |
---|---|
protected PortletRequestDispatcher |
wrapped |
Constructor and Description |
---|
PortletRequestDispatcherWrapper(PortletRequestDispatcher wrapped) |
Modifier and Type | Method and Description |
---|---|
void |
forward(PortletRequest request,
PortletResponse response)
Forwards a portlet request from a portlet to another resource (servlet, JSP file, or HTML file)
on the server.
|
PortletRequestDispatcher |
getWrapped()
Gets the wrapped object.
|
void |
include(PortletRequest request,
PortletResponse response)
Includes the content of a resource (servlet, JSP page, HTML file) in the
response.
|
void |
include(RenderRequest request,
RenderResponse response)
Includes the content of a resource (servlet, JSP page, HTML file) in the
response.
|
void |
setWrapped(PortletRequestDispatcher wrapped)
Sets the wrapped object.
|
protected PortletRequestDispatcher wrapped
public PortletRequestDispatcherWrapper(PortletRequestDispatcher wrapped)
public PortletRequestDispatcher getWrapped()
public void setWrapped(PortletRequestDispatcher wrapped)
wrapped
- the wrapped object to set.IllegalArgumentException
- if the request is null.public void include(RenderRequest request, RenderResponse response) throws PortletException, IOException
PortletRequestDispatcher
The included servlet cannot set or change the response status code or set headers; any attempt to make a change is ignored.
This method is kept in order to provide backward compatibility with
version 1.0. Please use PortletRequestDispatcher.include(PortletRequest, PortletResponse)
instead
of this method.
include
in interface PortletRequestDispatcher
request
- a RenderRequest
object that contains the client
request. Must be either the render request passed to the
portlet in render
or a wrapped version of this
render request.response
- a RenderResponse
object that contains the render
response. Must be either the render response passed to the
portlet in render
or a wrapped version of this
render response.PortletException
- if the included resource throws a ServletException, or
other exceptions that are not Runtime- or IOExceptions.IOException
- if the included resource throws this exceptionpublic void include(PortletRequest request, PortletResponse response) throws PortletException, IOException
PortletRequestDispatcher
The included servlet cannot set or change the response status code or set headers; any attempt to make a change is ignored.
include
in interface PortletRequestDispatcher
request
- a PortletRequest
object that contains the portlet
request. Must be either the original request passed to the
portlet or a wrapped version of this request.response
- a PortletResponse
object that contains the portlet
response. Must be either the portlet response passed to the
portlet or a wrapped version of this response.PortletException
- if the included resource throws a ServletException, or
other exceptions that are not Runtime- or IOExceptions.IOException
- if the included resource throws this exceptionpublic void forward(PortletRequest request, PortletResponse response) throws PortletException, IOException
PortletRequestDispatcher
The forward
method should be called before the response has been
committed to the portlet container (before response body output has been flushed).
If the response already has been committed, this method throws an
IllegalStateException
. Uncommitted output in the response buffer
is automatically cleared before the forward.
The request and response parameters must be either the same objects as were passed to the calling portlet or be wrapped versions of these.
forward
in interface PortletRequestDispatcher
request
- a request object that represents the request to the
portletresponse
- a reponse object that contains the portlet responsePortletException
- if the included resource throws a ServletException, or
other exceptions that are not Runtime- or IOExceptions.IOException
- if the included resource throws this exceptionJava Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.