com.vaadin.terminal.gwt.server
Class WrappedPortletRequest

java.lang.Object
  extended by com.vaadin.terminal.gwt.server.WrappedPortletRequest
All Implemented Interfaces:
WrappedRequest, Serializable
Direct Known Subclasses:
AbstractApplicationPortlet.WrappedHttpAndPortletRequest

public class WrappedPortletRequest
extends Object
implements WrappedRequest

Wrapper for PortletRequest and its subclasses.

Since:
7.0
Author:
Vaadin Ltd.
See Also:
WrappedRequest, WrappedPortletResponse, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.WrappedRequest
WrappedRequest.BrowserDetails
 
Constructor Summary
WrappedPortletRequest(PortletRequest request, DeploymentConfiguration deploymentConfiguration)
          Wraps a portlet request and an associated deployment configuration
 
Method Summary
static WrappedPortletRequest cast(WrappedRequest request)
          Helper method to get a WrappedPortlettRequest from a WrappedRequest.
 Object getAttribute(String name)
          Gets a request attribute.
 WrappedRequest.BrowserDetails getBrowserDetails()
          Gets detailed information about the browser from which the request originated.
 int getContentLength()
          Returns the length of the request content that can be read from the input stream returned by WrappedRequest.getInputStream().
 String getContentType()
          Returns the MIME type of the body of the request, or null if the type is not known.
 DeploymentConfiguration getDeploymentConfiguration()
          Gets the deployment configuration for the context of this request.
 String getHeader(String string)
          Gets the value of a request header, e.g.
 InputStream getInputStream()
          Returns an input stream from which the request content can be read.
 Locale getLocale()
          Gets locale information from the query, e.g.
 String getParameter(String name)
          Gets the named request parameter This is typically a HTTP GET or POST parameter, though other request types might have other ways of representing parameters.
 Map<String,String[]> getParameterMap()
          Gets all the parameters of the request.
 String getPortalProperty(String name)
          Reads a portal property from the portal context of the wrapped request.
 PortletRequest getPortletRequest()
          Gets the original, unwrapped portlet request.
 String getRemoteAddr()
          Returns the IP address from which the request came.
 String getRequestPathInfo()
          Gets the path of the requested resource relative to the application.
 Object getSessionAttribute(String name)
          Gets an attribute from the session associated with this request.
 int getSessionMaxInactiveInterval()
          Returns the maximum time interval, in seconds, that the session associated with this request will be kept open between client accesses.
 boolean isSecure()
          Checks whether the request was made using a secure channel, e.g.
 void setAttribute(String name, Object o)
          Defines a request attribute.
 void setSessionAttribute(String name, Object attribute)
          Saves an attribute value in the session associated with this request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedPortletRequest

public WrappedPortletRequest(PortletRequest request,
                             DeploymentConfiguration deploymentConfiguration)
Wraps a portlet request and an associated deployment configuration

Parameters:
request - the portlet request to wrap
deploymentConfiguration - the associated deployment configuration
Method Detail

getAttribute

public Object getAttribute(String name)
Description copied from interface: WrappedRequest
Gets a request attribute.

Specified by:
getAttribute in interface WrappedRequest
Parameters:
name - the name of the attribute
Returns:
the value of the attribute, or null if there is no attribute with the given name
See Also:
ServletRequest.getAttribute(String), javax.portlet.PortletRequest#getAttribute(String)

getContentLength

public int getContentLength()
Description copied from interface: WrappedRequest
Returns the length of the request content that can be read from the input stream returned by WrappedRequest.getInputStream().

Specified by:
getContentLength in interface WrappedRequest
Returns:
content length in bytes
See Also:
ServletRequest.getContentLength(), javax.portlet.ClientDataRequest#getContentLength()

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from interface: WrappedRequest
Returns an input stream from which the request content can be read. The request content length can be obtained with WrappedRequest.getContentLength() without reading the full stream contents.

Specified by:
getInputStream in interface WrappedRequest
Returns:
the input stream from which the contents of the request can be read
Throws:
IOException - if the input stream can not be opened
See Also:
ServletRequest.getInputStream(), javax.portlet.ClientDataRequest#getPortletInputStream()

getParameter

public String getParameter(String name)
Description copied from interface: WrappedRequest
Gets the named request parameter This is typically a HTTP GET or POST parameter, though other request types might have other ways of representing parameters.

Specified by:
getParameter in interface WrappedRequest
Parameters:
name - the name of the parameter
Returns:
The paramter value, or null if no parameter with the given name is present
See Also:
ServletRequest.getParameter(String), javax.portlet.PortletRequest#getParameter(String)

getParameterMap

public Map<String,String[]> getParameterMap()
Description copied from interface: WrappedRequest
Gets all the parameters of the request.

Specified by:
getParameterMap in interface WrappedRequest
Returns:
A mapping of parameter names to arrays of parameter values
See Also:
WrappedRequest.getParameter(String), ServletRequest.getParameterMap(), javax.portlet.PortletRequest#getParameter(String)

setAttribute

public void setAttribute(String name,
                         Object o)
Description copied from interface: WrappedRequest
Defines a request attribute.

