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 voidauthenticationComplete()Notification that authentication is now complete.voidauthenticationComplete(HttpServerMechanismsResponder responder)Notification that authentication is now complete.voidauthenticationComplete(HttpServerMechanismsResponder responder, Runnable logoutHandler)Notification that authentication is now complete.default voidauthenticationFailed(String message)Notification that authentication failes.voidauthenticationFailed(String message, HttpServerMechanismsResponder responder)Notification that authentication failes.voidauthenticationInProgress(HttpServerMechanismsResponder responder)Notification that this mechanism has commenced but not completed authentication, typically because another challenge / response round trip is required.default voidbadRequest(HttpAuthenticationException failure)Notification to indicate that this was a bad request.voidbadRequest(HttpAuthenticationException failure, HttpServerMechanismsResponder responder)Notification to indicate that this was a bad request.List<HttpServerCookie>getCookies()Returns aListcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.StringgetFirstParameterValue(String name)Get the first value for the parameter specified.StringgetFirstRequestHeaderValue(String headerName)Get the first value for the header specified in the HTTP request.InputStreamgetInputStream()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 StringgetRemoteUser()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.StringgetRequestMethod()Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.StringgetRequestPath()Get the request path.URIgetRequestURI()Get the URI representation for the current request.InetSocketAddressgetSourceAddress()Get the source address of the HTTP request.SSLSessiongetSSLSession()Get theSSLSession(if any) that has been established for the connection in use.default voidnoAuthenticationInProgress()Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.voidnoAuthenticationInProgress(HttpServerMechanismsResponder responder)Notification from the mechanism to state no authentication is in progress whilst evaluating the current request.booleanresumeRequest()Resume any previously suspended request.booleansuspendRequest()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 notnullname 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
nullshould be returned.
-
getFirstRequestHeaderValue
String getFirstRequestHeaderValue(String headerName)
Get the first value for the header specified in the HTTP request.- Parameters:
headerName- the notnullname 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
nullshould 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, ornullif none exists.
-
getPeerCertificates
Certificate[] getPeerCertificates()
Get the peer certificates established on the connection.- Returns:
- the peer certificates established on the connection or
nullif 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- aHttpServerMechanismsResponderthat 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- aHttpServerMechanismsResponderthat 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- aHttpServerMechanismsResponderthat 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- aHttpServerMechanismsResponderthat can send a response.logoutHandler- aRunnablethat 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- aHttpServerMechanismsResponderthat 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- anHttpAuthenticationExceptionto describe the error.responder- aHttpServerMechanismsResponderthat 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- anHttpAuthenticationExceptionto 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
Stringspecifying 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-paththis 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
nullif 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 theListwill 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
nullif 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
nullif the parameter is not available.
-
getCookies
List<HttpServerCookie> getCookies()
Returns aListcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.- Returns:
- a
Listcontaining all of theHttpServerCookieobjects the client sent with this request, or an emptyListif no cookies were included in the request.
-
getInputStream
InputStream getInputStream()
Returns the request input stream.- Returns:
- the input stream or
nullif 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:
trueif suspending requests is supported,falseotherwise.
-
resumeRequest
boolean resumeRequest()
Resume any previously suspended request.- Returns:
trueif resuming requests is supported,falseotherwise.
-
-