public interface VaadinRequest
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name)
Gets a request attribute.
|
Enumeration<String> |
getAttributeNames()
Returns an Enumeration containing the names of the attributes available
to this request.
|
String |
getAuthType()
Returns the name of the authentication scheme used for the connection
between client and server, for example,
BASIC_AUTH ,
CLIENT_CERT_AUTH , a custom one or null if there
was no authentication. |
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
getInputStream() . |
default long |
getContentLengthLong()
Returns the length of the request content that can be read from the input
stream returned by
getInputStream() . |
String |
getContentType()
Returns the MIME type of the body of the request, or null if the type is
not known.
|
String |
getContextPath()
Returns the portion of the request URI that indicates the context of the
request.
|
javax.servlet.http.Cookie[] |
getCookies()
Returns an array containing all of the
Cookie objects the
client sent with this request. |
static VaadinRequest |
getCurrent()
Gets the currently processed Vaadin request.
|
long |
getDateHeader(String name)
Returns the value of the specified request header as a long value that
represents a Date object.
|
String |
getHeader(String headerName)
Gets the value of a request header, e.g.
|
Enumeration<String> |
getHeaderNames()
Returns an enumeration of all the header names this request contains.
|
Enumeration<String> |
getHeaders(String name)
Returns all the values of the specified request header as an Enumeration
of String objects.
|
InputStream |
getInputStream()
Returns an input stream from which the request content can be read.
|
Locale |
getLocale()
Gets locale information from the query, e.g.
|
Enumeration<Locale> |
getLocales()
Returns an Enumeration of Locale objects indicating, in decreasing order
starting with the preferred locale, the locales that are acceptable to
the client based on the Accept-Language header.
|
String |
getMethod()
Returns the name of the HTTP method with which this request was made, for
example, GET, POST, or PUT.
|
String |
getParameter(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.
|
Map<String,String[]> |
getParameterMap()
Gets all the parameters of the request.
|
String |
getPathInfo()
Gets the path of the requested resource relative to the application.
|
BufferedReader |
getReader()
Retrieves the body of the request as character data using a
BufferedReader . |
String |
getRemoteAddr()
Returns the IP address from which the request came.
|
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.
|
String |
getRemoteUser()
Returns the login of the user making this request, if the user has been
authenticated, or null if the user has not been authenticated.
|
VaadinService |
getService()
Gets the vaadin service for the context of this request.
|
Principal |
getUserPrincipal()
Returns a
java.security.Principal object containing the name
of the current authenticated user. |
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.
|
boolean |
isUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included
in the specified logical "role".
|
void |
removeAttribute(String name)
Removes an attribute from this request.
|
void |
setAttribute(String name,
Object value)
Defines a request attribute.
|
String getParameter(String parameter)
parameter
- the name of the parameternull
if no parameter with
the given name is presentServletRequest.getParameter(String)
Map<String,String[]> getParameterMap()
getParameter(String)
,
ServletRequest.getParameterMap()
int getContentLength()
getInputStream()
.ServletRequest.getContentLength()
default long getContentLengthLong()
getInputStream()
.ServletRequest.getContentLengthLong()
InputStream getInputStream() throws IOException
getContentLength()
without reading the full stream contents.IOException
- if the input stream can not be openedServletRequest.getInputStream()
Object getAttribute(String name)
name
- the name of the attributenull
if there is no
attribute with the given nameServletRequest.getAttribute(String)
void setAttribute(String name, Object value)
name
- the name of the attributevalue
- the attribute valueServletRequest.setAttribute(String, Object)
String getPathInfo()
null
if no path information is available. Does
always start with / if the path isn't null
.HttpServletRequest.getPathInfo()
String getContextPath()
HttpServletRequest.getContextPath()
WrappedSession getWrappedSession()
WrappedSession
,
HttpServletRequest.getSession()
WrappedSession getWrappedSession(boolean allowSessionCreation)
allowSessionCreation
- true
to create a new session for this request if
necessary; false
to return null
if
there's no current sessionWrappedSession
,
HttpServletRequest.getSession(boolean)
String getContentType()
ServletRequest.getContentType()
Locale getLocale()
ServletRequest.getLocale()
String getRemoteAddr()
null
if the
address is not availableServletRequest.getRemoteAddr()
boolean isSecure()
ServletRequest.isSecure()
String getHeader(String headerName)
HttpServletRequest
.headerName
- the name of the headernull
if the header is not
present in the requestHttpServletRequest.getHeader(String)
VaadinService getService()
VaadinService
javax.servlet.http.Cookie[] getCookies()
Cookie
objects the
client sent with this request. This method returns null
if
no cookies were sent.Cookies
included with this
request, or null
if the request has no cookiesHttpServletRequest.getCookies()
String getAuthType()
BASIC_AUTH
,
CLIENT_CERT_AUTH
, a custom one or null
if there
was no authentication.null
if the request was not authenticated.HttpServletRequest.getAuthType()
String getRemoteUser()
null
if the user login is not known.HttpServletRequest.getRemoteUser()
Principal getUserPrincipal()
java.security.Principal
object containing the name
of the current authenticated user. If the user has not been
authenticated, the method returns null
.java.security.Principal
containing the name of the
user making this request; null
if the user has not
been authenticatedHttpServletRequest.getUserPrincipal()
boolean isUserInRole(String role)
false
.role
- a String specifying the name of the rolefalse
if the user has not been
authenticatedHttpServletRequest.isUserInRole(String)
void removeAttribute(String name)
name
- a String specifying the name of the attribute to removeServletRequest.removeAttribute(String)
Enumeration<String> getAttributeNames()
ServletRequest.getAttributeNames()
Enumeration<Locale> getLocales()
ServletRequest.getLocales()
String getRemoteHost()
null
if the information is not available.ServletRequest.getRemoteHost()
int getRemotePort()
ServletRequest.getRemotePort()
String getCharacterEncoding()
null
if the request does not
specify a character encoding.ServletRequest.getCharacterEncoding()
BufferedReader getReader() throws IOException
BufferedReader
. The reader translates the character data
according to the character encoding used on the body. Either this method
or getInputStream()
may be called to read the body, not both.UnsupportedEncodingException
- - if the character set encoding used is not supported and the
text cannot be decodedIllegalStateException
- - if getInputStream()
method has been called on this
requestIOException
- if an input or output exception occurredServletRequest.getReader()
String getMethod()
HttpServletRequest.getMethod()
long getDateHeader(String name)
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.
name
- a String specifying the name of the headerIllegalArgumentException
- If the header value can't be converted to a dateHttpServletRequest.getDateHeader(String)
Enumeration<String> getHeaderNames()
Some implementations do not allow access headers using this method, in
which case this method returns null
null
HttpServletRequest.getHeaderNames()
Enumeration<String> getHeaders(String name)
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.
name
- a String specifying the header namenull
HttpServletRequest.getHeaders(String)
static VaadinRequest getCurrent()
null
Copyright © 2021. All rights reserved.