Package org.restlet.util
Class WrapperRequest
- java.lang.Object
- 
- org.restlet.Message
- 
- org.restlet.Request
- 
- org.restlet.util.WrapperRequest
 
 
 
- 
 public class WrapperRequest extends Request Request wrapper. Useful for application developer who need to enrich the request with application related properties and behavior.- Author:
- Jerome Louvel
- See Also:
- The decorator (aka wrapper) pattern
 
- 
- 
Constructor SummaryConstructors Constructor Description WrapperRequest(Request wrappedRequest)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabort()Ask the connector to attempt to abort the related network connection, for example immediately closing the socket.voidcommit(Response response)Asks the server connector to immediately commit the given response associated to this request, making it ready to be sent back to the client.java.util.Set<java.lang.String>getAccessControlRequestHeaders()Returns the access control request headers of the target resource.MethodgetAccessControlRequestMethod()Returns the access control request method of the target resource.java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object>getAttributes()Returns a modifiable attributes map that can be used by developers to save information relative to the message.ChallengeResponsegetChallengeResponse()Returns the authentication response sent by a client to an origin server.ClientInfogetClientInfo()Returns the client-specific information.ConditionsgetConditions()Returns the conditions applying to this call.Series<Cookie>getCookies()Returns the cookies provided by the client.RepresentationgetEntity()Returns the entity representation.ReferencegetHostRef()Returns the host reference.intgetMaxForwards()Returns the maximum number of intermediaries.MethodgetMethod()Returns the method.UniformgetOnResponse()Returns the callback invoked on response reception.ReferencegetOriginalRef()Returns the original reference as requested by the client.ProtocolgetProtocol()Returns the protocol by first returning the baseRef.schemeProtocol property if it is set, or the resourceRef.schemeProtocol property otherwise.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.ReferencegetReferrerRef()Returns the referrer reference if available.ReferencegetResourceRef()Returns the reference of the target resource.ReferencegetRootRef()Returns the application root reference.protected RequestgetWrappedRequest()Returns the wrapped request.booleanisAsynchronous()Indicates if the request is asynchronous.booleanisConfidential()Indicates if the call came over a confidential channel such as an SSL-secured connection.booleanisEntityAvailable()Indicates if a content is available and can be sent.booleanisExpectingResponse()Indicates if an associated response is expected.booleanisSynchronous()Indicates if the request is synchronous.voidsetAccessControlRequestHeaders(java.util.Set<java.lang.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.voidsetEntity(java.lang.String value, MediaType mediaType)Sets a textual entity.voidsetEntity(Representation entity)Sets the entity representation.voidsetHostRef(java.lang.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.voidsetMethod(Method method)Sets 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.voidsetRanges(java.util.List<Range> ranges)Sets the modifiable list of ranges to return from the target resource's representation.voidsetReferrerRef(java.lang.String referrerUri)Sets the referrer reference if available using an URI string.voidsetReferrerRef(Reference referrerRef)Sets the referrer reference if available.voidsetResourceRef(java.lang.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.java.lang.StringtoString()Displays a synthesis of the request like an HTTP request line.- 
Methods inherited from class org.restlet.RequestgetCurrent, isLoggable, setLoggable
 - 
Methods inherited from class org.restlet.MessagebufferEntity, flushBuffers, getCacheDirectives, getDate, getEntityAsText, getHeaders, getOnError, getOnSent, getRecipientsInfo, getWarnings, release, setAttributes, setCacheDirectives, setDate, setOnError, setOnSent, setRecipientsInfo, setWarnings
 
- 
 
- 
- 
- 
Constructor Detail- 
WrapperRequestpublic WrapperRequest(Request wrappedRequest) Constructor.- Parameters:
- wrappedRequest- The wrapped request.
 
 
- 
 - 
Method Detail- 
abortpublic boolean abort() Description copied from class:RequestAsk the connector to attempt to abort the related network connection, for example immediately closing the socket.
 - 
commitpublic void commit(Response response) 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.
 - 
getAttributespublic java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> 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 class- Message
- Returns:
- The modifiable attributes map.
 
 - 
getChallengeResponsepublic ChallengeResponse getChallengeResponse() Returns the authentication response sent by a client to an origin server.- Overrides:
- getChallengeResponsein class- Request
- Returns:
- The authentication response sent by a client to an origin server.
 
 - 
getClientInfopublic ClientInfo getClientInfo() Returns the client-specific information.- Overrides:
- getClientInfoin class- Request
- Returns:
- The client-specific information.
 
 - 
getConditionspublic Conditions getConditions() Returns the conditions applying to this call.- Overrides:
- getConditionsin class- Request
- Returns:
- The conditions applying to this call.
 
 - 
getCookiespublic Series<Cookie> getCookies() Returns the cookies provided by the client.- Overrides:
- getCookiesin class- Request
- Returns:
- The cookies provided by the client.
 
 - 
getEntitypublic Representation getEntity() Returns the entity representation.
 - 
getHostRefpublic Reference 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 class- Request
- Returns:
- The host reference.
 
 - 
getMaxForwardspublic int getMaxForwards() Description copied from class:RequestReturns the maximum number of intermediaries.- Overrides:
- getMaxForwardsin class- Request
- Returns:
- The maximum number of intermediaries.
 
 - 
getMethodpublic Method getMethod() Returns the method.
 - 
getOnResponsepublic Uniform 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 class- Request
- Returns:
- The callback invoked on response reception.
 
 - 
getOriginalRefpublic Reference 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 class- Request
- Returns:
- The original reference.
- See Also:
- Request.getResourceRef()
 
 - 
getProtocolpublic Protocol getProtocol() Returns the protocol by first returning the baseRef.schemeProtocol property if it is set, or the resourceRef.schemeProtocol property otherwise.- Overrides:
- getProtocolin class- Request
- Returns:
- The protocol or null if not available.
 
 - 
getProxyChallengeResponsepublic ChallengeResponse getProxyChallengeResponse() Returns the authentication response sent by a client to a proxy.- Overrides:
- getProxyChallengeResponsein class- Request
- Returns:
- The authentication response sent by a client to a proxy.
 
 - 
getRangespublic 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.
 - 
getReferrerRefpublic Reference getReferrerRef() Returns the referrer reference if available.- Overrides:
- getReferrerRefin class- Request
- Returns:
- The referrer reference.
 
 - 
getResourceRefpublic Reference getResourceRef() Returns the reference of the target resource.- Overrides:
- getResourceRefin class- Request
- Returns:
- The reference of the target resource.
- See Also:
- Request.getOriginalRef(),- Request.getHostRef()
 
 - 
getRootRefpublic Reference getRootRef() Returns the application root reference.- Overrides:
- getRootRefin class- Request
- Returns:
- The application root reference.
 
 - 
getWrappedRequestprotected Request getWrappedRequest() Returns the wrapped request.- Returns:
- The wrapped request.
 
 - 
getAccessControlRequestHeaderspublic java.util.Set<java.lang.String> getAccessControlRequestHeaders() Returns the access control request headers of the target resource.- Overrides:
- getAccessControlRequestHeadersin class- Request
- Returns:
- The access control request headers of the target resource.
 
 - 
getAccessControlRequestMethodpublic Method getAccessControlRequestMethod() Returns the access control request method of the target resource.- Overrides:
- getAccessControlRequestMethodin class- Request
- Returns:
- The access control request method of the target resource.
 
 - 
isAsynchronouspublic 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 class- Request
- Returns:
- True if the request is synchronous.
 
 - 
isConfidentialpublic boolean isConfidential() Indicates if the call came over a confidential channel such as an SSL-secured connection.- Overrides:
- isConfidentialin class- Request
- Returns:
- True if the call came over a confidential channel.
 
 - 
isEntityAvailablepublic 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 class- Request
- Returns:
- True if a content is available and can be sent.
 
 - 
isExpectingResponsepublic boolean isExpectingResponse() Description copied from class:RequestIndicates if an associated response is expected.- Overrides:
- isExpectingResponsein class- Request
- Returns:
- True if an associated response is expected.
 
 - 
isSynchronouspublic 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 class- Request
- Returns:
- True if the request is synchronous.
 
 - 
setChallengeResponsepublic void setChallengeResponse(ChallengeResponse response) Sets the authentication response sent by a client to an origin server.- Overrides:
- setChallengeResponsein class- Request
- Parameters:
- response- The authentication response sent by a client to an origin server.
 
 - 
setClientInfopublic void setClientInfo(ClientInfo clientInfo) Description copied from class:RequestSets the client-specific information.- Overrides:
- setClientInfoin class- Request
- Parameters:
- clientInfo- The client-specific information.
 
 - 
setConditionspublic void setConditions(Conditions conditions) Description copied from class:RequestSets the conditions applying to this request.- Overrides:
- setConditionsin class- Request
- Parameters:
- conditions- The conditions applying to this request.
 
 - 
setCookiespublic void setCookies(Series<Cookie> cookies) 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 class- Request
- Parameters:
- cookies- A series of cookies provided by the client.
 
 - 
setEntitypublic void setEntity(Representation entity) Sets the entity representation.
 - 
setEntitypublic void setEntity(java.lang.String value, MediaType mediaType)Sets a textual entity.
 - 
setHostRefpublic void setHostRef(Reference hostRef) Sets the host reference.- Overrides:
- setHostRefin class- Request
- Parameters:
- hostRef- The host reference.
 
 - 
setHostRefpublic void setHostRef(java.lang.String hostUri) Sets the host reference using an URI string.- Overrides:
- setHostRefin class- Request
- Parameters:
- hostUri- The host URI.
 
 - 
setMaxForwardspublic void setMaxForwards(int maxForwards) Description copied from class:RequestSets the maximum number of intermediaries.- Overrides:
- setMaxForwardsin class- Request
- Parameters:
- maxForwards- The maximum number of intermediaries.
 
 - 
setMethodpublic void setMethod(Method method) Sets the method called.
 - 
setOnResponsepublic void setOnResponse(Uniform onResponseCallback) 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 class- Request
- Parameters:
- onResponseCallback- The callback invoked on response reception.
 
 - 
setOriginalRefpublic void setOriginalRef(Reference originalRef) Description copied from class:RequestSets the original reference requested by the client.- Overrides:
- setOriginalRefin class- Request
- Parameters:
- originalRef- The original reference.
- See Also:
- Request.getOriginalRef()
 
 - 
setProtocolpublic void setProtocol(Protocol protocol) Description copied from class:RequestSets the protocol used or to be used.- Overrides:
- setProtocolin class- Request
- Parameters:
- protocol- The protocol used or to be used.
 
 - 
setProxyChallengeResponsepublic void setProxyChallengeResponse(ChallengeResponse response) Sets the authentication response sent by a client to a proxy.- Overrides:
- setProxyChallengeResponsein class- Request
- Parameters:
- response- The authentication response sent by a client to a proxy.
 
 - 
setRangespublic void setRanges(java.util.List<Range> ranges) 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.
 - 
setReferrerRefpublic void setReferrerRef(Reference referrerRef) Sets the referrer reference if available.- Overrides:
- setReferrerRefin class- Request
- Parameters:
- referrerRef- The referrer reference.
 
 - 
setReferrerRefpublic void setReferrerRef(java.lang.String referrerUri) Sets the referrer reference if available using an URI string.- Overrides:
- setReferrerRefin class- Request
- Parameters:
- referrerUri- The referrer URI.
- See Also:
- Request.setReferrerRef(Reference)
 
 - 
setResourceRefpublic void setResourceRef(Reference resourceRef) 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 class- Request
- Parameters:
- resourceRef- The resource reference.
- See Also:
- Request.getResourceRef()
 
 - 
setResourceRefpublic void setResourceRef(java.lang.String resourceUri) 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 class- Request
- Parameters:
- resourceUri- The resource URI.
- See Also:
- Request.setResourceRef(Reference)
 
 - 
setRootRefpublic void setRootRef(Reference rootRef) Sets the application root reference.- Overrides:
- setRootRefin class- Request
- Parameters:
- rootRef- The application root reference.
 
 - 
setAccessControlRequestHeaderspublic void setAccessControlRequestHeaders(java.util.Set<java.lang.String> accessControlRequestHeaders) Sets the access control request headers of the target resource.- Overrides:
- setAccessControlRequestHeadersin class- Request
- Parameters:
- accessControlRequestHeaders- The access control request headers of the target resource.
 
 - 
setAccessControlRequestMethodpublic void setAccessControlRequestMethod(Method accessControlRequestMethod) Sets the access control request method of the target resource.- Overrides:
- setAccessControlRequestMethodin class- Request
- Parameters:
- accessControlRequestMethod- The access control request method of the target resource.
 
 
- 
 
-