com.vaadin.server
Class VaadinPortletRequest

java.lang.Object
  extended by javax.portlet.filter.PortletRequestWrapper
      extended by com.vaadin.server.VaadinPortletRequest
All Implemented Interfaces:
VaadinRequest, java.io.Serializable, javax.portlet.PortletRequest
Direct Known Subclasses:
VaadinPortlet.VaadinHttpAndPortletRequest

public class VaadinPortletRequest
extends javax.portlet.filter.PortletRequestWrapper
implements VaadinRequest

Wrapper for PortletRequest and its subclasses.

Since:
7.0
Author:
Vaadin Ltd.
See Also:
VaadinRequest, VaadinPortletResponse, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
javax.portlet.PortletRequest.P3PUserInfos
 
Field Summary
 
Fields inherited from interface javax.portlet.PortletRequest
ACTION_PHASE, ACTION_SCOPE_ID, BASIC_AUTH, CCPP_PROFILE, CLIENT_CERT_AUTH, DIGEST_AUTH, EVENT_PHASE, FORM_AUTH, LIFECYCLE_PHASE, RENDER_HEADERS, RENDER_MARKUP, RENDER_PART, RENDER_PHASE, RESOURCE_PHASE, USER_INFO
 
Constructor Summary
VaadinPortletRequest(javax.portlet.PortletRequest request, VaadinPortletService vaadinService)
          Wraps a portlet request and an associated vaadin service
 
Method Summary
 java.lang.String getCharacterEncoding()
          Returns the name of the character encoding used in the body of this request.
 int getContentLength()
          Returns the length of the request content that can be read from the input stream returned by VaadinRequest.getInputStream().
 java.lang.String getContentType()
          Returns the MIME type of the body of the request, or null if the type is not known.
static VaadinPortletRequest getCurrent()
          Gets the currently processed Vaadin portlet request.
static javax.portlet.PortletRequest getCurrentPortletRequest()
          Gets the currently processed portlet request.
 long getDateHeader(java.lang.String name)
          Returns the value of the specified request header as a long value that represents a Date object.
 java.lang.String getHeader(java.lang.String string)
          Gets the value of a request header, e.g.
 java.util.Enumeration<java.lang.String> getHeaderNames()
          Returns an enumeration of all the header names this request contains.
 java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
          Returns all the values of the specified request header as an Enumeration of String objects.
 java.io.InputStream getInputStream()
          Returns an input stream from which the request content can be read.
 java.lang.String getMethod()
          Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
 java.lang.String getPathInfo()
          Gets the path of the requested resource relative to the application.
 java.lang.String getPortalProperty(java.lang.String name)
          Reads a portal property from the portal context of the Vaadin request.
 java.lang.String getPortletPreference(java.lang.String name)
          Reads a portlet preference from the portlet of the request.
 javax.portlet.PortletRequest getPortletRequest()
          Gets the original, unwrapped portlet request.
 java.io.BufferedReader getReader()
          Retrieves the body of the request as character data using a BufferedReader.
 java.lang.String getRemoteAddr()
          Returns the IP address from which the request came.
 java.lang.String getRemoteHost()
          Returns the fully qualified name of the client or the last proxy that sent the request.
 int getRemotePort()
          Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
 VaadinPortletService getService()
          Gets the vaadin service for the context of this request.
 WrappedSession getWrappedSession()
          Gets the session associated with this request, creating a new if there is no session.
 WrappedSession getWrappedSession(boolean allowSessionCreation)
          Gets the session associated with this request, optionally creating a new if there is no session.
 
Methods inherited from class javax.portlet.filter.PortletRequestWrapper
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletMode, getPortletSession, getPortletSession, getPreferences, getPrivateParameterMap, getProperties, getProperty, getPropertyNames, getPublicParameterMap, getRemoteUser, getRequest, getRequestedSessionId, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserPrincipal, getWindowID, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.server.VaadinRequest
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getRemoteUser, getUserPrincipal, isSecure, isUserInRole, removeAttribute, setAttribute
 

Constructor Detail

VaadinPortletRequest

public VaadinPortletRequest(javax.portlet.PortletRequest request,
                            VaadinPortletService vaadinService)
Wraps a portlet request and an associated vaadin service

Parameters:
request - the portlet request to wrap
vaadinService - the associated vaadin service
Method Detail

getContentLength

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

Specified by:
getContentLength in interface VaadinRequest
Returns:
content length in bytes
See Also:
ServletRequest.getContentLength(), ClientDataRequest.getContentLength()

getInputStream

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

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

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Description copied from interface: VaadinRequest
Retrieves the body of the request as character data using a BufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method or VaadinRequest.getInputStream() may be called to read the body, not both.

Specified by:
getReader in interface VaadinRequest
Returns:
a BufferedReader containing the body of the request
Throws:
java.io.UnsupportedEncodingException - - if the character set encoding used is not supported and the text cannot be decoded
java.io.IOException - if an input or output exception occurred
See Also:
ServletRequest.getReader(), ClientDataRequest.getReader()

getPathInfo

public java.lang.String getPathInfo()
Description copied from interface: VaadinRequest
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:
getPathInfo in interface VaadinRequest
Returns:
a string with the path relative to the application.
See Also:
HttpServletRequest.getPathInfo()

getWrappedSession

public WrappedSession getWrappedSession()
Description copied from interface: VaadinRequest
Gets the session associated with this request, creating a new if there is no session.

