com.sun.ws.rest.api.response
Class Created

java.lang.Object
  extended by com.sun.ws.rest.api.response.HttpResponse
      extended by com.sun.ws.rest.api.response.Created

public class Created
extends HttpResponse

An abstraction for a response to a request that resulted in the creation of a new resource,


Constructor Summary
Created(Representation<?> r)
          Create a new instance.
Created(Representation<?> r, java.net.URI location)
          Create a new instance
Created(java.net.URI location)
          Create a new instance
 
Method Summary
 void addResponseHeaders(HttpContext context)
          Add the HTTP headers for this type of response to the response context.
 java.net.URI getLocation()
          Get the location of a newly created resource.
 void setLocation(java.net.URI location)
          Set the location of a newly created resource.
 
Methods inherited from class com.sun.ws.rest.api.response.HttpResponse
getCacheControl, getCacheControl, getRepresentation, getStatus, setRepresentation, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Created

public Created(java.net.URI location)
Create a new instance

Parameters:
location - an absolute or relative URI that identifies the newly created resource. Relative URIs are relative to the request URI.

Created

public Created(Representation<?> r)
Create a new instance.

Parameters:
r - a representation of the newly created resource

Created

public Created(Representation<?> r,
               java.net.URI location)
Create a new instance

Parameters:
r - a representation of the newly created resource
location - an absolute or relative URI that identifies the newly created resource. Relative URIs are relative to the request URI.
Method Detail

setLocation

public void setLocation(java.net.URI location)
Set the location of a newly created resource. When this value is non-null the HTTP response status code will be putSingle to "201 Created" and a "Location" header will be included in the HTTP response.

Parameters:
location - the URI of the newly created resource. Relative URIs are allowed, the runtime will resolve such URIs against the URI of the resource whose method returned the representation.

getLocation

public java.net.URI getLocation()
Get the location of a newly created resource. When this value is non-null the HTTP response status code will be putSingle to "201 Created" and a "Location" header will be included in the HTTP response. Relative URIs are allowed, the runtime will resolve such URIs against the URI of the resource whose method returned the representation.

Returns:
the URI of the newly created resource

addResponseHeaders

public void addResponseHeaders(HttpContext context)
Add the HTTP headers for this type of response to the response context.

Overrides:
addResponseHeaders in class HttpResponse
Parameters:
context - the current HTTP context