Package org.wildfly.security.http.impl
Class BaseHttpServerRequest
- java.lang.Object
-
- org.wildfly.security.http.impl.BaseHttpServerRequest
-
- All Implemented Interfaces:
HttpServerRequest
,HttpServerScopes
- Direct Known Subclasses:
HttpAuthenticator.AuthenticationExchange
,ProgrammaticSingleSignOnCache.SSOHttpServerRequest
public abstract class BaseHttpServerRequest extends Object implements HttpServerRequest
A base implementation ofHttpServerRequest
- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private HttpExchangeSpi
httpExchangeSpi
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseHttpServerRequest(HttpExchangeSpi httpExchangeSpi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<HttpServerCookie>
getCookies()
Returns aList
containing all of theHttpServerCookie
objects the client sent with this request, or an emptyList
if no cookies were included in the request.String
getFirstParameterValue(String name)
Get the first value for the parameter specified.String
getFirstRequestHeaderValue(String headerName)
Get the first value for the header specified in the HTTP request.InputStream
getInputStream()
Returns the request input stream.Set<String>
getParameterNames()
Returns the names of all parameters either from the query string or from the form data where available.Map<String,List<String>>
getParameters()
Returns the parameters received in the current request.List<String>
getParameterValues(String name)
Return the values for the parameter specified, where a parameter is specified both in the query string and in the form data the query string values will be first in theList
.Certificate[]
getPeerCertificates()
Get the peer certificates established on the connection.String
getRemoteUser()
Returns a remotely authenticated userList<String>
getRequestHeaderValues(String headerName)
Get a list of all of the values set for the specified header within the HTTP request.String
getRequestMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.String
getRequestPath()
Get the request path.URI
getRequestURI()
Get the URI representation for the current request.HttpScope
getScope(Scope scope)
Get the specifiedHttpScope
if available.HttpScope
getScope(Scope scope, String id)
Get the specifiedHttpScope
with the specified ID.Collection<String>
getScopeIds(Scope scope)
Get the IDs available for the scope specified.InetSocketAddress
getSourceAddress()
Get the source address of the HTTP request.SSLSession
getSSLSession()
Get theSSLSession
(if any) that has been established for the connection in use.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.http.HttpServerRequest
authenticationComplete, authenticationComplete, authenticationComplete, authenticationFailed, authenticationFailed, authenticationInProgress, badRequest, badRequest, noAuthenticationInProgress, noAuthenticationInProgress, resumeRequest, setRequestInputStreamSupplier, suspendRequest
-
-
-
-
Field Detail
-
httpExchangeSpi
private final HttpExchangeSpi httpExchangeSpi
-
-
Constructor Detail
-
BaseHttpServerRequest
protected BaseHttpServerRequest(HttpExchangeSpi httpExchangeSpi)
-
-
Method Detail
-
getScope
public HttpScope getScope(Scope scope)
Description copied from interface:HttpServerScopes
Get the specifiedHttpScope
if available.- Specified by:
getScope
in interfaceHttpServerScopes
- Parameters:
scope
- the type of the scope required.- Returns:
- the scope specified or
null
if not supported.
-
getScopeIds
public Collection<String> getScopeIds(Scope scope)
Description copied from interface:HttpServerScopes
Get the IDs available for the scope specified.- Specified by:
getScopeIds
in interfaceHttpServerScopes
- Parameters:
scope
- the scope the IDs are required for.- Returns:
- The IDs available for the scope specified or
null
if the scope specified does not support obtaining scopes by ID.
-
getScope
public HttpScope getScope(Scope scope, String id)
Description copied from interface:HttpServerScopes
Get the specifiedHttpScope
with the specified ID.- Specified by:
getScope
in interfaceHttpServerScopes
- Parameters:
scope
- the type of the scope required.id
- the id of the scope instance required.- Returns:
- the scope specified or
null
if not supported or if the scope with that ID does not exist.
-
getRequestHeaderValues
public List<String> getRequestHeaderValues(String headerName)
Description copied from interface:HttpServerRequest
Get a list of all of the values set for the specified header within the HTTP request.- Specified by:
getRequestHeaderValues
in interfaceHttpServerRequest
- Parameters:
headerName
- the notnull
name of the header the values are required for.- Returns:
- a list of the values set for this header, if the header is not set on the request then
null
should be returned.
-
getFirstRequestHeaderValue
public String getFirstRequestHeaderValue(String headerName)
Description copied from interface:HttpServerRequest
Get the first value for the header specified in the HTTP request.- Specified by:
getFirstRequestHeaderValue
in interfaceHttpServerRequest
- Parameters:
headerName
- the notnull
name of the header the value is required for.- Returns:
- the value for the first instance of the header specified, if the header is not present then
null
should be returned instead.
-
getSSLSession
public SSLSession getSSLSession()
Description copied from interface:HttpServerRequest
Get theSSLSession
(if any) that has been established for the connection in use. Note that even if this is nullHttpServerRequest.getPeerCertificates()
can still return some certificates, as the certificates may have been provided to the underlying server via some external mechanism (such as headers).- Specified by:
getSSLSession
in interfaceHttpServerRequest
- Returns:
- the
SSLSession
(if any) that has been established for the connection in use, ornull
if none exists.
-
getPeerCertificates
public Certificate[] getPeerCertificates()
Description copied from interface:HttpServerRequest
Get the peer certificates established on the connection.- Specified by:
getPeerCertificates
in interfaceHttpServerRequest
- Returns:
- the peer certificates established on the connection or
null
if none available.
-
getRemoteUser
public String getRemoteUser()
Description copied from interface:HttpServerRequest
Returns a remotely authenticated user- Specified by:
getRemoteUser
in interfaceHttpServerRequest
- Returns:
- the remote user principal or
null
if no remote user was authenticated.
-
getRequestMethod
public String getRequestMethod()
Description copied from interface:HttpServerRequest
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Specified by:
getRequestMethod
in interfaceHttpServerRequest
- Returns:
- a
String
specifying the name of the method with which this request was made
-
getRequestURI
public URI getRequestURI()
Description copied from interface:HttpServerRequest
Get the URI representation for the current request.- Specified by:
getRequestURI
in interfaceHttpServerRequest
- Returns:
- the URI representation for the current request.
-
getRequestPath
public String getRequestPath()
Description copied from interface:HttpServerRequest
Get the request path. This is the path relative to the context path. E.g.: for a HTTP GET request tohttp://my.appserver.com/my-application/path/sub-path
this method is going to return/path/sub-path
.- Specified by:
getRequestPath
in interfaceHttpServerRequest
- Returns:
- the request path
-
getParameters
public Map<String,List<String>> getParameters()
Description copied from interface:HttpServerRequest
Returns the parameters received in the current request. These parameters will be from both the query string and the form data when available. Where a parameter is named both in the query string and in the form data theList
will contain the values from the query string followed by the values from the form data.- Specified by:
getParameters
in interfaceHttpServerRequest
- Returns:
- the parameters received in the current request.
-
getParameterNames
public Set<String> getParameterNames()
Description copied from interface:HttpServerRequest
Returns the names of all parameters either from the query string or from the form data where available.- Specified by:
getParameterNames
in interfaceHttpServerRequest
- Returns:
- the names of all parameters either from the query string or from the form data where available.
-
getParameterValues
public List<String> getParameterValues(String name)
Description copied from interface:HttpServerRequest
Return the values for the parameter specified, where a parameter is specified both in the query string and in the form data the query string values will be first in theList
.- Specified by:
getParameterValues
in interfaceHttpServerRequest
- Parameters:
name
- the name of the desires parameter values.- Returns:
- the values for the parameter specified or
null
if the parameter was not in the request.
-
getFirstParameterValue
public String getFirstParameterValue(String name)
Description copied from interface:HttpServerRequest
Get the first value for the parameter specified.- Specified by:
getFirstParameterValue
in interfaceHttpServerRequest
- Parameters:
name
- the name of the parameter the first value is required for.- Returns:
- the first value of the named parameter or
null
if the parameter is not available.
-
getCookies
public List<HttpServerCookie> getCookies()
Description copied from interface:HttpServerRequest
Returns aList
containing all of theHttpServerCookie
objects the client sent with this request, or an emptyList
if no cookies were included in the request.- Specified by:
getCookies
in interfaceHttpServerRequest
- Returns:
- a
List
containing all of theHttpServerCookie
objects the client sent with this request, or an emptyList
if no cookies were included in the request.
-
getInputStream
public InputStream getInputStream()
Description copied from interface:HttpServerRequest
Returns the request input stream.- Specified by:
getInputStream
in interfaceHttpServerRequest
- Returns:
- the input stream or
null
if not supported.
-
getSourceAddress
public InetSocketAddress getSourceAddress()
Description copied from interface:HttpServerRequest
Get the source address of the HTTP request.- Specified by:
getSourceAddress
in interfaceHttpServerRequest
- Returns:
- the source address of the HTTP request
-
-