Package org.restlet.engine.adapter
Class HttpRequest
- java.lang.Object
-
- org.restlet.Message
-
- org.restlet.Request
-
- org.restlet.engine.adapter.HttpRequest
-
public class HttpRequest extends Request
Request wrapper for server HTTP calls.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanaccessControlRequestHeadersAddedIndicates if the access control data for request headers was parsed and addedprivate booleanaccessControlRequestMethodAddedIndicates if the access control data for request methods was parsed and addedprivate booleancacheDirectivesAddedIndicates if the cache control data was parsed and added.private booleanclientAddedIndicates if the client data was parsed and added.private booleanconditionAddedIndicates if the conditions were parsed and added.private ContextcontextThe context of the HTTP server connector that issued the call.private booleancookiesAddedIndicates if the cookies were parsed and added.private booleanentityAddedIndicates if the request entity was added.private ServerCallhttpCallThe low-level HTTP call.private booleanproxySecurityAddedIndicates if the proxy security data was parsed and added.private booleanrangesAddedIndicates if the ranges data was parsed and added.private booleanrecipientsInfoAddedIndicates if the recipients info was parsed and added.private booleanreferrerAddedIndicates if the referrer was parsed and added.private booleansecurityAddedIndicates if the security data was parsed and added.private booleanwarningsAddedIndicates if the warning data was parsed and added.
-
Constructor Summary
Constructors Constructor Description HttpRequest(Context context, ServerCall httpCall)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanabort()Ask the connector to attempt to abort the related network connection, for example immediately closing the socket.static voidaddHeader(Request request, java.lang.String headerName, java.lang.String headerValue)Deprecated.UseMessage.getHeaders()directly instead.voidflushBuffers()Asks the underlying connector to immediately flush the network buffers.java.util.Set<java.lang.String>getAccessControlRequestHeaders()Returns the modifiable set of headers the client is willing to send in future request to this resource.MethodgetAccessControlRequestMethod()Returns the method the client is willing to use in future request to this resource.java.util.List<CacheDirective>getCacheDirectives()Returns the cache directives.
Note that when used with HTTP connectors, this property maps to the "Cache-Control" header.ChallengeResponsegetChallengeResponse()Returns the authentication response sent by a client to an origin server.ClientInfogetClientInfo()Returns the client-specific information.ConditionsgetConditions()Returns the condition data applying to this call.Series<Cookie>getCookies()Returns the cookies provided by the client.RepresentationgetEntity()Returns the representation provided by the client.ServerCallgetHttpCall()Returns the low-level HTTP call.ChallengeResponsegetProxyChallengeResponse()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.ReferencegetReferrerRef()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.voidsetAccessControlRequestHeaders(java.util.Set<java.lang.String> accessControlRequestHeaders)Sets the set of headers the client is willing to use in future request to this resource.voidsetAccessControlRequestMethod(Method accessControlRequestMethod)Sets the method the client is willing to use in future request to this resource.voidsetChallengeResponse(ChallengeResponse response)Sets the authentication response sent by a client to an origin server.voidsetEntity(Representation entity)Sets the entity representation.voidsetProxyChallengeResponse(ChallengeResponse response)Sets the authentication response sent by a client to a proxy.voidsetRecipientsInfo(java.util.List<RecipientInfo> recipientsInfo)Sets the modifiable list of intermediary recipients.voidsetWarnings(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, isAsynchronous, isConfidential, isEntityAvailable, isExpectingResponse, isLoggable, isSynchronous, setClientInfo, setConditions, setCookies, setHostRef, setHostRef, setLoggable, setMaxForwards, setMethod, setOnResponse, setOriginalRef, setProtocol, setRanges, setReferrerRef, setReferrerRef, setResourceRef, setResourceRef, setRootRef, toString
-
Methods inherited from class org.restlet.Message
bufferEntity, getAttributes, getDate, getEntityAsText, getHeaders, getOnError, getOnSent, release, setAttributes, setCacheDirectives, setDate, setEntity, setOnError, setOnSent
-
-
-
-
Field Detail
-
accessControlRequestHeadersAdded
private volatile boolean accessControlRequestHeadersAdded
Indicates if the access control data for request headers was parsed and added
-
accessControlRequestMethodAdded
private volatile boolean accessControlRequestMethodAdded
Indicates if the access control data for request methods was parsed and added
-
cacheDirectivesAdded
private volatile boolean cacheDirectivesAdded
Indicates if the cache control data was parsed and added.
-
clientAdded
private volatile boolean clientAdded
Indicates if the client data was parsed and added.
-
conditionAdded
private volatile boolean conditionAdded
Indicates if the conditions were parsed and added.
-
context
private volatile Context context
The context of the HTTP server connector that issued the call.
-
cookiesAdded
private volatile boolean cookiesAdded
Indicates if the cookies were parsed and added.
-
entityAdded
private volatile boolean entityAdded
Indicates if the request entity was added.
-
httpCall
private volatile ServerCall httpCall
The low-level HTTP call.
-
proxySecurityAdded
private volatile boolean proxySecurityAdded
Indicates if the proxy security data was parsed and added.
-
rangesAdded
private volatile boolean rangesAdded
Indicates if the ranges data was parsed and added.
-
recipientsInfoAdded
private volatile boolean recipientsInfoAdded
Indicates if the recipients info was parsed and added.
-
referrerAdded
private volatile boolean referrerAdded
Indicates if the referrer was parsed and added.
-
securityAdded
private volatile boolean securityAdded
Indicates if the security data was parsed and added.
-
warningsAdded
private volatile boolean warningsAdded
Indicates if the warning data was parsed and added.
-
-
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
@Deprecated public static void addHeader(Request request, java.lang.String headerName, java.lang.String headerValue)
Deprecated.UseMessage.getHeaders()directly instead.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:RequestAsk the connector to attempt to abort the related network connection, for example immediately closing the socket.
-
flushBuffers
public void flushBuffers() throws java.io.IOExceptionDescription copied from class:MessageAsks the underlying connector to immediately flush the network buffers.- Overrides:
flushBuffersin classMessage- Throws:
java.io.IOException
-
getAccessControlRequestHeaders
public java.util.Set<java.lang.String> getAccessControlRequestHeaders()
Description copied from class:RequestReturns the modifiable set of headers the client is willing to send in future request to this resource. Used when issuing a preflight CORS request to let the origin server knows what headers will be sent later.
Note that when used with HTTP connectors, this property maps to the "Access-Control-Allow-Headers" header.- Overrides:
getAccessControlRequestHeadersin classRequest- Returns:
- The headers the client is willing to send in future request to this resource. Useful for CORS support.
-
getAccessControlRequestMethod
public Method getAccessControlRequestMethod()
Description copied from class:RequestReturns the method the client is willing to use in future request to this resource. Used when issuing a preflight CORS request to let the origin server knows what method will be sent later.
Note that when used with HTTP connectors, this property maps to the "Access-Control-Request-Method" header.- Overrides:
getAccessControlRequestMethodin classRequest- Returns:
- The method the client is willing to send in future request to this resource. Useful for CORS support.
-
getCacheDirectives
public java.util.List<CacheDirective> getCacheDirectives()
Description copied from class:MessageReturns the cache directives.
Note that when used with HTTP connectors, this property maps to the "Cache-Control" header.- Overrides:
getCacheDirectivesin classMessage- Returns:
- The cache directives.
-
getChallengeResponse
public ChallengeResponse getChallengeResponse()
Description copied from class:RequestReturns 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:
getChallengeResponsein classRequest- Returns:
- The authentication response sent by a client to an origin server.
-
getClientInfo
public ClientInfo getClientInfo()
Returns the client-specific information.- Overrides:
getClientInfoin classRequest- Returns:
- The client-specific information.
-
getConditions
public Conditions getConditions()
Returns the condition data applying to this call.- Overrides:
getConditionsin classRequest- Returns:
- The condition data applying to this call.
-
getCookies
public Series<Cookie> getCookies()
Returns the cookies provided by the client.- Overrides:
getCookiesin classRequest- Returns:
- The cookies provided by the client.
-
getEntity
public Representation getEntity()
Returns the representation provided by the client.
-
getHttpCall
public ServerCall getHttpCall()
Returns the low-level HTTP call.- Returns:
- The low-level HTTP call.
-
getProxyChallengeResponse
public ChallengeResponse getProxyChallengeResponse()
Description copied from class:RequestReturns 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:
getProxyChallengeResponsein classRequest- Returns:
- The authentication response sent by a client to a proxy.
-
getRanges
public java.util.List<Range> getRanges()
Description copied from class:RequestReturns the ranges to return from the target resource's representation. Note that when used with HTTP connectors, this property maps to the "Range" header.
-
getRecipientsInfo
public java.util.List<RecipientInfo> getRecipientsInfo()
Description copied from class:MessageReturns the intermediary recipient information.
Note that when used with HTTP connectors, this property maps to the "Via" headers.- Overrides:
getRecipientsInfoin classMessage- Returns:
- The intermediary recipient information.
-
getReferrerRef
public Reference getReferrerRef()
Returns the referrer reference if available.- Overrides:
getReferrerRefin classRequest- Returns:
- The referrer reference.
-
getWarnings
public java.util.List<Warning> getWarnings()
Description copied from class:MessageReturns the additional warnings information.
Note that when used with HTTP connectors, this property maps to the "Warning" headers.- Overrides:
getWarningsin classMessage- Returns:
- The additional warnings information.
-
setAccessControlRequestHeaders
public void setAccessControlRequestHeaders(java.util.Set<java.lang.String> accessControlRequestHeaders)
Description copied from class:RequestSets the set of headers the client is willing to use in future request to this resource. Used when issuing a preflight CORS request to let the origin server knows what headers will be sent later.
Note that when used with HTTP connectors, this property maps to the "Access-Control-Request-Method" header.- Overrides:
setAccessControlRequestHeadersin classRequest- Parameters:
accessControlRequestHeaders- The set of headers the client is willing to send in future request to this resource. Useful for CORS support.
-
setAccessControlRequestMethod
public void setAccessControlRequestMethod(Method accessControlRequestMethod)
Description copied from class:RequestSets the method the client is willing to use in future request to this resource. Used when issuing a preflight CORS request to let the origin server knows what method will be sent later.
Note that when used with HTTP connectors, this property maps to the "Access-Control-Request-Method" header.- Overrides:
setAccessControlRequestMethodin classRequest- Parameters:
accessControlRequestMethod- The method the client is willing to send in future request to this resource. Useful for CORS support.
-
setChallengeResponse
public void setChallengeResponse(ChallengeResponse response)
Description copied from class:RequestSets 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:
setChallengeResponsein classRequest- Parameters:
response- The authentication response sent by a client to an origin server.
-
setEntity
public void setEntity(Representation entity)
Description copied from class:MessageSets the entity representation.
-
setProxyChallengeResponse
public void setProxyChallengeResponse(ChallengeResponse response)
Description copied from class:RequestSets 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:
setProxyChallengeResponsein classRequest- 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:MessageSets 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:
setRecipientsInfoin classMessage- Parameters:
recipientsInfo- A list of intermediary recipients.
-
setWarnings
public void setWarnings(java.util.List<Warning> warnings)
Description copied from class:MessageSets 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:
setWarningsin classMessage- Parameters:
warnings- The warnings.
-
-