Specified by:
setAttribute in interface WrappedRequest
Parameters:
name - the name of the attribute
o - the attribute value
See Also:
ServletRequest.setAttribute(String, Object), javax.portlet.PortletRequest#setAttribute(String, Object)

getRequestPathInfo

public String getRequestPathInfo()
Description copied from interface: WrappedRequest
Gets the path of the requested resource relative to the application. The path be null if no path information is available. Does always start with / if the path isn't null.

Specified by:
getRequestPathInfo in interface WrappedRequest
Returns:
a string with the path relative to the application.
See Also:
HttpServletRequest.getPathInfo()

getSessionMaxInactiveInterval

public int getSessionMaxInactiveInterval()
Description copied from interface: WrappedRequest
Returns the maximum time interval, in seconds, that the session associated with this request will be kept open between client accesses.

Specified by:
getSessionMaxInactiveInterval in interface WrappedRequest
Returns:
an integer specifying the number of seconds the session associated with this request remains open between client requests
See Also:
HttpSession.getMaxInactiveInterval(), javax.portlet.PortletSession#getMaxInactiveInterval()

getSessionAttribute

public Object getSessionAttribute(String name)
Description copied from interface: WrappedRequest
Gets an attribute from the session associated with this request.

Specified by:
getSessionAttribute in interface WrappedRequest
Parameters:
name - the name of the attribute
Returns:
the attribute value, or null if the attribute is not defined in the session
See Also:
HttpSession.getAttribute(String), javax.portlet.PortletSession#getAttribute(String)

setSessionAttribute

public void setSessionAttribute(String name,
                                Object attribute)
Description copied from interface: WrappedRequest
Saves an attribute value in the session associated with this request.

Specified by:
setSessionAttribute in interface WrappedRequest
Parameters:
name - the name of the attribute
attribute - the attribute value
See Also:
HttpSession.setAttribute(String, Object), javax.portlet.PortletSession#setAttribute(String, Object)

getPortletRequest

public PortletRequest getPortletRequest()
Gets the original, unwrapped portlet request.

Returns:
the unwrapped portlet request

getContentType

public String getContentType()
Description copied from interface: WrappedRequest
Returns the MIME type of the body of the request, or null if the type is not known.

Specified by:
getContentType in interface WrappedRequest
Returns:
a string containing the name of the MIME type of the request, or null if the type is not known
See Also:
ServletRequest.getContentType(), javax.portlet.ResourceRequest#getContentType()

getBrowserDetails

public WrappedRequest.BrowserDetails getBrowserDetails()
Description copied from interface: WrappedRequest
Gets detailed information about the browser from which the request originated. This consists of information that is not available from normal HTTP requests, but requires additional information to be extracted for instance using javascript in the browser. This information is only guaranteed to be available in some special cases, for instance when Application.getRoot(com.vaadin.terminal.WrappedRequest) is called again after throwing RootRequiresMoreInformationException or in Root.init(WrappedRequest) for a Root class not annotated with EagerInit

Specified by:
getBrowserDetails in interface WrappedRequest
Returns:
the browser details, or null if details are not available
See Also:
WrappedRequest.BrowserDetails

getLocale

public Locale getLocale()
Description copied from interface: WrappedRequest
Gets locale information from the query, e.g. using the Accept-Language header.

Specified by:
getLocale in interface WrappedRequest
Returns:
the preferred Locale
See Also:
ServletRequest.getLocale(), PortletRequest#getLocale()

getRemoteAddr

public String getRemoteAddr()
Description copied from interface: WrappedRequest
Returns the IP address from which the request came. This might also be the address of a proxy between the server and the original requester.

Specified by:
getRemoteAddr in interface WrappedRequest
Returns:
a string containing the IP address, or null if the address is not available
See Also:
ServletRequest.getRemoteAddr()

isSecure

public boolean isSecure()
Description copied from interface: WrappedRequest
Checks whether the request was made using a secure channel, e.g. using https.

Specified by:
isSecure in interface WrappedRequest
Returns:
a boolean indicating if the request is secure
See Also:
ServletRequest.isSecure(), PortletRequest#isSecure()

getHeader

public String getHeader(String string)
Description copied from interface: WrappedRequest
Gets the value of a request header, e.g. a http header for a HttpServletRequest.

Specified by:
getHeader in interface WrappedRequest
Parameters:
string - the name of the header
Returns:
the header value, or null if the header is not present in the request
See Also:
HttpServletRequest.getHeader(String)

getPortalProperty

public String getPortalProperty(String name)
Reads a portal property from the portal context of the wrapped request.

Parameters:
name - a string with the name of the portal property to get
Returns:
a string with the value of the property, or null if the property is not defined

getDeploymentConfiguration

public DeploymentConfiguration getDeploymentConfiguration()
Description copied from interface: WrappedRequest
Gets the deployment configuration for the context of this request.

Specified by:
getDeploymentConfiguration in interface WrappedRequest
Returns:
the deployment configuration
See Also:
DeploymentConfiguration

cast

public static WrappedPortletRequest cast(WrappedRequest request)
Helper method to get a WrappedPortlettRequest from a WrappedRequest. Aside from casting, this method also takes care of situations where there's another level of wrapping.

Parameters:
request - a wrapped request
Returns:
a wrapped portlet request
Throws:
ClassCastException - if the wrapped request doesn't wrap a portlet request


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.