Package org.restlet.util
Class WrapperRequest
java.lang.Object
org.restlet.Message
org.restlet.Request
org.restlet.util.WrapperRequest
Request wrapper. Useful for application developer who need to enrich the
request with application related properties and behavior.
- Author:
- Jerome Louvel
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanabort()Ask the connector to attempt to abort the related network connection, for example immediately closing the socket.voidAsks the server connector to immediately commit the given response associated to this request, making it ready to be sent back to the client.Returns the access control request headers of the target resource.Returns the access control request method of the target resource.Returns a modifiable attributes map that can be used by developers to save information relative to the message.Returns the authentication response sent by a client to an origin server.Returns the client-specific information.Returns the conditions applying to this call.Returns the cookies provided by the client.Returns the entity representation.Returns the host reference.intReturns the maximum number of intermediaries.Returns the method.Returns the callback invoked on response reception.Returns the original reference as requested by the client.Returns the protocol by first returning the baseRef.schemeProtocol property if it is set, or the resourceRef.schemeProtocol property otherwise.Returns the authentication response sent by a client to a proxy.Returns the ranges to return from the target resource's representation.Returns the referrer reference if available.Returns the reference of the target resource.Returns the application root reference.protected RequestReturns the wrapped request.booleanIndicates if the request is asynchronous.booleanIndicates if the call came over a confidential channel such as an SSL-secured connection.booleanIndicates if a content is available and can be sent.booleanIndicates if an associated response is expected.booleanIndicates if the request is synchronous.voidsetAccessControlRequestHeaders(Set<String> accessControlRequestHeaders) Sets the access control request headers of the target resource.voidsetAccessControlRequestMethod(Method accessControlRequestMethod) Sets the access control request method of the target resource.voidsetChallengeResponse(ChallengeResponse response) Sets the authentication response sent by a client to an origin server.voidsetClientInfo(ClientInfo clientInfo) Sets the client-specific information.voidsetConditions(Conditions conditions) Sets the conditions applying to this request.voidsetCookies(Series<Cookie> cookies) Sets the modifiable series of cookies provided by the client.voidSets a textual entity.voidsetEntity(Representation entity) Sets the entity representation.voidsetHostRef(String hostUri) Sets the host reference using an URI string.voidsetHostRef(Reference hostRef) Sets the host reference.voidsetMaxForwards(int maxForwards) Sets the maximum number of intermediaries.voidSets the method called.voidsetOnResponse(Uniform onResponseCallback) Sets the callback invoked on response reception.voidsetOriginalRef(Reference originalRef) Sets the original reference requested by the client.voidsetProtocol(Protocol protocol) Sets the protocol used or to be used.voidsetProxyChallengeResponse(ChallengeResponse response) Sets the authentication response sent by a client to a proxy.voidSets the modifiable list of ranges to return from the target resource's representation.voidsetReferrerRef(String referrerUri) Sets the referrer reference if available using an URI string.voidsetReferrerRef(Reference referrerRef) Sets the referrer reference if available.voidsetResourceRef(String resourceUri) Sets the target resource reference using an URI string.voidsetResourceRef(Reference resourceRef) Sets the target resource reference.voidsetRootRef(Reference rootRef) Sets the application root reference.toString()Displays a synthesis of the request like an HTTP request line.Methods inherited from class org.restlet.Request
getCurrent, isLoggable, setLoggableMethods inherited from class org.restlet.Message
bufferEntity, flushBuffers, getCacheDirectives, getDate, getEntityAsText, getHeaders, getOnError, getOnSent, getRecipientsInfo, getWarnings, release, setAttributes, setCacheDirectives, setDate, setOnError, setOnSent, setRecipientsInfo, setWarnings
-
Constructor Details
-
WrapperRequest
Constructor.- Parameters:
wrappedRequest- The wrapped request.
-
-
Method Details
-
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. -
commit
Description copied from class:RequestAsks the server connector to immediately commit the given response associated to this request, making it ready to be sent back to the client. Note that all server connectors don't necessarily support this feature. -
getAttributes
Returns a modifiable attributes map that can be used by developers to save information relative to the message. This is an easier alternative to the creation of a wrapper instance around the whole message.
In addition, this map is a shared space between the developer and the connectors. In this case, it is used to exchange information that is not uniform across all protocols and couldn't therefore be directly included in the API. For this purpose, all attribute names starting with "org.restlet" are reserved. Currently the following attributes are used:
Adding standard HTTP headers is forbidden because it could conflict with the connector's internal behavior, limit portability or prevent future optimizations.list of supported attributes Attribute name Class name Description org.restlet.http.headers org.restlet.data.Form Server HTTP connectors must provide all request headers and client HTTP connectors must provide all response headers, exactly as they were received. In addition, developers can also use this attribute to specify non-standard headers that should be added to the request or to the response. - Overrides:
getAttributesin classMessage- Returns:
- The modifiable attributes map.
-
getChallengeResponse
Returns the authentication response sent by a client to an origin server.- Overrides:
getChallengeResponsein classRequest- Returns:
- The authentication response sent by a client to an origin server.
-
getClientInfo
Returns the client-specific information.- Overrides:
getClientInfoin classRequest- Returns:
- The client-specific information.
-
getConditions
Returns the conditions applying to this call.- Overrides:
getConditionsin classRequest- Returns:
- The conditions applying to this call.
-
getCookies
Returns the cookies provided by the client.- Overrides:
getCookiesin classRequest- Returns:
- The cookies provided by the client.
-
getEntity
Returns the entity representation. -
getHostRef
Returns the host reference. This may be different from the resourceRef's host, for example for URNs and other URIs that don't contain host information.- Overrides:
getHostRefin classRequest- Returns:
- The host reference.
-
getMaxForwards
public int getMaxForwards()Description copied from class:RequestReturns the maximum number of intermediaries.- Overrides:
getMaxForwardsin classRequest- Returns:
- The maximum number of intermediaries.
-
getMethod
Returns the method. -
getOnResponse
Description copied from class:RequestReturns the callback invoked on response reception. If the value is not null, then the associated request will be executed asynchronously.- Overrides:
getOnResponsein classRequest- Returns:
- The callback invoked on response reception.
-
getOriginalRef
Description copied from class:RequestReturns the original reference as requested by the client. Note that this property is not used during request routing. See theRequest.getResourceRef()method for details.- Overrides:
getOriginalRefin classRequest- Returns:
- The original reference.
- See Also:
-
getProtocol
Returns the protocol by first returning the baseRef.schemeProtocol property if it is set, or the resourceRef.schemeProtocol property otherwise.- Overrides:
getProtocolin classRequest- Returns:
- The protocol or null if not available.
-
getProxyChallengeResponse
Returns the authentication response sent by a client to a proxy.- Overrides:
getProxyChallengeResponsein classRequest- Returns:
- The authentication response sent by a client to a proxy.
-
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. -
getReferrerRef
Returns the referrer reference if available.- Overrides:
getReferrerRefin classRequest- Returns:
- The referrer reference.
-
getResourceRef
Returns the reference of the target resource.- Overrides:
getResourceRefin classRequest- Returns:
- The reference of the target resource.
- See Also:
-
getRootRef
Returns the application root reference.- Overrides:
getRootRefin classRequest- Returns:
- The application root reference.
-
getWrappedRequest
Returns the wrapped request.- Returns:
- The wrapped request.
-
getAccessControlRequestHeaders
Returns the access control request headers of the target resource.- Overrides:
getAccessControlRequestHeadersin classRequest- Returns:
- The access control request headers of the target resource.
-
getAccessControlRequestMethod
Returns the access control request method of the target resource.- Overrides:
getAccessControlRequestMethodin classRequest- Returns:
- The access control request method of the target resource.
-
isAsynchronous
public boolean isAsynchronous()Description copied from class:RequestIndicates if the request is asynchronous. The test consist in verifying that theRequest.getOnResponse()method returns a callback object.- Overrides:
isAsynchronousin classRequest- Returns:
- True if the request is synchronous.
-
isConfidential
public boolean isConfidential()Indicates if the call came over a confidential channel such as an SSL-secured connection.- Overrides:
isConfidentialin classRequest- Returns:
- True if the call came over a confidential channel.
-
isEntityAvailable
public boolean isEntityAvailable()Indicates if a content is available and can be sent. Several conditions must be met: the method must allow the sending of content, the content must exists and have some available data.- Overrides:
isEntityAvailablein classRequest- Returns:
- True if a content is available and can be sent.
-
isExpectingResponse
public boolean isExpectingResponse()Description copied from class:RequestIndicates if an associated response is expected.- Overrides:
isExpectingResponsein classRequest- Returns:
- True if an associated response is expected.
-
isSynchronous
public boolean isSynchronous()Description copied from class:RequestIndicates if the request is synchronous. The test consist in verifying that theRequest.getOnResponse()method returns null.- Overrides:
isSynchronousin classRequest- Returns:
- True if the request is synchronous.
-
setChallengeResponse
Sets the authentication response sent by a client to an origin server.- Overrides:
setChallengeResponsein classRequest- Parameters:
response- The authentication response sent by a client to an origin server.
-
setClientInfo
Description copied from class:RequestSets the client-specific information.- Overrides:
setClientInfoin classRequest- Parameters:
clientInfo- The client-specific information.
-
setConditions
Description copied from class:RequestSets the conditions applying to this request.- Overrides:
setConditionsin classRequest- Parameters:
conditions- The conditions applying to this request.
-
setCookies
Description copied from class:RequestSets the modifiable series of cookies provided by the client. Note that when used with HTTP connectors, this property maps to the "Cookie" header. This method clears the current series and adds all entries in the parameter series.- Overrides:
setCookiesin classRequest- Parameters:
cookies- A series of cookies provided by the client.
-
setEntity
Sets the entity representation. -
setEntity
Sets a textual entity. -
setHostRef
Sets the host reference.- Overrides:
setHostRefin classRequest- Parameters:
hostRef- The host reference.
-
setHostRef
Sets the host reference using an URI string.- Overrides:
setHostRefin classRequest- Parameters:
hostUri- The host URI.
-
setMaxForwards
public void setMaxForwards(int maxForwards) Description copied from class:RequestSets the maximum number of intermediaries.- Overrides:
setMaxForwardsin classRequest- Parameters:
maxForwards- The maximum number of intermediaries.
-
setMethod
Sets the method called. -
setOnResponse
Description copied from class:RequestSets the callback invoked on response reception. If the value is not null, then the associated request will be executed asynchronously.- Overrides:
setOnResponsein classRequest- Parameters:
onResponseCallback- The callback invoked on response reception.
-
setOriginalRef
Description copied from class:RequestSets the original reference requested by the client.- Overrides:
setOriginalRefin classRequest- Parameters:
originalRef- The original reference.- See Also:
-
setProtocol
Description copied from class:RequestSets the protocol used or to be used.- Overrides:
setProtocolin classRequest- Parameters:
protocol- The protocol used or to be used.
-
setProxyChallengeResponse
Sets the authentication response sent by a client to a proxy.- Overrides:
setProxyChallengeResponsein classRequest- Parameters:
response- The authentication response sent by a client to a proxy.
-
setRanges
Description copied from class:RequestSets the modifiable list of ranges to return from the target resource's representation. Note that when used with HTTP connectors, this property maps to the "Range" header. This method clears the current list and adds all entries in the parameter list. -
setReferrerRef
Sets the referrer reference if available.- Overrides:
setReferrerRefin classRequest- Parameters:
referrerRef- The referrer reference.
-
setReferrerRef
Sets the referrer reference if available using an URI string.- Overrides:
setReferrerRefin classRequest- Parameters:
referrerUri- The referrer URI.- See Also:
-
setResourceRef
Sets the target resource reference. If the reference is relative, it will be resolved as an absolute reference. Also, the context's base reference will be reset. Finally, the reference will be normalized to ensure a consistent handling of the call.- Overrides:
setResourceRefin classRequest- Parameters:
resourceRef- The resource reference.- See Also:
-
setResourceRef
Sets the target resource reference using an URI string. Note that the URI can be either absolute or relative to the context's base reference.- Overrides:
setResourceRefin classRequest- Parameters:
resourceUri- The resource URI.- See Also:
-
setRootRef
Sets the application root reference.- Overrides:
setRootRefin classRequest- Parameters:
rootRef- The application root reference.
-
setAccessControlRequestHeaders
Sets the access control request headers of the target resource.- Overrides:
setAccessControlRequestHeadersin classRequest- Parameters:
accessControlRequestHeaders- The access control request headers of the target resource.
-
setAccessControlRequestMethod
Sets the access control request method of the target resource.- Overrides:
setAccessControlRequestMethodin classRequest- Parameters:
accessControlRequestMethod- The access control request method of the target resource.
-
toString
Description copied from class:RequestDisplays a synthesis of the request like an HTTP request line.
-