Top Description Constructors Methods
javax.portlet.filter

public Class ResourceRequestWrapper

extends ClientDataRequestWrapper
implements ResourceRequest
Class Inheritance
All Implemented Interfaces
javax.portlet.ResourceRequest, javax.portlet.ClientDataRequest, javax.portlet.PortletRequest, javax.portlet.RenderState
Imports
java.util.Map, javax.portlet.PortletAsyncContext, .ResourceParameters, .ResourceRequest, .ResourceResponse, javax.servlet.DispatcherType

The ResourceRequestWrapper provides a convenient implementation of the ResourceRequest 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.
Since
2.0
See Also
ResourceRequest

Constructor Summary

AccessConstructor and Description
public
ResourceRequestWrapper(ResourceRequest
the resource request to wrap
request
)

Creates an ResourceRequest adaptor wrapping the given request object.

Method Summary

Modifier and TypeMethod and Description
public String
getCacheability()

Implements javax.portlet.ResourceRequest.getCacheability.

Returns the cache level of this resource request.
public DispatcherType
getDispatcherType()

Implements javax.portlet.ResourceRequest.getDispatcherType.

Gets the dispatcher type of this request.
public String
getETag()

Implements javax.portlet.ResourceRequest.getETag.

Returns the validation tag if the portlet container has a cached response for this validation tag, or null if no cached response exists.
public PortletAsyncContext
getPortletAsyncContext()

Implements javax.portlet.ResourceRequest.getPortletAsyncContext.

Gets the AsyncContext that was created or reinitialized by the most recent invocation of startAsync() or startAsync(ResourceRequest,ResourceResponse) on this request.
public Map<String, String[]>
getPrivateRenderParameterMap()

Implements javax.portlet.ResourceRequest.getPrivateRenderParameterMap.

Deprecated
Returns a Map of the private render parameters of this request.
public ResourceRequest

Returns:

the wrapped request
getRequest
()

Overrides javax.portlet.filter.ClientDataRequestWrapper.getRequest.

Return the wrapped request object.
public String
getResourceID()

Implements javax.portlet.ResourceRequest.getResourceID.

Returns the resource ID set on the ResourceURL or null if no resource ID was set on the URL.
public ResourceParameters
getResourceParameters()

Implements javax.portlet.ResourceRequest.getResourceParameters.

Gets the resource parameters set for this request.
public boolean
isAsyncStarted()

Implements javax.portlet.ResourceRequest.isAsyncStarted.

Checks if this request has been put into asynchronous mode.
public boolean
isAsyncSupported()

Implements javax.portlet.ResourceRequest.isAsyncSupported.

Checks if this request supports asynchronous operation.
public void
setRequest(ResourceRequest
the request to set
request
)

Sets the request object being wrapped.

public PortletAsyncContext
startPortletAsync()

Implements javax.portlet.ResourceRequest.startPortletAsync.

Puts this request into asynchronous mode and initializes the AsyncContext object.
public PortletAsyncContext
startPortletAsync(ResourceRequest request, ResourceResponse response)

Implements javax.portlet.ResourceRequest.startPortletAsync.

Puts this request into asynchronous mode and initializes the AsyncContext object.
Inherited from javax.portlet.filter.ClientDataRequestWrapper:
getCharacterEncodinggetContentLengthgetContentLengthLonggetContentTypegetMethodgetPartgetPartsgetPortletInputStreamgetReadersetCharacterEncodingsetRequest

Constructor Detail

ResourceRequestWrapperback to summary
public ResourceRequestWrapper(ResourceRequest request)

Creates an ResourceRequest adaptor wrapping the given request object.

Parameters
request:ResourceRequest

the resource request to wrap

Exceptions
IllegalArgumentException:
if the request is null

Method Detail

getCacheabilityback to summary
public String getCacheability()

Implements javax.portlet.ResourceRequest.getCacheability.

Doc from javax.portlet.ResourceRequest.getCacheability.

Returns the cache level of this resource request.

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

Returns:String

the cache level of this resource request.

Annotations
@Override
getDispatcherTypeback to summary
public DispatcherType getDispatcherType()

Implements javax.portlet.ResourceRequest.getDispatcherType.

Doc from javax.portlet.ResourceRequest.getDispatcherType.

Gets the dispatcher type of this request.

The initial dispatcher type of a request is defined as DispatcherType.REQUEST. The dispatcher type of a request dispatched via a RequestDispatcher is given as DispatcherType.FORWARD or DispatcherType.INCLUDE, while the dispatcher type of an asynchronous request dispatched via one of the AsyncContext#dispatch methods is given as DispatcherType.ASYNC.

Returns:DispatcherType

