com.vaadin.server
Class CombinedRequest

java.lang.Object
  extended by com.vaadin.server.CombinedRequest
All Implemented Interfaces:
VaadinRequest, java.io.Serializable

public class CombinedRequest
extends java.lang.Object
implements VaadinRequest

A VaadinRequest with path and parameters from one request and VaadinRequest.BrowserDetails extracted from another request. This class is intended to be used for a two request initialization where the first request fetches the actual application page and the second request contains information extracted from the browser using javascript.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.server.VaadinRequest
VaadinRequest.BrowserDetails
 
Constructor Summary
CombinedRequest(VaadinRequest secondRequest)
          Creates a new combined request based on the second request and some details from the first request.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Gets a request attribute.
 VaadinRequest.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 VaadinRequest.getInputStream().
 java.lang.String getContentType()
          Returns the MIME type of the body of the request, or null if the type is not known.
 java.lang.String getContextPath()
          Returns the portion of the request URI that indicates the context of the request.
 java.lang.String getHeader(java.lang.String name)
          Gets the value of a request header, e.g.
 java.io.InputStream getInputStream()
          Returns an input stream from which the request content can be read.
 java.util.Locale getLocale()
          Gets locale information from the query, e.g.
 java.lang.String getParameter(java.lang.String parameter)
          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.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
          Gets all the parameters of the request.
 java.lang.String getRemoteAddr()
          Returns the IP address from which the request came.
 java.lang.String getRequestPathInfo()
          Gets the path of the requested resource relative to the application.
 VaadinRequest getSecondRequest()
          Gets the original second request.
 VaadinService 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.
 boolean isSecure()
          Checks whether the request was made using a secure channel, e.g.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Defines a request attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedRequest

public CombinedRequest(VaadinRequest secondRequest)
                throws org.json.JSONException
Creates a new combined request based on the second request and some details from the first request.

Parameters:
secondRequest - the second request which will be used as the foundation of the combined request
Throws:
org.json.JSONException - if the initialParams parameter can not be decoded
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String parameter)
Description copied from interface: VaadinRequest
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 VaadinRequest
Parameters:
parameter - 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), PortletRequest.getParameter(String)

getParameterMap

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

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

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()

getAttribute

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

Specified by:
getAttribute in interface VaadinRequest
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), PortletRequest.getAttribute(String)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: VaadinRequest
Defines a request attribute.

Specified by:
setAttribute in interface VaadinRequest
Parameters:
name - the name of the attribute
value - the attribute value
See Also:
ServletRequest.setAttribute(String, Object), PortletRequest.setAttribute(String, Object)

getRequestPathInfo

public java.lang.String getRequestPathInfo()
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:
getRequestPathInfo 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)

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()

getBrowserDetails

public VaadinRequest.BrowserDetails getBrowserDetails()
Description copied from interface: VaadinRequest
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 in UI.init(VaadinRequest).

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

getSecondRequest

public VaadinRequest getSecondRequest()
Gets the original second request. This can be used e.g. if a request parameter from the second request is required.

Returns:
the original second Vaadin request

getLocale

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

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

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()

isSecure

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

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

getHeader

public java.lang.String getHeader(java.lang.String name)
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:
name - 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)

getService

public VaadinService 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

getContextPath

public java.lang.String getContextPath()
Description copied from interface: VaadinRequest
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI.

Specified by:
getContextPath in interface VaadinRequest
Returns:
a String specifying the portion of the request URI that indicates the context of the request
See Also:
HttpServletRequest.getContextPath(), PortletRequest.getContextPath()


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