org.restlet.engine.http

## Class HttpRequest

- java.lang.Object
- - org.restlet.Message
  - - org.restlet.Request
    - - org.restlet.engine.http.HttpRequest

    public class HttpRequest
    extends Request

Request wrapper for server HTTP calls.

Author:
  Jerome Louvel

### Constructor Summary

Constructors
Constructor and Description
`HttpRequest(Context context, ServerCall httpCall)` Constructor.

### Method Summary

Methods
`boolean` `abort()` Ask the connector to attempt to abort the related network connection, for example immediately closing the socket.
`static void` `addHeader(Request request, java.lang.String headerName, java.lang.String headerValue)` Adds a new header to the given request.
`java.util.List<CacheDirective>` `getCacheDirectives()` Returns the cache directives. Note that when used with HTTP connectors, this property maps to the "Cache-Control" header.
`ChallengeResponse` `getChallengeResponse()` Returns the authentication response sent by a client to an origin server.
`ClientInfo` `getClientInfo()` Returns the client-specific information.
`Conditions` `getConditions()` Returns the condition data applying to this call.
`Series<Cookie>` `getCookies()` Returns the cookies provided by the client.
`Representation` `getEntity()` Returns the representation provided by the client.
`Series<Parameter>` `getHeaders()` Returns the HTTP headers.
`ServerCall` `getHttpCall()` Returns the low-level HTTP call.
`ChallengeResponse` `getProxyChallengeResponse()` Returns the authentication response sent by a client to a proxy.
`java.util.List<Range>` `getRanges()` Returns the ranges to return from the target resource's representation.
`java.util.List<RecipientInfo>` `getRecipientsInfo()` Returns the intermediary recipient information. Note that when used with HTTP connectors, this property maps to the "Via" headers.
`Reference` `getReferrerRef()` Returns the referrer reference if available.
`java.util.List<Warning>` `getWarnings()` Returns the additional warnings information. Note that when used with HTTP connectors, this property maps to the "Warning" headers.
`void` `setChallengeResponse(ChallengeResponse response)` Sets the authentication response sent by a client to an origin server.
`void` `setEntity(Representation entity)` Sets the entity representation.
`void` `setProxyChallengeResponse(ChallengeResponse response)` Sets the authentication response sent by a client to a proxy.
`void` `setRecipientsInfo(java.util.List<RecipientInfo> recipientsInfo)` Sets the modifiable list of intermediary recipients.
`void` `setWarnings(java.util.List<Warning> warnings)` Sets the additional warnings information.

### Methods inherited from class org.restlet.Request

`commit, getCurrent, getHostRef, getMaxForwards, getMethod, getOnResponse, getOriginalRef, getProtocol, getResourceRef, getRootRef, isConfidential, isEntityAvailable, isExpectingResponse, setClientInfo, setConditions, setCookies, setHostRef, setHostRef, setMaxForwards, setMethod, setOnResponse, setOriginalRef, setProtocol, setRanges, setReferrerRef, setReferrerRef, setResourceRef, setResourceRef, setRootRef, toString`

### Methods inherited from class org.restlet.Message

`getAttributes, getDate, getEntityAsForm, getEntityAsText, getOnSent, release, setAttributes, setCacheDirectives, setDate, setEntity, setOnSent`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### HttpRequest

    public HttpRequest(Context context,
               ServerCall httpCall)

Constructor.

Parameters:
  `context` - The context of the HTTP server connector that issued the call.
  `httpCall` - The low-level HTTP server call.

### Method Detail

#### addHeader

    public static void addHeader(Request request,
                 java.lang.String headerName,
                 java.lang.String headerValue)

Adds a new header to the given request.

Parameters:
  `request` - The request to update.
  `headerName` - The header name to add.
  `headerValue` - The header value to add.

#### abort

    public boolean abort()

Description copied from class: `Request`
Ask the connector to attempt to abort the related network connection, for example immediately closing the socket.

Overrides:
  `abort` in class `Request`
Returns:
  True if the request was aborted.

#### getCacheDirectives

    public java.util.List<CacheDirective> getCacheDirectives()

Description copied from class: `Message`
Returns the cache directives.
Note that when used with HTTP connectors, this property maps to the "Cache-Control" header.

Overrides:
  `getCacheDirectives` in class `Message`
Returns:
  The cache directives.

#### getChallengeResponse

    public ChallengeResponse getChallengeResponse()

