com.vaadin.server
Interface VaadinRequest

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
VaadinPortlet.VaadinGateinRequest, VaadinPortlet.VaadinHttpAndPortletRequest, VaadinPortlet.VaadinLiferayRequest, VaadinPortletRequest, VaadinServletRequest

public interface VaadinRequest
extends java.io.Serializable

A generic request to the server, wrapping a more specific request type, e.g. HttpServletReqest or PortletRequest.

Since:
7.0.0
Author:
Vaadin Ltd

Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Gets a request attribute.
 int getContentLength()
          Returns the length of the request content that can be read from the input stream returned by 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 headerName)
          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.
 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.
 

Method Detail

getParameter

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.

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

java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Gets all the parameters of the request.

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

getContentLength

int getContentLength()
Returns the length of the request content that can be read from the input stream returned by getInputStream().

Returns:
content length in bytes
See Also:
ServletRequest.getContentLength(), ClientDataRequest.getContentLength()

getInputStream

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

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

java.lang.Object getAttribute(java.lang.String name)
Gets a request attribute.

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

void setAttribute(java.lang.String name,
                  java.lang.Object value)
Defines a request attribute.

Parameters:
name - the name of the attribute
value - the attribute value
See Also:
ServletRequest.setAttribute(String, Object), PortletRequest.setAttribute(String, Object)

getRequestPathInfo

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

Returns:
a string with the path relative to the application.
See Also:
HttpServletRequest.getPathInfo()

getContextPath

java.lang.String getContextPath()
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI.

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

getWrappedSession

WrappedSession getWrappedSession()
Gets the session associated with this request, creating a new if there is no session.

Returns:
the wrapped session for this request
See Also:
WrappedSession, HttpServletRequest.getSession(), PortletRequest.getPortletSession()

getWrappedSession

WrappedSession getWrappedSession(boolean allowSessionCreation)
Gets the session associated with this request, optionally creating a new if there is no session.

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

java.lang.String getContentType()
Returns the MIME type of the body of the request, or null if the type is not known.

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

getLocale

java.util.Locale getLocale()
Gets locale information from the query, e.g. using the Accept-Language header.

Returns:
the preferred Locale
See Also:
ServletRequest.getLocale(), PortletRequest.getLocale()

getRemoteAddr

java.lang.String getRemoteAddr()
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.

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

isSecure

boolean isSecure()
Checks whether the request was made using a secure channel, e.g. using https.

Returns:
a boolean indicating if the request is secure
See Also:
ServletRequest.isSecure(), PortletRequest.isSecure()

getHeader

java.lang.String getHeader(java.lang.String headerName)
Gets the value of a request header, e.g. a http header for a HttpServletRequest.

Parameters:
headerName - 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

VaadinService getService()
Gets the vaadin service for the context of this request.

Returns:
the vaadin service
See Also:
VaadinService


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