Package org.wildfly.security.http
Interface HttpServerRequest
-
- All Superinterfaces:
HttpServerScopes
- All Known Implementing Classes:
HttpServerRequestWrapper
public interface HttpServerRequest extends HttpServerScopes
Server side representation of a HTTP request.- Author:
- Darran Lofthouse
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
authenticationComplete()
Notification that authentication is now complete.void
authenticationComplete(HttpServerMechanismsResponder responder)
Notification that authentication is now complete.void
authenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)
Notification that authentication is now complete.default void
authenticationFailed(String message)
Notification that authentication failes.void
authenticationFailed(String message, HttpServerMechanismsResponder responder)
Notification that authentication failes.void
authenticationInProgress(HttpServerMechanismsResponder responder)
Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.default void
badRequest(HttpAuthenticationException failure)
Notification to indicate that this was a bad request.void
badRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)
Notification to indicate that this was a bad request.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.default 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.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.default void
noAuthenticationInProgress()
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.void
noAuthenticationInProgress(HttpServerMechanismsResponder responder)
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.boolean
resumeRequest()
Resume any previously suspended request.default void
setRequestInputStreamSupplier(Supplier<InputStream> requestInputStreamSupplier)
Set the request input stream supplier.boolean
suspendRequest()
Suspend the current request so that it can be subsequently resumed.-
Methods inherited from interface org.wildfly.security.http.HttpServerScopes
getScope, getScope, getScopeIds
-
-
-
-
Method Detail
-
getRequestHeaderValues
List<String> getRequestHeaderValues(String headerName)
Get a list of all of the values set for the specified header within the HTTP request.- 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
String getFirstRequestHeaderValue(String headerName)
Get the first value for the header specified in the HTTP request.- 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
SSLSession getSSLSession()
Get theSSLSession
(if any) that has been established for the connection in use. Note that even if this is nullgetPeerCertificates()
can still return some certificates, as the certificates may have been provided to the underlying server via some external mechanism (such as headers).- Returns:
- the
SSLSession
(if any) that has been established for the connection in use, ornull
if none exists.
-
getPeerCertificates
Certificate[] getPeerCertificates()
Get the peer certificates established on the connection.- Returns:
- the peer certificates established on the connection or
null
if none available.
-
noAuthenticationInProgress
void noAuthenticationInProgress(HttpServerMechanismsResponder responder)
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
noAuthenticationInProgress
default void noAuthenticationInProgress()
Notification from the mechanism to state no authentication is in progress whilst evaluating the current request. If this form is called no challenge is expected from this mechanism.
-
authenticationInProgress
void authenticationInProgress(HttpServerMechanismsResponder responder)
Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
authenticationComplete
void authenticationComplete(HttpServerMechanismsResponder responder)
Notification that authentication is now complete. After this point the framework will perform an authorization check for the authenticated user and if successful establish the identity of the request.- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a response.
-
authenticationComplete
void authenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)
Notification that authentication is now complete.
This method behaves exactly like
{@link #authenticationComplete(HttpServerMechanismsResponder)}
, allowing mechanisms to register a logout handler which should be called when a logout request is received by the underlying container.- Parameters:
responder
- aHttpServerMechanismsResponder
that can send a response.logoutHandler
- aRunnable
that can handle logout
-
authenticationComplete
default void authenticationComplete()
Notification that authentication is now complete. After this point the framework will perform an authorization check for the authenticated user and if successful establish the identity of the request. If this form is called no response is expected from this mechanism.
-
authenticationFailed
void authenticationFailed(String message, HttpServerMechanismsResponder responder)
Notification that authentication failes.- Parameters:
message
- an error message describing the failure.responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
authenticationFailed
default void authenticationFailed(String message)
Notification that authentication failes. If this form is called no challenge is expected from this mechanism.- Parameters:
message
- an error message describing the failure.
-
badRequest
void badRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)
Notification to indicate that this was a bad request.- Parameters:
failure
- anHttpAuthenticationException
to describe the error.responder
- aHttpServerMechanismsResponder
that can send a challenge should it be required.
-
badRequest
default void badRequest(HttpAuthenticationException failure)
Notification to indicate that this was a bad request. If this form is called no challenge is expected from this mechanism.- Parameters:
failure
- anHttpAuthenticationException
to describe the error.
-
getRequestMethod
String getRequestMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Returns:
- a
String
specifying the name of the method with which this request was made
-
getRequestURI
URI getRequestURI()
Get the URI representation for the current request.- Returns:
- the URI representation for the current request.
-
getRequestPath
String getRequestPath()
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
.- Returns:
- the request path
-
getRemoteUser
default String getRemoteUser()
Returns a remotely authenticated user- Returns:
- the remote user principal or
null
if no remote user was authenticated.
-
getParameters
Map<String,List<String>> getParameters()
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.- Returns:
- the parameters received in the current request.
-
getParameterNames
Set<String> getParameterNames()
Returns the names of all parameters either from the query string or from the form data where available.- Returns:
- the names of all parameters either from the query string or from the form data where available.
-
getParameterValues
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
.- 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
String getFirstParameterValue(String name)
Get the first value for the parameter specified.- 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
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.- 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
InputStream getInputStream()
Returns the request input stream.- Returns:
- the input stream or
null
if not supported.
-
getSourceAddress
InetSocketAddress getSourceAddress()
Get the source address of the HTTP request.- Returns:
- the source address of the HTTP request
-
suspendRequest
boolean suspendRequest()
Suspend the current request so that it can be subsequently resumed.- Returns:
true
if suspending requests is supported,false
otherwise.
-
resumeRequest
boolean resumeRequest()
Resume any previously suspended request.- Returns:
true
if resuming requests is supported,false
otherwise.
-
setRequestInputStreamSupplier
default void setRequestInputStreamSupplier(Supplier<InputStream> requestInputStreamSupplier)
Set the request input stream supplier. The default implementation does nothing.- Parameters:
requestInputStreamSupplier
- the request input stream supplier
-
-