Description copied from class: `Request`
Returns the authentication response sent by a client to an origin server. Note that when used with HTTP connectors, this property maps to the "Authorization" header.

Overrides:
  `getChallengeResponse` in class `Request`
Returns:
  The authentication response sent by a client to an origin server.

#### getClientInfo

    public ClientInfo getClientInfo()

Returns the client-specific information.

Overrides:
  `getClientInfo` in class `Request`
Returns:
  The client-specific information.

#### getConditions

    public Conditions getConditions()

Returns the condition data applying to this call.

Overrides:
  `getConditions` in class `Request`
Returns:
  The condition data applying to this call.

#### getCookies

    public Series<Cookie> getCookies()

Returns the cookies provided by the client.

Overrides:
  `getCookies` in class `Request`
Returns:
  The cookies provided by the client.

#### getEntity

    public Representation getEntity()

Returns the representation provided by the client.

Overrides:
  `getEntity` in class `Message`
Returns:
  The representation provided by the client.

#### getHeaders

    public Series<Parameter> getHeaders()

Returns the HTTP headers.

Returns:
  The HTTP headers.

#### getHttpCall

    public ServerCall getHttpCall()

Returns the low-level HTTP call.

Returns:
  The low-level HTTP call.

#### getProxyChallengeResponse

    public ChallengeResponse getProxyChallengeResponse()

Description copied from class: `Request`
Returns the authentication response sent by a client to a proxy. Note that when used with HTTP connectors, this property maps to the "Proxy-Authorization" header.

Overrides:
  `getProxyChallengeResponse` in class `Request`
Returns:
  The authentication response sent by a client to a proxy.

#### getRanges

    public java.util.List<Range> getRanges()

Description copied from class: `Request`
Returns the ranges to return from the target resource's representation. Note that when used with HTTP connectors, this property maps to the "Range" header.

Overrides:
  `getRanges` in class `Request`
Returns:
  The ranges to return.

#### getRecipientsInfo

    public java.util.List<RecipientInfo> getRecipientsInfo()

Description copied from class: `Message`
Returns the intermediary recipient information.
Note that when used with HTTP connectors, this property maps to the "Via" headers.

Overrides:
  `getRecipientsInfo` in class `Message`
Returns:
  The intermediary recipient information.

#### getReferrerRef

    public Reference getReferrerRef()

Returns the referrer reference if available.

Overrides:
  `getReferrerRef` in class `Request`
Returns:
  The referrer reference.

#### getWarnings

    public java.util.List<Warning> getWarnings()

Description copied from class: `Message`
Returns the additional warnings information.
Note that when used with HTTP connectors, this property maps to the "Warning" headers.

Overrides:
  `getWarnings` in class `Message`
Returns:
  The additional warnings information.

#### setChallengeResponse

    public void setChallengeResponse(ChallengeResponse response)

Description copied from class: `Request`
Sets the authentication response sent by a client to an origin server. Note that when used with HTTP connectors, this property maps to the "Authorization" header.

Overrides:
  `setChallengeResponse` in class `Request`
Parameters:
  `response` - The authentication response sent by a client to an origin server.

#### setEntity

    public void setEntity(Representation entity)

Description copied from class: `Message`
Sets the entity representation.

Overrides:
  `setEntity` in class `Message`
Parameters:
  `entity` - The entity representation.

#### setProxyChallengeResponse

    public void setProxyChallengeResponse(ChallengeResponse response)

Description copied from class: `Request`
Sets the authentication response sent by a client to a proxy. Note that when used with HTTP connectors, this property maps to the "Proxy-Authorization" header.

Overrides:
  `setProxyChallengeResponse` in class `Request`
Parameters:
  `response` - The authentication response sent by a client to a proxy.

#### setRecipientsInfo

    public void setRecipientsInfo(java.util.List<RecipientInfo> recipientsInfo)

Description copied from class: `Message`
Sets the modifiable list of intermediary recipients. Note that when used with HTTP connectors, this property maps to the "Via" headers. This method clears the current list and adds all entries in the parameter list.

Overrides:
  `setRecipientsInfo` in class `Message`
Parameters:
  `recipientsInfo` - A list of intermediary recipients.

#### setWarnings

    public void setWarnings(java.util.List<Warning> warnings)

Description copied from class: `Message`
Sets the additional warnings information. Note that when used with HTTP connectors, this property maps to the "Warning" headers. This method clears the current list and adds all entries in the parameter list.

Overrides:
  `setWarnings` in class `Message`
Parameters:
  `warnings` - The warnings.