Top Description Methods
javax.portlet

public Interface PortletRequestDispatcher

Known Direct Implementers
javax.portlet.filter.PortletRequestDispatcherWrapper

The PortletRequestDispatcher interface defines an object that receives requests from the client and sends them to the specified resources (such as a servlet, HTML file, or JSP file) on the server. The portlet container creates the PortletRequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name.

Method Summary

Modifier and TypeMethod and Description
public void
forward(PortletRequest
a request object that represents the request to the portlet
request
,
PortletResponse
a reponse object that contains the portlet response
response
)

Forwards a portlet request from a portlet to another resource (servlet, JSP file, or HTML file) on the server.

public void
include(RenderRequest
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.
request
,
RenderResponse
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.
response
)

Includes the content of a resource (servlet, JSP page, HTML file) in the response.

public void
include(PortletRequest
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.
request
,
PortletResponse
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.
response
)

Includes the content of a resource (servlet, JSP page, HTML file) in the response.

Method Detail

forwardback to summary
public void forward(PortletRequest request, PortletResponse response) throws PortletException, IOException

Forwards a portlet request from a portlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows the portlet to do preliminary processing of a request and another resource to generate the response.

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.

Parameters
request:PortletRequest

a request object that represents the request to the portlet

response:PortletResponse

a reponse object that contains the portlet response

Exceptions
PortletException:
if the included resource throws a ServletException, or other exceptions that are not Runtime- or IOExceptions.
IOException:
if the included resource throws this exception
IllegalStateException:
if the response was already committed
Since
2.0
includeback to summary
public void include(RenderRequest request, RenderResponse response) throws PortletException, IOException

Includes the content of a resource (servlet, JSP page, HTML file) in the response. In essence, this method enables programmatic server-side includes.

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 include(PortletRequest, PortletResponse) instead of this method.

Parameters
request:RenderRequest

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:RenderResponse

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.

Exceptions
PortletException:
if the included resource throws a ServletException, or other exceptions that are not Runtime- or IOExceptions.
IOException:
if the included resource throws this exception
includeback to summary
public void include(PortletRequest request, PortletResponse response) throws PortletException, IOException

Includes the content of a resource (servlet, JSP page, HTML file) in the response. In essence, this method enables programmatic server-side includes.

The included servlet cannot set or change the response status code or set headers; any attempt to make a change is ignored.

Parameters
request:PortletRequest

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:PortletResponse

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.

Exceptions
PortletException:
if the included resource throws a ServletException, or other exceptions that are not Runtime- or IOExceptions.
IOException:
if the included resource throws this exception
Since
2.0