com.sun.ws.rest.api.core
Interface HttpRequestContext

All Superinterfaces:
javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.Request, javax.ws.rs.core.SecurityContext
All Known Subinterfaces:
ContainerRequest
All Known Implementing Classes:
AbstractContainerRequest

public interface HttpRequestContext
extends javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.Request, javax.ws.rs.core.SecurityContext

An abstraction for a HTTP request


Field Summary
 
Fields inherited from interface javax.ws.rs.core.SecurityContext
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Method Summary
 java.net.URI getAbsolutePath()
          Get the absolute path URI of the request.
 javax.ws.rs.core.MediaType getAcceptableMediaType(java.util.List<javax.ws.rs.core.MediaType> mediaTypes)
          Select the first media type, from a list of media types, that is most acceptable according to the requested acceptable media types.
 java.net.URI getBaseUri()
          Get the base URI of the request.
 javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> getCookieNameValueMap()
          Get the cookie name value map.
<T> T
getEntity(java.lang.Class<T> type)
          Get the request entity, returns null if the request does not contain an entity body.
<T> T
getEntity(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] as)
          Get the request entity, returns null if the request does not contain an entity body.
 java.lang.String getHeaderValue(java.lang.String name)
          Get a HTTP header value.
 java.lang.String getHttpMethod()
          Get the HTTP method name
 java.net.URI getRequestUri()
          Get the (complete) request URI.
 
Methods inherited from interface javax.ws.rs.core.HttpHeaders
getAcceptableMediaTypes, getCookies, getLanguage, getMediaType, getRequestHeaders
 
Methods inherited from interface javax.ws.rs.core.Request
evaluatePreconditions, evaluatePreconditions, evaluatePreconditions, selectVariant
 
Methods inherited from interface javax.ws.rs.core.SecurityContext
getAuthenticationScheme, getUserPrincipal, isSecure, isUserInRole
 

Method Detail

getBaseUri

java.net.URI getBaseUri()
Get the base URI of the request.

Returns:
the base URI.

getRequestUri

java.net.URI getRequestUri()
Get the (complete) request URI.

Returns:
the request URI.

getAbsolutePath

java.net.URI getAbsolutePath()
Get the absolute path URI of the request.

Returns:
the absolute URI.

getHeaderValue

java.lang.String getHeaderValue(java.lang.String name)
Get a HTTP header value.

Parameters:
name - the HTTP header
Returns:
the HTTP header value. If the HTTP header is not present then null is returned. If the HTTP header is present but has no value then the empty string is returned. If the HTTP header is present more than once then the values of joined together and separated by a ',' character.

getAcceptableMediaType

javax.ws.rs.core.MediaType getAcceptableMediaType(java.util.List<javax.ws.rs.core.MediaType> mediaTypes)
Select the first media type, from a list of media types, that is most acceptable according to the requested acceptable media types.

Parameters:
mediaTypes - the list of media types
Returns:
the most acceptable media type, or null if no media type was found to be acceptable.

getEntity

<T> T getEntity(java.lang.Class<T> type)
            throws javax.ws.rs.WebApplicationException
Get the request entity, returns null if the request does not contain an entity body.

Parameters:
type - the type of entity
Returns:
the request entity or null
Throws:
javax.ws.rs.WebApplicationException - if the content of the request cannot be mapped to an entity of the requested type

getEntity

<T> T getEntity(java.lang.Class<T> type,
                java.lang.reflect.Type genericType,
                java.lang.annotation.Annotation[] as)
            throws javax.ws.rs.WebApplicationException
Get the request entity, returns null if the request does not contain an entity body.

Parameters:
type - the type of entity
generic - type the generic type of entity, it is the responsibility of the callee to ensure that the type and generic type are consistent otherwise the behvaiour of this method is undefned.
as - the annoations associated with the type
Returns:
the request entity or null
Throws:
javax.ws.rs.WebApplicationException - if the content of the request cannot be mapped to an entity of the requested type

getHttpMethod

java.lang.String getHttpMethod()
Get the HTTP method name

Returns:
the method name as a String

getCookieNameValueMap

javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> getCookieNameValueMap()
Get the cookie name value map.

Returns:
the cookie bame value map.