the dispatcher type of this request

Annotations
@Override
getETagback to summary
public String getETag()

Implements javax.portlet.ResourceRequest.getETag.

Doc from javax.portlet.ResourceRequest.getETag.

Returns the validation tag if the portlet container has a cached response for this validation tag, or null if no cached response exists.

This call returns the same value as ResourceRequest.getProperty(ResourceRequest.ETAG).

Returns:String

the validation tag if the portlet container has a cached response for this validation tag, or null if no cached response exists.

Annotations
@Override
getPortletAsyncContextback to summary
public PortletAsyncContext getPortletAsyncContext()

Implements javax.portlet.ResourceRequest.getPortletAsyncContext.

Doc from javax.portlet.ResourceRequest.getPortletAsyncContext.

Gets the AsyncContext that was created or reinitialized by the most recent invocation of startAsync() or startAsync(ResourceRequest,ResourceResponse) on this request.
Returns:PortletAsyncContext

the AsyncContext (re)initialized by the most recent startAsync method invocation

Annotations
@Override
getPrivateRenderParameterMapback to summary
public Map<String, String[]> getPrivateRenderParameterMap()

Implements javax.portlet.ResourceRequest.getPrivateRenderParameterMap.

Doc from javax.portlet.ResourceRequest.getPrivateRenderParameterMap.

Deprecated

Returns a Map of the private render parameters of this request. Private parameters are not shared with other portlets or components. The returned parameters are "x-www-form-urlencoded" decoded.

The parameters returned do not include the resource parameters that the portlet may have set on the resource URL triggering this serveResource call.

The values in the returned Map are from type String array (String[]).

If no private parameters exist this method returns an empty Map.

Returns:Map<String, String[]>

an immutable Map containing private parameter names as keys and private parameter values as map values, or an empty Map if no private parameters exist. The keys in the parameter map are of type String. The values in the parameter map are of type String array (String[]).

Annotations
@Deprecated
@Override
getRequestback to summary
public ResourceRequest getRequest()

Overrides javax.portlet.filter.ClientDataRequestWrapper.getRequest.

Return the wrapped request object.

Returns:ResourceRequest

the wrapped request

getResourceIDback to summary
public String getResourceID()

Implements javax.portlet.ResourceRequest.getResourceID.

Doc from javax.portlet.ResourceRequest.getResourceID.

Returns the resource ID set on the ResourceURL or null if no resource ID was set on the URL.

Returns:String

the resource ID set on the ResourceURL,or null if no resource ID was set on the URL.

Annotations
@Override
getResourceParametersback to summary
public ResourceParameters getResourceParameters()

Implements javax.portlet.ResourceRequest.getResourceParameters.

Doc from javax.portlet.ResourceRequest.getResourceParameters.

Gets the resource parameters set for this request.

Resource parameters are additional portlet parameters added to the URL triggering the request that extend the state information provided by the render parameters.

PortletParameters provides a description of the parameter concept.

Returns:ResourceParameters

an immutable ResourceParameters object representing the resource parameters

Annotations
@Override
isAsyncStartedback to summary
public boolean isAsyncStarted()

Implements javax.portlet.ResourceRequest.isAsyncStarted.

Doc from javax.portlet.ResourceRequest.isAsyncStarted.

Checks if this request has been put into asynchronous mode.

A ResourceRequest is put into asynchronous mode by calling startAsync() or startAsync(ResourceRequest,ResourceResponse) on it.

This method returns false if this request was put into asynchronous mode, but has since been dispatched using one of the AsyncContext#dispatch methods or released from asynchronous mode via a call to AsyncContext#complete.

Returns:boolean

true if asynchronous mode has been started

Annotations
@Override
isAsyncSupportedback to summary
public boolean isAsyncSupported()

Implements javax.portlet.ResourceRequest.isAsyncSupported.

Doc from javax.portlet.ResourceRequest.isAsyncSupported.

Checks if this request supports asynchronous operation.

Asynchronous operation is disabled for this request if this request is within the scope of a filter or servlet that has not been annotated or flagged in the portlet configuration as being able to support asynchronous handling.

Returns:boolean

true if this request supports asynchronous operation

Annotations
@Override
setRequestback to summary
public void setRequest(ResourceRequest request)

Sets the request object being wrapped.

Parameters
request:ResourceRequest

the request to set

Exceptions
IllegalArgumentException:
if the request is null.
startPortletAsyncback to summary
public PortletAsyncContext startPortletAsync() throws IllegalStateException

Implements javax.portlet.ResourceRequest.startPortletAsync.

Doc from javax.portlet.ResourceRequest.startPortletAsync.

Puts this request into asynchronous mode and initializes the AsyncContext object.

