public class Response extends Message
Modifier and Type | Method and Description |
---|---|
void |
abort()
Ask the connector to abort the related network connection, for example
immediately closing the socket.
|
void |
commit()
Asks the server connector to immediately commit the given response,
making it ready to be sent back to the client.
|
void |
flushBuffers()
Asks the server connector to immediately flush the network buffers.
|
java.lang.Boolean |
getAccessControlAllowCredentials()
When used as part of a response to a preflight CORS request, this
indicates whether or not the actual request can be made using
credentials.
|
java.util.Set<java.lang.String> |
getAccessControlAllowHeaders()
Returns the modifiable set of headers allowed by the actual request on
the current resource when used as part of a response to a preflight CORS
request.
|
java.util.Set<Method> |
getAccessControlAllowMethods()
Returns the modifiable set of methods allowed by the actual request on
the current resource when used as part of a response to a preflight CORS
request
Note that when used with HTTP connectors, this property maps to the "Access-Control-Allow-Methods" header. |
java.lang.String |
getAccessControlAllowOrigin()
When used in the context of CORS support, it returns the URI an origin
server allows for the requested resource.
|
java.util.Set<java.lang.String> |
getAccessControlExposeHeaders()
Returns a modifiable whitelist of headers an origin server allows for the
requested resource.
|
int |
getAccessControlMaxAge()
Indicates how long the results of a preflight CORS request can be cached in a preflight result cache.
|
int |
getAge()
Returns the estimated amount of time since a response was generated or
revalidated by the origin server.
|
java.util.Set<Method> |
getAllowedMethods()
Returns the modifiable set of methods allowed on the requested resource.
|
AuthenticationInfo |
getAuthenticationInfo()
Returns information sent by an origin server related to an successful
authentication attempt.
|
java.util.List<ChallengeRequest> |
getChallengeRequests()
Returns the list of authentication requests sent by an origin server to a
client.
|
Series<CookieSetting> |
getCookieSettings()
Returns the modifiable series of cookie settings provided by the server.
|
java.util.Set<Dimension> |
getDimensions()
Returns the modifiable set of selecting dimensions on which the response
entity may vary.
|
Reference |
getLocationRef()
Returns the location reference.
|
java.util.List<ChallengeRequest> |
getProxyChallengeRequests()
Returns the list of authentication requests sent by an origin server to a
client.
|
Request |
getRequest()
Returns the associated request
|
java.util.Date |
getRetryAfter()
Indicates how long the service is expected to be unavailable to the
requesting client.
|
ServerInfo |
getServerInfo()
Returns the server-specific information.
|
Status |
getStatus()
Returns the status.
|
boolean |
isAutoCommitting()
Indicates if the response should be automatically committed.
|
boolean |
isCommitted()
Indicates if the response has already been committed.
|
boolean |
isConfidential()
Indicates if the message was or will be exchanged confidentially, for
example via a SSL-secured connection.
|
boolean |
isFinal()
Indicates if the response is final or provisional.
|
boolean |
isProvisional()
Indicates if the response is provisional or final.
|
void |
redirectPermanent(Reference targetRef)
Permanently redirects the client to a target URI.
|
void |
redirectPermanent(java.lang.String targetUri)
Permanently redirects the client to a target URI.
|
void |
redirectSeeOther(Reference targetRef)
Redirects the client to a different URI that SHOULD be retrieved using a
GET method on that resource.
|
void |
redirectSeeOther(java.lang.String targetUri)
Redirects the client to a different URI that SHOULD be retrieved using a
GET method on that resource.
|
void |
redirectTemporary(Reference targetRef)
Temporarily redirects the client to a target URI.
|
void |
redirectTemporary(java.lang.String targetUri)
Temporarily redirects the client to a target URI.
|
void |
setAccessControlAllowCredentials(java.lang.Boolean accessControlAllowCredentials)
When used as part of a response to a preflight CORS request, indicates
whether or not the actual request can be made using credentials.
|
void |
setAccessControlAllowHeaders(java.util.Set<java.lang.String> accessControlAllowHeaders)
Sets the set of headers allowed by the actual request on the current
resource when used as part of a response to a preflight CORS request.
|
void |
setAccessControlAllowMethods(java.util.Set<Method> accessControlAllowMethods)
Sets the set of methods allowed by the actual request on the current
resource when used as part of a response to a preflight CORS request.
|
void |
setAccessControlAllowOrigin(java.lang.String accessControlAllowOrigin)
When used in the context of CORS support, it sets the URI an origin
server allows for the requested resource.
|
void |
setAccessControlExposeHeaders(java.util.Set<java.lang.String> accessControlExposeHeaders)
Sets the list of headers an origin server allows for the requested
resource.
|
void |
setAccessControlMaxAge(int accessControlMaxAge)
When used as part of a response to a preflight CORS request, indicates how long (in seconds) the results of a
preflight request can be cached in a preflight result cache.
|
void |
setAge(int age)
Sets the estimated amount of time since a response was generated or
revalidated by the origin server.
|
void |
setAllowedMethods(java.util.Set<Method> allowedMethods)
Sets the set of methods allowed on the requested resource.
|
void |
setAuthenticationInfo(AuthenticationInfo authenticationInfo)
Sets the authentication information sent by an origin server to a client
after a successful authentication attempt.
|
void |
setAutoCommitting(boolean autoCommitting)
Indicates if the response should be automatically committed.
|
void |
setChallengeRequests(java.util.List<ChallengeRequest> challengeRequests)
Sets the list of authentication requests sent by an origin server to a
client.
|
void |
setCommitted(boolean committed)
Indicates if the response has already been committed.
|
void |
setCookieSettings(Series<CookieSetting> cookieSettings)
Sets the modifiable series of cookie settings provided by the server.
|
void |
setDimensions(java.util.Set<Dimension> dimensions)
Sets the set of dimensions on which the response entity may vary.
|
void |
setLocationRef(Reference locationRef)
Sets the reference that the client should follow for redirections or
resource creations.
|
void |
setLocationRef(java.lang.String locationUri)
Sets the reference that the client should follow for redirections or
resource creations.
|
void |
setProxyChallengeRequests(java.util.List<ChallengeRequest> proxyChallengeRequests)
Sets the modifiable list of authentication requests sent by a proxy to a
client.
|
void |
setRequest(Request request)
Sets the associated request.
|
void |
setRetryAfter(java.util.Date retryAfter)
Indicates how long the service is expected to be unavailable to the
requesting client.
|
void |
setServerInfo(ServerInfo serverInfo)
Sets the server-specific information.
|
void |
setStatus(Status status)
Sets the status.
|
void |
setStatus(Status status,
java.lang.String description)
Sets the status.
|
void |
setStatus(Status status,
java.lang.Throwable throwable)
Sets the status.
|
void |
setStatus(Status status,
java.lang.Throwable throwable,
java.lang.String message)
Sets the status.
|
java.lang.String |
toString()
Displays a synthesis of the response like an HTTP status line.
|
getAttributes, getCacheDirectives, getDate, getEntity, getHeaders, getOnError, getOnSent, getRecipientsInfo, getWarnings, isEntityAvailable, release, setAttributes, setCacheDirectives, setDate, setEntity, setEntity, setOnError, setOnSent, setRecipientsInfo, setWarnings
public Response(Request request)
request
- The request associated to this response.public void abort()
public void commit()
Request.commit(Response)
on the parent
request which holds the link with the underlying network connection.public void flushBuffers() throws java.io.IOException
Message.flushBuffers()
on the parent request
which holds the link with the underlying network connection.flushBuffers
in class Message
java.io.IOException
public java.lang.Boolean getAccessControlAllowCredentials()
public java.util.Set<java.lang.String> getAccessControlAllowHeaders()
public java.util.Set<Method> getAccessControlAllowMethods()
public java.lang.String getAccessControlAllowOrigin()
public java.util.Set<java.lang.String> getAccessControlExposeHeaders()
public int getAccessControlMaxAge()
public int getAge()
public java.util.Set<Method> getAllowedMethods()
public AuthenticationInfo getAuthenticationInfo()
public java.util.List<ChallengeRequest> getChallengeRequests()
public Series<CookieSetting> getCookieSettings()
public java.util.Set<Dimension> getDimensions()
public Reference getLocationRef()
public java.util.List<ChallengeRequest> getProxyChallengeRequests()
public Request getRequest()
public java.util.Date getRetryAfter()
public ServerInfo getServerInfo()
public Status getStatus()
public boolean isAutoCommitting()
commit()
later on, using another thread.public boolean isCommitted()
public boolean isConfidential()
Message
isConfidential
in class Message
public boolean isFinal()
Status.isInformational()
method.public boolean isProvisional()
Status.isInformational()
method.public void redirectPermanent(Reference targetRef)
targetRef
- The target URI reference.public void redirectPermanent(java.lang.String targetUri)
Request.getResourceRef()
and
Reference.getBaseRef()
.targetUri
- The target URI.public void redirectSeeOther(Reference targetRef)
targetRef
- The target reference.public void redirectSeeOther(java.lang.String targetUri)
Request.getResourceRef()
and
Reference.getBaseRef()
.targetUri
- The target URI.public void redirectTemporary(Reference targetRef)
targetRef
- The target reference.public void redirectTemporary(java.lang.String targetUri)
Request.getResourceRef()
and
Reference.getBaseRef()
.targetUri
- The target URI.public void setAccessControlAllowCredentials(java.lang.Boolean accessControlAllowCredentials)
accessControlAllowCredentials
- True if the requested resource allows credential.public void setAccessControlMaxAge(int accessControlMaxAge)
accessControlMaxAge
- How long the results of a preflight request can be cached in a preflight result cache.public void setAccessControlAllowHeaders(java.util.Set<java.lang.String> accessControlAllowHeaders)
accessControlAllowHeaders
- The set of headers allowed by the actual request on the
current resource.public void setAccessControlAllowMethods(java.util.Set<Method> accessControlAllowMethods)
accessControlAllowMethods
- The set of methods allowed by the actual request on the
current resource.public void setAccessControlAllowOrigin(java.lang.String accessControlAllowOrigin)
accessControlAllowOrigin
- The origin allowed by the requested resource.public void setAccessControlExposeHeaders(java.util.Set<java.lang.String> accessControlExposeHeaders)
accessControlExposeHeaders
- The set of headers an origin server allows for the requested
resource.public void setAge(int age)
age
- The response age.public void setAllowedMethods(java.util.Set<Method> allowedMethods)
CopyOnWriteArraySet
for
example.allowedMethods
- The set of methods allowed on the requested resource.public void setAuthenticationInfo(AuthenticationInfo authenticationInfo)
authenticationInfo
- The data returned by the server in response to successful
authentication.public void setAutoCommitting(boolean autoCommitting)
autoCommitting
- True if the response should be automatically committedpublic void setChallengeRequests(java.util.List<ChallengeRequest> challengeRequests)
challengeRequests
- A list of authentication requests sent by an origin server to
a client.public void setCommitted(boolean committed)
committed
- True if the response has already been committed.public void setCookieSettings(Series<CookieSetting> cookieSettings)
cookieSettings
- A series of cookie settings provided by the server.public void setDimensions(java.util.Set<Dimension> dimensions)
dimensions
- The set of dimensions on which the response entity may vary.public void setLocationRef(Reference locationRef)
locationRef
- The reference to set.public void setLocationRef(java.lang.String locationUri)
Request.getResourceRef()
and Reference.getBaseRef()
.locationUri
- The URI to set.setLocationRef(Reference)
public void setProxyChallengeRequests(java.util.List<ChallengeRequest> proxyChallengeRequests)
CopyOnWriteArrayList
for example. Note that when
used with HTTP
connectors, this property maps to the "Proxy-Authenticate" header. This
method clears the current list and adds all entries in the parameter
list.proxyChallengeRequests
- A list of authentication requests sent by a proxy to a client.public void setRequest(Request request)
request
- The associated requestpublic void setRetryAfter(java.util.Date retryAfter)
retryAfter
- Date after with a retry attempt could occur.public void setServerInfo(ServerInfo serverInfo)
serverInfo
- The server-specific information.public void setStatus(Status status)
status
- The status to set.public void setStatus(Status status, java.lang.String description)
status
- The status to set (code and reason phrase).description
- The longer status description.public void setStatus(Status status, java.lang.Throwable throwable)
status
- The status to set.throwable
- The related error or exception.public void setStatus(Status status, java.lang.Throwable throwable, java.lang.String message)
status
- The status to set.throwable
- The related error or exception.message
- The status message.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2024 Restlet.