Package org.restlet.resource
Class ServerResource
- java.lang.Object
- 
- org.restlet.resource.Resource
- 
- org.restlet.resource.ServerResource
 
 
- 
 public abstract class ServerResource extends Resource Base class for server-side resources. It acts as a wrapper to a given call, including the incomingRequestand the outgoingResponse.
 
 It's life cycle is managed by aFindercreated either explicitly or more likely implicitly when yourServerResourcesubclass is attached to aFilteror aRoutervia theFilter.setNext(Class)orRouter.attach(String, Class)methods for example. After instantiation using the default constructor, the finalResource.init(Context, Request, Response)method is invoked, setting the context, request and response. You can intercept this by overriding theResource.doInit()method. Then, if the response status is still a success, thehandle()method is invoked to actually handle the call. Finally, the finalResource.release()method is invoked to do the necessary clean-up, which you can intercept by overriding theResource.doRelease()method. During this life cycle, if any exception is caught, then thedoCatch(Throwable)method is invoked.
 
 Note that when an annotated method manually sets the response entity, if this entity is available then it will be preserved and the result of the annotated method ignored.
 
 In addition, there are two ways to declare representation variants, one is based on thegetVariants()method and another one on the annotated methods. Both approaches can't however be used at the same time for now.
 
 Concurrency note: contrary to theUniformclass and its mainRestletsubclass where a single instance can handle several calls concurrently, one instance ofServerResourceis created for each call handled and accessed by only one thread at a time.- Author:
- Jerome Louvel
 
