public class Request extends Message
Restlet
s. This request can also be
processed by a chain of Restlets, on both client and server sides. Requests
are uniform across all types of connectors, protocols and components.Constructor and Description |
---|
Request()
Constructor.
|
Request(Method method,
Reference resourceRef)
Constructor.
|
Request(Method method,
Reference resourceRef,
Representation entity)
Constructor.
|
Request(Method method,
java.lang.String resourceUri)
Constructor.
|
Request(Method method,
java.lang.String resourceUri,
Representation entity)
Constructor.
|
Request(Request request)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
abort()
Ask the connector to attempt to abort the related network connection, for
example immediately closing the socket.
|
void |
commit(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 modifiable set of headers the client is willing to send in
future request to this resource.
|
Method |
getAccessControlRequestMethod()
Returns the method the client is willing to use in future request to this
resource.
|
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 modifiable conditions applying to this request.
|
Series<Cookie> |
getCookies()
Returns the modifiable series of cookies provided by the client.
|
Reference |
getHostRef()
Returns the host reference.
|
int |
getMaxForwards()
Returns the maximum number of intermediaries.
|
Method |
getMethod()
Returns the method.
|
Uniform |
getOnResponse()
Returns the callback invoked on response reception.
|
Reference |
getOriginalRef()
Returns the original reference as requested by the client.
|
Protocol |
getProtocol()
Returns the protocol used or to be used, if known.
|
java.util.List<Range> |
getRanges()
Returns the ranges to return from the target resource's representation.
|
Reference |
getReferrerRef()
Returns the referrer reference if available.
|
Reference |
getResourceRef()
Returns the reference of the target resource.
|
Reference |
getRootRef()
Returns the application root reference.
|
boolean |
isAsynchronous()
Indicates if the request is asynchronous.
|
boolean |
isConfidential()
Implemented based on the
Protocol.isConfidential() method for the
request's protocol returned by getProtocol() ; |
boolean |
isEntityAvailable()
Indicates if a content is available and can be sent.
|
boolean |
isExpectingResponse()
Indicates if an associated response is expected.
|
boolean |
isLoggable()
Indicates if the call is loggable
|
boolean |
isSynchronous()
Indicates if the request is synchronous.
|
void |
setAccessControlRequestHeaders(java.util.Set<java.lang.String> accessControlRequestHeaders)
Sets the set of headers the client is willing to use in future request to
this resource.
|
void |
setAccessControlRequestMethod(Method accessControlRequestMethod)
Sets the method the client is willing to use in future request to this
resource.
|
void |
setChallengeResponse(ChallengeResponse challengeResponse)
Sets the authentication response sent by a client to an origin server.
|
void |
setClientInfo(ClientInfo clientInfo)
Sets the client-specific information.
|
void |
setConditions(Conditions conditions)
Sets the conditions applying to this request.
|
void |
setCookies(Series<Cookie> cookies)
Sets the modifiable series of cookies provided by the client.
|
void |
setHostRef(Reference hostRef)
Sets the host reference.
|
void |
setHostRef(java.lang.String hostUri)
Sets the host reference using an URI string.
|
void |
setLoggable(boolean loggable)
Indicates if the call is loggable
|
void |
setMaxForwards(int maxForwards)
Sets the maximum number of intermediaries.
|
void |
setMethod(Method method)
Sets the method called.
|
void |
setOnResponse(Uniform onResponseCallback)
Sets the callback invoked on response reception.
|
void |
setOriginalRef(Reference originalRef)
Sets the original reference requested by the client.
|
void |
setProtocol(Protocol protocol)
Sets the protocol used or to be used.
|
void |
setRanges(java.util.List<Range> ranges)
Sets the modifiable list of ranges to return from the target resource's
representation.
|
void |
setReferrerRef(Reference referrerRef)
Sets the referrer reference if available.
|
void |
setReferrerRef(java.lang.String referrerUri)
Sets the referrer reference if available using an URI string.
|
void |
setResourceRef(Reference resourceRef)
Sets the target resource reference.
|
void |
setResourceRef(java.lang.String resourceUri)
Sets the target resource reference using an URI string.
|
void |
setRootRef(Reference rootRef)
Sets the application root reference.
|
java.lang.String |
toString()
Displays a synthesis of the request like an HTTP request line.
|
flushBuffers, getAttributes, getCacheDirectives, getDate, getEntity, getHeaders, getOnError, getOnSent, getRecipientsInfo, getWarnings, release, setAttributes, setCacheDirectives, setDate, setEntity, setEntity, setOnError, setOnSent, setRecipientsInfo, setWarnings
public Request()
public Request(Method method, Reference resourceRef)
method
- The call's method.resourceRef
- The resource reference.public Request(Method method, Reference resourceRef, Representation entity)
method
- The call's method.resourceRef
- The resource reference.entity
- The entity.public Request(Method method, java.lang.String resourceUri)
method
- The call's method.resourceUri
- The resource URI.public Request(Method method, java.lang.String resourceUri, Representation entity)
method
- The call's method.resourceUri
- The resource URI.entity
- The entity.public Request(Request request)
request
- The request to copy.public boolean abort()
public void commit(Response response)
public java.util.Set<java.lang.String> getAccessControlRequestHeaders()
public Method getAccessControlRequestMethod()
public ChallengeResponse getChallengeResponse()
public ClientInfo getClientInfo()
public Conditions getConditions()
public Series<Cookie> getCookies()
public Reference getHostRef()
public int getMaxForwards()
public Method getMethod()
public Uniform getOnResponse()
public Reference getOriginalRef()
getResourceRef()
method for details.getResourceRef()
public Protocol getProtocol()
public java.util.List<Range> getRanges()
public Reference getReferrerRef()
public Reference getResourceRef()
getOriginalRef()
method instead. Also,
note that beside the update of its base property, the resource reference
can be modified during the request processing.
For example, the org.restlet.client.service.TunnelService
associated to
an application can extract some special extensions or query parameters
and replace them by semantically equivalent properties on the request
object. Therefore, the resource reference can become different from the
original reference.
Finally, when sending out requests via a dispatcher such as Context.getClientDispatcher()
or
Context#getServerDispatcher()
, if the reference contains URI
template variables, those variables are automatically resolved using the
request's attributes.getOriginalRef()
,
getHostRef()
public Reference getRootRef()
public boolean isAsynchronous()
getOnResponse()
method returns a callback object.public boolean isConfidential()
Protocol.isConfidential()
method for the
request's protocol returned by getProtocol()
;isConfidential
in class Message
public boolean isEntityAvailable()
isEntityAvailable
in class Message
public boolean isExpectingResponse()
public boolean isLoggable()
public boolean isSynchronous()
getOnResponse()
method returns null.public void setAccessControlRequestHeaders(java.util.Set<java.lang.String> accessControlRequestHeaders)
accessControlRequestHeaders
- The set of headers the client is willing to send in future
request to this resource. Useful for CORS support.public void setAccessControlRequestMethod(Method accessControlRequestMethod)
accessControlRequestMethod
- The method the client is willing to send in future request to
this resource. Useful for CORS support.public void setChallengeResponse(ChallengeResponse challengeResponse)
challengeResponse
- The authentication response sent by a client to an origin
server.public void setClientInfo(ClientInfo clientInfo)
clientInfo
- The client-specific information.public void setConditions(Conditions conditions)
conditions
- The conditions applying to this request.public void setCookies(Series<Cookie> cookies)
cookies
- A series of cookies provided by the client.public void setHostRef(Reference hostRef)
hostRef
- The host reference.public void setHostRef(java.lang.String hostUri)
hostUri
- The host URI.public void setLoggable(boolean loggable)
loggable
- True if the call is loggablepublic void setMaxForwards(int maxForwards)
maxForwards
- The maximum number of intermediaries.public void setMethod(Method method)
method
- The method called.public void setOnResponse(Uniform onResponseCallback)
onResponseCallback
- The callback invoked on response reception.public void setOriginalRef(Reference originalRef)
originalRef
- The original reference.getOriginalRef()
public void setProtocol(Protocol protocol)
protocol
- The protocol used or to be used.public void setRanges(java.util.List<Range> ranges)
ranges
- A list of ranges.public void setReferrerRef(Reference referrerRef)
referrerRef
- The referrer reference.public void setReferrerRef(java.lang.String referrerUri)
referrerUri
- The referrer URI.setReferrerRef(Reference)
public void setResourceRef(Reference resourceRef)
resourceRef
- The resource reference.getResourceRef()
public void setResourceRef(java.lang.String resourceUri)
resourceUri
- The resource URI.setResourceRef(Reference)
public void setRootRef(Reference rootRef)
rootRef
- The application root reference.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2024 Restlet.