Specified by:
getWrappedSession in interface VaadinRequest
Returns:
the wrapped session for this request
See Also:
WrappedSession, HttpServletRequest.getSession(), PortletRequest.getPortletSession()

getWrappedSession

public WrappedSession getWrappedSession(boolean allowSessionCreation)
Description copied from interface: VaadinRequest
Gets the session associated with this request, optionally creating a new if there is no session.

Specified by:
getWrappedSession in interface VaadinRequest
Parameters:
allowSessionCreation - true to create a new session for this request if necessary; false to return null if there's no current session
Returns:
the wrapped session for this request
See Also:
WrappedSession, HttpServletRequest.getSession(boolean), PortletRequest.getPortletSession(boolean)

getPortletRequest

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

Returns:
the unwrapped portlet request

getContentType

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

Specified by:
getContentType in interface VaadinRequest
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(), ClientDataRequest.getContentType()

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Description copied from interface: VaadinRequest
Returns the name of the character encoding used in the body of this request. This method returns null if the request does not specify a character encoding.

Specified by:
getCharacterEncoding in interface VaadinRequest
Returns:
a String containing the name of the character encoding, or null if the request does not specify a character encoding
See Also:
ServletRequest.getCharacterEncoding(), ClientDataRequest.getCharacterEncoding()

getMethod

public java.lang.String getMethod()
Description copied from interface: VaadinRequest
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.

Specified by:
getMethod in interface VaadinRequest
Returns:
a String specifying the name of the method with which this request was made
See Also:
HttpServletRequest.getMethod(), ClientDataRequest.getMethod()

getRemoteAddr

public java.lang.String getRemoteAddr()
Description copied from interface: VaadinRequest
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 VaadinRequest
Returns:
a string containing the IP address, or null if the address is not available
See Also:
ServletRequest.getRemoteAddr()

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: VaadinRequest
Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.

Specified by:
getRemoteHost in interface VaadinRequest
Returns:
a String containing the fully qualified name of the client, or null if the information is not available.
See Also:
ServletRequest.getRemoteHost()

getRemotePort

public int getRemotePort()
Description copied from interface: VaadinRequest
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.

Specified by:
getRemotePort in interface VaadinRequest
Returns:
an integer specifying the port number, or -1 if the information is not available.
See Also:
ServletRequest.getRemotePort()

getHeader

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

Specified by:
getHeader in interface VaadinRequest
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 java.lang.String getPortalProperty(java.lang.String name)
Reads a portal property from the portal context of the Vaadin 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

getPortletPreference

public java.lang.String getPortletPreference(java.lang.String name)
Reads a portlet preference from the portlet of the request.

Parameters:
name - The name of the portlet preference. Cannot be null.
Returns:
The value of the portlet preference, null if the preference is not defined.

getService

public VaadinPortletService getService()
Description copied from interface: VaadinRequest
Gets the vaadin service for the context of this request.

Specified by:
getService in interface VaadinRequest
Returns:
the vaadin service
See Also:
VaadinService

getDateHeader

public long getDateHeader(java.lang.String name)
Description copied from interface: VaadinRequest
Returns the value of the specified request header as a long value that represents a Date object. Use this method with headers that contain dates, such as If-Modified-Since.

The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.

If the request did not have a header of the specified name, this method returns -1. If the header can't be converted to a date, the method throws an IllegalArgumentException.

Specified by:
getDateHeader in interface VaadinRequest
Parameters:
name - a String specifying the name of the header
Returns:
a long value representing the date specified in the header expressed as the number of milliseconds since January 1, 1970 GMT, or -1 if the named header was not included with the request
See Also:
HttpServletRequest.getDateHeader(String)

getHeaderNames

public java.util.Enumeration<java.lang.String> getHeaderNames()
Description copied from interface: VaadinRequest
Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration.

Some implementations do not allow access headers using this method, in which case this method returns null

Specified by:
getHeaderNames in interface VaadinRequest
Returns:
an enumeration of all the header names sent with this request; if the request has no headers, an empty enumeration; if the implementation does not allow this method, null
See Also:
HttpServletRequest.getHeaderNames()

getHeaders

public java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
Description copied from interface: VaadinRequest
Returns all the values of the specified request header as an Enumeration of String objects.

Some headers, such as Accept-Language can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.

If the request did not include any headers of the specified name, this method returns an empty Enumeration. If the request does not support accessing headers, this method returns null.

The header name is case insensitive. You can use this method with any request header.

Specified by:
getHeaders in interface VaadinRequest
Parameters:
name - a String specifying the header name
Returns:
an Enumeration containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration. If the header information is not available, return null
See Also:
HttpServletRequest.getHeaders(String)

getCurrentPortletRequest

public static javax.portlet.PortletRequest getCurrentPortletRequest()
Gets the currently processed portlet request. The current portlet request is automatically defined when the request is started. The current portlet request can not be used in e.g. background threads because of the way server implementations reuse request instances.

Returns:
the current portlet request instance if available, otherwise null
Since:
7.3

getCurrent

public static VaadinPortletRequest getCurrent()
Gets the currently processed Vaadin portlet request. The current request is automatically defined when the request is started. The current request can not be used in e.g. background threads because of the way server implementations reuse request instances.

Returns:
the current Vaadin portlet request instance if available, otherwise null
Since:
7.3


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