- 
- 
Constructor SummaryConstructors Constructor Description ServerResource()Default constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Ask the connector to abort the related network connection, for example immediately closing the socket.voidcommit()Asks the response to immediately commit making it ready to be sent back to the client.protected Representationdelete()Deletes the resource and all its representations.protected Representationdelete(Variant variant)Deletes the resource and all its representations.protected RepresentationdescribeVariants()Describes the available variants to help client-side content negotiation.protected voiddoCatch(java.lang.Throwable throwable)Invoked when an error or an exception is caught during initialization, handling or releasing.protected RepresentationdoConditionalHandle()Handles a call by first verifying the optional request conditions and continue the processing if possible.protected voiddoError(Status errorStatus)By default, it sets the status on the response.protected RepresentationdoHandle()Effectively handles a call without content negotiation of the response entity.protected RepresentationdoHandle(Variant variant)Effectively handles a call with content negotiation of the response entity.protected RepresentationdoNegotiatedHandle()Effectively handles a call with content negotiation of the response entity.protected Representationget()Returns a full representation.protected Representationget(Variant variant)Returns a full representation for a given variant.java.lang.StringgetAttribute(java.lang.String name)Returns the attribute value by looking up the given name in the request attributes maps.java.lang.StringgetDescription()Returns the description.protected RepresentationInfogetInfo()Returns information about the resource's representation.protected RepresentationInfogetInfo(Variant variant)Returns information about the resource's representation.java.lang.StringgetName()Returns the display name.UniformgetOnSent()Returns the callback invoked after sending the response.protected VariantgetPreferredVariant(java.util.List<Variant> variants)Returns the preferred variant among a list of available variants.RolegetRole(java.lang.String name)Retrieves an existing role or creates a new one if needed based on its name.java.util.List<Variant>getVariants()Returns a modifiable list of exposed variants for the current request method.protected java.util.List<Variant>getVariants(Method method)Returns a modifiable list of exposed variants for the given method.Representationhandle()Handles any call to this resource.protected booleanhasAnnotations()Indicates if annotations were defined on this resource.protected Representationhead()Returns a representation whose metadata will be returned to the client.protected Representationhead(Variant variant)Returns a representation whose metadata will be returned to the client.booleanisAnnotated()Indicates if annotations are supported.booleanisAutoCommitting()Indicates if the response should be automatically committed.booleanisCommitted()Indicates if the response has already been committed.booleanisConditional()Indicates if conditional handling is enabled.booleanisExisting()Indicates if the identified resource exists.booleanisInRole(java.lang.String roleName)Indicates if the authenticated client user associated to the current request is in the given role name.booleanisNegotiated()Indicates if content negotiation of response entities is enabled.protected Representationoptions()Indicates the communication options available for this resource.protected Representationoptions(Variant variant)Indicates the communication options available for this resource.protected Representationpatch(Representation entity)Apply a patch entity to the current representation of the resource retrieved by callingget().protected Representationpatch(Representation entity, Variant variant)Apply a patch entity to the current representation of the resource retrieved by callingget().protected Representationpost(Representation entity)Posts a representation to the resource at the target URI reference.protected Representationpost(Representation entity, Variant variant)Posts a representation to the resource at the target URI reference.protected Representationput(Representation entity)Creates or updates a resource with the given representation as new state to be stored.protected Representationput(Representation representation, Variant variant)Creates or updates a resource with the given representation as new state to be stored.voidredirectPermanent(java.lang.String targetUri)Permanently redirects the client to a target URI.voidredirectPermanent(Reference targetRef)Permanently redirects the client to a target URI.voidredirectSeeOther(java.lang.String targetUri)Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource.voidredirectSeeOther(Reference targetRef)Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource.voidredirectTemporary(java.lang.String targetUri)Temporarily redirects the client to a target URI.voidredirectTemporary(Reference targetRef)Temporarily redirects the client to a target URI.voidsetAllowedMethods(java.util.Set<Method> allowedMethods)Sets the set of methods allowed on the requested resource.voidsetAnnotated(boolean annotated)Indicates if annotations are supported.voidsetAttribute(java.lang.String name, java.lang.Object value)Sets the response attribute value.voidsetAutoCommitting(boolean autoCommitting)Indicates if the response should be automatically committed.voidsetChallengeRequests(java.util.List<ChallengeRequest> requests)Sets the list of authentication requests sent by an origin server to a client.voidsetCommitted(boolean committed)Indicates if the response has already been committed.voidsetConditional(boolean conditional)Indicates if conditional handling is enabled.voidsetCookieSettings(Series<CookieSetting> cookieSettings)Sets the cookie settings provided by the server.voidsetDescription(java.lang.String description)Sets the description.voidsetDimensions(java.util.Set<Dimension> dimensions)Sets the set of dimensions on which the response entity may vary.voidsetExisting(boolean exists)Indicates if the identified resource exists.voidsetLocationRef(java.lang.String locationUri)Sets the reference that the client should follow for redirections or resource creations.voidsetLocationRef(Reference locationRef)Sets the reference that the client should follow for redirections or resource creations.voidsetName(java.lang.String name)Sets the display name.voidsetNegotiated(boolean negotiateContent)Indicates if content negotiation of response entities is enabled.voidsetOnSent(Uniform onSentCallback)Sets the callback invoked after sending the response.voidsetProxyChallengeRequests(java.util.List<ChallengeRequest> requests)Sets the list of proxy authentication requests sent by an origin server to a client.voidsetServerInfo(ServerInfo serverInfo)Sets the server-specific information.voidsetStatus(Status status)Sets the status.voidsetStatus(Status status, java.lang.String message)Sets the status.voidsetStatus(Status status, java.lang.Throwable throwable)Sets the status.voidsetStatus(Status status, java.lang.Throwable throwable, java.lang.String message)Sets the status.voidupdateAllowedMethods()Invoked when the list of allowed methods needs to be updated.protected voidupdateDimensions()Update the dimensions that were used for content negotiation.- 
Methods inherited from class org.restlet.resource.ResourcedoError, doInit, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
 
- 
 
- 
- 
- 
Constructor Detail- 
ServerResourcepublic ServerResource() Default constructor. Note that theResource.init(Context, Request, Response)() method will be invoked right after the creation of the resource.
 