Calling this method will cause committal of the associated response to be delayed until AsyncContext#complete is called on the returned AsyncContext, or the asynchronous operation has timed out.

This method clears the list of AsyncListener instances (if any) that were registered with the AsyncContext returned by the previous call to one of the startAsync methods, after calling each AsyncListener at its onStartAsync method.

Subsequent invocations of this method, or its overloaded variant, will return the same AsyncContext instance, reinitialized as appropriate.

The AsyncContext object can be used as described by the servlet specification. The ServletRequest and ServletResponse objects obtained from the AsyncContext will provide functionality appropriate for the portlet environment.

The original ResourceRequest and ResourceResponse objects will be made available as request attributes on the code>ServletRequest object obtained from the AsyncContext under the names javax.portlet.request and javax.portlet.response, respectively. The PortletConfig object will be made available on the ServletRequest under the name javax.portlet.config.

The AsyncContext#dispatch() method will cause the portlet resource method to be invoked with the ResourceRequest and ResourceResponse objects available as attributes on the ServletRequest object obtained from the AsyncContext. In this case, the ResourceRequest#isAsyncStarted() method will return false and the ResourceRequest#getDispatcherType() method will return DispatcherType#ASYNC.

A portlet ResourceFilter that allocates resources and attaches them to the ResourceRequest or that wraps the ResourceRequest or ResourceResponse should not release resources in the outbound direction if asynchronous mode has been started. A portlet ResourceFilter can use the values provided by the ResourceRequest#isAsyncStarted() and the ResourceRequest#getDispatcherType() methods to determine when to allocate and release resources.

Returns:PortletAsyncContext

the (re)initialized AsyncContext

Annotations
@Override
Exceptions
IllegalStateException:
if this request is within the scope of a filter or servlet that does not support asynchronous operations (that is, isAsyncSupported() returns false), or if this method is called again without any asynchronous dispatch (resulting from one of the PortletAsyncContext#dispatch methods), is called outside the scope of any such dispatch, or is called again within the scope of the same dispatch, or if the response has already been closed
startPortletAsyncback to summary
public PortletAsyncContext startPortletAsync(ResourceRequest request, ResourceResponse response) throws IllegalStateException

Implements javax.portlet.ResourceRequest.startPortletAsync.

Doc from javax.portlet.ResourceRequest.startPortletAsync.

Puts this request into asynchronous mode and initializes the AsyncContext object.

Calling this method will cause committal of the associated response to be delayed until AsyncContext#complete is called on the returned AsyncContext, or the asynchronous operation has timed out.

This method clears the list of AsyncListener instances (if any) that were registered with the AsyncContext returned by the previous call to one of the startAsync methods, after calling each AsyncListener at its onStartAsync method.

The AsyncContext object can be used as described by the servlet specification. The ServletRequest and ServletResponse objects obtained from the AsyncContext will provide functionality appropriate for the portlet environment.

The ResourceRequest and ResourceResponse objects passed as arguments to this method will be made available as request attributes on the code>ServletRequest object obtained from the AsyncContext under the names javax.portlet.request and javax.portlet.response, respectively. The PortletConfig object will be made available on the ServletRequest under the name javax.portlet.config.

Subsequent invocations of this method, or its zero-argument variant, will return the same AsyncContext instance, reinitialized as appropriate. If a call to this method is followed by a call to its zero-argument variant, the specified (and possibly wrapped) ResourceRequest and ResourceResponse objects will remain available as request attributes on the ServletRequest object obtained from the AsyncContext.

The AsyncContext#dispatch() method will cause the portlet resource method to be invoked with the ResourceRequest and ResourceResponse objects available as attributes on the ServletRequest object obtained from the AsyncContext. In this case, the ResourceRequest#isAsyncStarted() method will return false and the ResourceRequest#getDispatcherType() method will return DispatcherType#ASYNC.

A portlet ResourceFilter that allocates resources and attaches them to the ResourceRequest or that wraps the ResourceRequest or ResourceResponse should not release resources in the outbound direction if asynchronous mode has been started. A portlet ResourceFilter can use the values provided by the ResourceRequest#isAsyncStarted() and the ResourceRequest#getDispatcherType() methods to determine when to allocate and release resources.

Returns:PortletAsyncContext

the (re)initialized AsyncContext

Annotations
@Override
Exceptions
IllegalStateException:
if this request is within the scope of a filter or servlet that does not support asynchronous operations (that is, isAsyncSupported() returns false), or if this method is called again without any asynchronous dispatch (resulting from one of the PortletAsyncContext#dispatch methods), is called outside the scope of any such dispatch, or is called again within the scope of the same dispatch, or if the response has already been closed