- 
 - 
Method Detail- 
abortpublic void abort() Ask the connector to abort the related network connection, for example immediately closing the socket.
 - 
commitpublic void commit() Asks the response to immediately commit making it ready to be sent back to the client. Note that all server connectors don't necessarily support this feature.
 - 
deleteprotected Representation delete() throws ResourceException Deletes the resource and all its representations. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise thedelete(Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Returns:
- The optional response entity.
- Throws:
- ResourceException
- See Also:
- HTTP DELETE method
 
 - 
deleteprotected Representation delete(Variant variant) throws ResourceException Deletes the resource and all its representations. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise thedelete()method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- variant- The variant of the response entity.
- Returns:
- The optional response entity.
- Throws:
- ResourceException
- See Also:
- get(Variant), HTTP DELETE method
 
 - 
describeVariantsprotected Representation describeVariants() Describes the available variants to help client-side content negotiation. Return null by default.- Returns:
- The description of available variants.
 
 - 
doCatchprotected void doCatch(java.lang.Throwable throwable) Invoked when an error or an exception is caught during initialization, handling or releasing. By default, updates the responses's status with the result ofStatusService.toStatus(Throwable, Resource).
 - 
doConditionalHandleprotected Representation doConditionalHandle() throws ResourceException Handles a call by first verifying the optional request conditions and continue the processing if possible. Note that in order to evaluate those conditions,getInfo()orgetInfo(Variant)methods might be invoked.- Returns:
- The response entity.
- Throws:
- ResourceException
 
 - 
doErrorprotected void doError(Status errorStatus) By default, it sets the status on the response.
 - 
doHandleprotected Representation doHandle() throws ResourceException Effectively handles a call without content negotiation of the response entity. The default behavior is to dispatch the call to one of theget(),post(Representation),put(Representation),delete(),head()oroptions()methods.- Returns:
- The response entity.
- Throws:
- ResourceException
 
 - 
doHandleprotected Representation doHandle(Variant variant) throws ResourceException Effectively handles a call with content negotiation of the response entity. The default behavior is to dispatch the call to one of theget(Variant),post(Representation,Variant),put(Representation,Variant),delete(Variant),head(Variant)oroptions(Variant)methods.- Parameters:
- variant- The response variant expected.
- Returns:
- The response entity.
- Throws:
- ResourceException
 
 - 
doNegotiatedHandleprotected Representation doNegotiatedHandle() throws ResourceException Effectively handles a call with content negotiation of the response entity. The default behavior is to dispatch the call to call a matching annotated method or one of theget(Variant),post(Representation,Variant),put(Representation,Variant),delete(Variant),head(Variant)oroptions(Variant)methods.
 
 If no acceptable variant is found, theStatus.CLIENT_ERROR_NOT_ACCEPTABLEstatus is set.- Returns:
- The response entity.
- Throws:
- ResourceException
 
 - 
getprotected Representation get() throws ResourceException Returns a full representation. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise theget(Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Returns:
- The resource's representation.
- Throws:
- ResourceException
- See Also:
- HTTP GET method
 
 - 
getprotected Representation get(Variant variant) throws ResourceException Returns a full representation for a given variant. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise theget()method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- variant- The variant whose full representation must be returned.
- Returns:
- The resource's representation.
- Throws:
- ResourceException
- See Also:
- get(Variant)
 
 - 
getAttributepublic java.lang.String getAttribute(java.lang.String name) Returns the attribute value by looking up the given name in the request attributes maps. The toString() method is then invoked on the attribute value. This is typically used for variables that are declared in the URI template used to route the call to this resource.- Specified by:
- getAttributein class- Resource
- Parameters:
- name- The attribute name.
- Returns:
- The request attribute value.
 
 - 
getDescriptionpublic java.lang.String getDescription() Returns the description.- Returns:
- The description
 
 - 
getInfoprotected RepresentationInfo getInfo() throws ResourceException Returns information about the resource's representation. Those metadata are important for conditional method processing. The advantage over the completeRepresentationclass is that it is much lighter to create. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise thegetInfo(Variant)method is invoked.
 
 The default behavior is to invoke theget()method.- Returns:
- Information about the resource's representation.
- Throws:
- ResourceException
 
 - 
getInfoprotected RepresentationInfo getInfo(Variant variant) throws ResourceException Returns information about the resource's representation. Those metadata are important for conditional method processing. The advantage over the completeRepresentationclass is that it is much lighter to create. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise thegetInfo(Variant)method is invoked.
 
 The default behavior is to invoke theget(Variant)method.- Parameters:
- variant- The variant whose representation information must be returned.
- Returns:
- Information about the resource's representation.
- Throws:
- ResourceException
 
 - 
getNamepublic java.lang.String getName() Returns the display name.- Returns:
- The display name.
 
 - 
getOnSentpublic Uniform getOnSent() Returns the callback invoked after sending the response.- Returns:
- The callback invoked after sending the response.
 
 - 
getPreferredVariantprotected Variant getPreferredVariant(java.util.List<Variant> variants) Returns the preferred variant among a list of available variants. The selection is based on the client preferences using theConnegService.getPreferredVariant(List, Request, org.restlet.service.MetadataService)method.- Parameters:
- variants- The available variants.
- Returns:
- The preferred variant.
 
 - 
getRolepublic Role getRole(java.lang.String name) Retrieves an existing role or creates a new one if needed based on its name. Note that a null description will be set if the role has to be created.- Parameters:
- name- The role name to find or create.
- Returns:
- The role found or created.
 
 - 
getVariantspublic java.util.List<Variant> getVariants() Returns a modifiable list of exposed variants for the current request method. You can declare variants manually by updating the result list , by overriding this method. By default, the variants will be provided based on annotated methods.- Returns:
- The modifiable list of variants.
- Throws:
- java.io.IOException
 
 - 
getVariantsprotected java.util.List<Variant> getVariants(Method method) Returns a modifiable list of exposed variants for the given method. You can declare variants manually by updating the result list , by overriding this method. By default, the variants will be provided based on annotated methods.- Parameters:
- method- The method.
- Returns:
- The modifiable list of variants.
 
 - 
handlepublic Representation handle() Handles any call to this resource. The default implementation check theisConditional()andisNegotiated()method to determine which one of thedoConditionalHandle(),doNegotiatedHandle()anddoHandle()methods should be invoked. It also catches anyResourceExceptionthrown and updates the response status using thesetStatus(Status, Throwable, String)method.
 
 After handling, if the status is set toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED, thenupdateAllowedMethods()is invoked to give the resource a chance to inform the client about the allowed methods.
 - 
hasAnnotationsprotected boolean hasAnnotations() Indicates if annotations were defined on this resource.- Returns:
- True if annotations were defined on this resource.
 
 - 
headprotected Representation head() throws ResourceException Returns a representation whose metadata will be returned to the client. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise thehead(Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Returns:
- The resource's representation.
- Throws:
- ResourceException
- See Also:
- HTTP GET method
 
 - 
headprotected Representation head(Variant variant) throws ResourceException Returns a representation whose metadata will be returned to the client. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise thehead()method is invoked.
 
 The default implementation directly returns the variant if it is already an instance ofRepresentation. In other cases, you need to override this method in order to provide your own implementation. *- Parameters:
- variant- The variant whose full representation must be returned.
- Returns:
- The resource's representation.
- Throws:
- ResourceException
- See Also:
- get(Variant)
 
 - 
isAnnotatedpublic boolean isAnnotated() Indicates if annotations are supported. The default value is true.- Returns:
- True if annotations are supported.
 
 - 
isAutoCommittingpublic boolean isAutoCommitting() Indicates if the response should be automatically committed. When processing a request on the server-side, setting this property to 'false' let you ask to the server connector to wait before sending the response back to the client when the initial calling thread returns. This will let you do further updates to the response and manually callingcommit()later on, using another thread.- Returns:
- True if the response should be automatically committed.
 
 - 
isCommittedpublic boolean isCommitted() Indicates if the response has already been committed.- Returns:
- True if the response has already been committed.
 
 - 
isConditionalpublic boolean isConditional() Indicates if conditional handling is enabled. The default value is true.- Returns:
- True if conditional handling is enabled.
 
 - 
isExistingpublic boolean isExisting() Indicates if the identified resource exists. The default value is true.- Returns:
- True if the identified resource exists.
 
 - 
isInRolepublic boolean isInRole(java.lang.String roleName) Indicates if the authenticated client user associated to the current request is in the given role name.- Parameters:
- roleName- The role name to test.
- Returns:
- True if the authenticated subject is in the given role.
 
 - 
isNegotiatedpublic boolean isNegotiated() Indicates if content negotiation of response entities is enabled. The default value is true.- Returns:
- True if content negotiation of response entities is enabled.
 
 - 
optionsprotected Representation options() throws ResourceException Indicates the communication options available for this resource. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise theoptions(Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Returns:
- The optional response entity.
- Throws:
- ResourceException
 
 - 
optionsprotected Representation options(Variant variant) throws ResourceException Indicates the communication options available for this resource. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise theoptions()method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- variant- The variant of the response entity.
- Returns:
- The optional response entity.
- Throws:
- ResourceException
- See Also:
- get(Variant)
 
 - 
patchprotected Representation patch(Representation entity) throws ResourceException Apply a patch entity to the current representation of the resource retrieved by callingget(). By default, theConverterService.applyPatch(Representation, Representation)method is used and then theput(Representation)method called.- Parameters:
- entity- The patch entity to apply.
- Returns:
- The optional result entity.
- Throws:
- ResourceException
- See Also:
- HTTP PATCH method
 
 - 
patchprotected Representation patch(Representation entity, Variant variant) throws ResourceException Apply a patch entity to the current representation of the resource retrieved by callingget(). By default, theConverterService.applyPatch(Representation, Representation)method is used and then theput(Representation, Variant)method called.- Parameters:
- entity- The patch entity to apply.
- variant- The variant of the response entity.
- Returns:
- The optional result entity.
- Throws:
- ResourceException
- See Also:
- HTTP PATCH method
 
 - 
postprotected Representation post(Representation entity) throws ResourceException Posts a representation to the resource at the target URI reference. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise thepost(Representation, Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- entity- The posted entity.
- Returns:
- The optional response entity.
- Throws:
- ResourceException
- See Also:
- get(Variant), HTTP POST method
 
 - 
postprotected Representation post(Representation entity, Variant variant) throws ResourceException Posts a representation to the resource at the target URI reference. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise thepost(Representation)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- entity- The posted entity.
- variant- The variant of the response entity.
- Returns:
- The optional result entity.
- Throws:
- ResourceException
- See Also:
- HTTP POST method
 
 - 
putprotected Representation put(Representation entity) throws ResourceException Creates or updates a resource with the given representation as new state to be stored. This method is only invoked if content negotiation has been disabled as indicated by theisNegotiated(), otherwise theput(Representation, Variant)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- entity- The representation to store.
- Returns:
- The optional result entity.
- Throws:
- ResourceException
- See Also:
- HTTP PUT method
 
 - 
putprotected Representation put(Representation representation, Variant variant) throws ResourceException Creates or updates a resource with the given representation as new state to be stored. A variant parameter is passed to indicate which representation should be returned if any.
 
 This method is only invoked if content negotiation has been enabled as indicated by theisNegotiated(), otherwise theput(Representation)method is invoked.
 
 The default behavior is to set the response status toStatus.CLIENT_ERROR_METHOD_NOT_ALLOWED.- Parameters:
- representation- The representation to store.
- variant- The variant of the response entity.
- Returns:
- The optional result entity.
- Throws:
- ResourceException
- See Also:
- get(Variant), HTTP PUT method
 
 - 
redirectPermanentpublic void redirectPermanent(Reference targetRef) Permanently redirects the client to a target URI. The client is expected to reuse the same method for the new request.- Parameters:
- targetRef- The target URI reference.
 
 - 
redirectPermanentpublic void redirectPermanent(java.lang.String targetUri) Permanently redirects the client to a target URI. The client is expected to reuse the same method for the new request.
 
 If you pass a relative target URI, it will be resolved with the current base reference of the request's resource reference (seeRequest.getResourceRef()andReference.getBaseRef().- Parameters:
- targetUri- The target URI.
 
 - 
redirectSeeOtherpublic void redirectSeeOther(Reference targetRef) Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource.- Parameters:
- targetRef- The target reference.
 
 - 
redirectSeeOtherpublic void redirectSeeOther(java.lang.String targetUri) Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource.
 
 If you pass a relative target URI, it will be resolved with the current base reference of the request's resource reference (seeRequest.getResourceRef()andReference.getBaseRef().- Parameters:
- targetUri- The target URI.
 
 - 
redirectTemporarypublic void redirectTemporary(Reference targetRef) Temporarily redirects the client to a target URI. The client is expected to reuse the same method for the new request.- Parameters:
- targetRef- The target reference.
 
 - 
redirectTemporarypublic void redirectTemporary(java.lang.String targetUri) Temporarily redirects the client to a target URI. The client is expected to reuse the same method for the new request.
 
 If you pass a relative target URI, it will be resolved with the current base reference of the request's resource reference (seeRequest.getResourceRef()andReference.getBaseRef().- Parameters:
- targetUri- The target URI.
 
 - 
setAllowedMethodspublic void setAllowedMethods(java.util.Set<Method> allowedMethods) Sets the set of methods allowed on the requested resource. The set instance set must be thread-safe (useCopyOnWriteArraySetfor example.- Parameters:
- allowedMethods- The set of methods allowed on the requested resource.
- See Also:
- Response.setAllowedMethods(Set)
 
 - 
setAnnotatedpublic void setAnnotated(boolean annotated) Indicates if annotations are supported. The default value is true.- Parameters:
- annotated- Indicates if annotations are supported.
 
 - 
setAttributepublic void setAttribute(java.lang.String name, java.lang.Object value)Sets the response attribute value.- Specified by:
- setAttributein class- Resource
- Parameters:
- name- The attribute name.
- value- The attribute to set.
 
 - 
setAutoCommittingpublic void setAutoCommitting(boolean autoCommitting) Indicates if the response should be automatically committed.- Parameters:
- autoCommitting- True if the response should be automatically committed
 
 - 
setChallengeRequestspublic void setChallengeRequests(java.util.List<ChallengeRequest> requests) Sets the list of authentication requests sent by an origin server to a client. The list instance set must be thread-safe (useCopyOnWriteArrayListfor example.- Parameters:
- requests- The list of authentication requests sent by an origin server to a client.
- See Also:
- Response.setChallengeRequests(List)
 
 - 
setCommittedpublic void setCommitted(boolean committed) Indicates if the response has already been committed.- Parameters:
- committed- True if the response has already been committed.
 
 - 
setConditionalpublic void setConditional(boolean conditional) Indicates if conditional handling is enabled. The default value is true.- Parameters:
- conditional- True if conditional handling is enabled.
 
 - 
setCookieSettingspublic void setCookieSettings(Series<CookieSetting> cookieSettings) Sets the cookie settings provided by the server.- Parameters:
- cookieSettings- The cookie settings provided by the server.
- See Also:
- Response.setCookieSettings(Series)
 
 - 
setDescriptionpublic void setDescription(java.lang.String description) Sets the description.- Parameters:
- description- The description.
 
 - 
setDimensionspublic void setDimensions(java.util.Set<Dimension> dimensions) Sets the set of dimensions on which the response entity may vary. The set instance set must be thread-safe (useCopyOnWriteArraySetfor example.- Parameters:
- dimensions- The set of dimensions on which the response entity may vary.
- See Also:
- Response.setDimensions(Set)
 
 - 
setExistingpublic void setExisting(boolean exists) Indicates if the identified resource exists. The default value is true.- Parameters:
- exists- Indicates if the identified resource exists.
 
 - 
setLocationRefpublic void setLocationRef(Reference locationRef) Sets the reference that the client should follow for redirections or resource creations.- Parameters:
- locationRef- The reference to set.
- See Also:
- Response.setLocationRef(Reference)
 
 - 
setLocationRefpublic void setLocationRef(java.lang.String locationUri) Sets the reference that the client should follow for redirections or resource creations. If you pass a relative location URI, it will be resolved with the current base reference of the request's resource reference (seeRequest.getResourceRef()andReference.getBaseRef().- Parameters:
- locationUri- The URI to set.
- See Also:
- Response.setLocationRef(String)
 
 - 
setNamepublic void setName(java.lang.String name) Sets the display name.- Parameters:
- name- The display name.
 
 - 
setNegotiatedpublic void setNegotiated(boolean negotiateContent) Indicates if content negotiation of response entities is enabled. The default value is true.- Parameters:
- negotiateContent- True if content negotiation of response entities is enabled.
 
 - 
setOnSentpublic void setOnSent(Uniform onSentCallback) Sets the callback invoked after sending the response.- Parameters:
- onSentCallback- The callback invoked after sending the response.
 
 - 
setProxyChallengeRequestspublic void setProxyChallengeRequests(java.util.List<ChallengeRequest> requests) Sets the list of proxy authentication requests sent by an origin server to a client. The list instance set must be thread-safe (useCopyOnWriteArrayListfor example.- Parameters:
- requests- The list of proxy authentication requests sent by an origin server to a client.
- See Also:
- Response.setProxyChallengeRequests(List)
 
 - 
setServerInfopublic void setServerInfo(ServerInfo serverInfo) Sets the server-specific information.- Parameters:
- serverInfo- The server-specific information.
- See Also:
- Response.setServerInfo(ServerInfo)
 
 - 
setStatuspublic void setStatus(Status status) Sets the status.- Parameters:
- status- The status to set.
- See Also:
- Response.setStatus(Status)
 
 - 
setStatuspublic void setStatus(Status status, java.lang.String message) Sets the status.- Parameters:
- status- The status to set.
- message- The status message.
- See Also:
- Response.setStatus(Status, String)
 
 - 
setStatuspublic void setStatus(Status status, java.lang.Throwable throwable) Sets the status.- Parameters:
- status- The status to set.
- throwable- The related error or exception.
- See Also:
- Response.setStatus(Status, Throwable)
 
 - 
setStatuspublic void setStatus(Status status, java.lang.Throwable throwable, java.lang.String message) Sets the status.- Parameters:
- status- The status to set.
- throwable- The related error or exception.
- message- The status message.
- See Also:
- Response.setStatus(Status, Throwable, String)
 
 - 
updateAllowedMethodspublic void updateAllowedMethods() Invoked when the list of allowed methods needs to be updated. TheResource.getAllowedMethods()or thesetAllowedMethods(Set)methods should be used. The default implementation lists the annotated methods.
 - 
updateDimensionsprotected void updateDimensions() Update the dimensions that were used for content negotiation. By default, it adds theDimension.CHARACTER_SET,Dimension.ENCODING,Dimension.LANGUAGEandDimension.MEDIA_TYPEconstants.
 
- 
 
-