On Nov 28, 2009, at 1:36 PM, Felipe Gaúcho wrote:
> I want to create a Jersey resource that returns the URI of a google
> graph:
>
> like: http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello
> |World
>
> so, this resource will calculate the graph parameters and return the
> compelte URI a client can use to show a graph in an html page...
>
> what is the most correct HTTP Response type for that ?
>
> 1) Response.created(uri)
> 2) Response.seeOther(uri)
> 3) other ??
>
The Location response header with a 204 response might be appropriate,
because:
"The Location response-header field is used to redirect the
recipient to a location other than the Request-URI for completion of
the request..." [1]
Otherwise send the string of the URI as a response entity.
I do not think a 201 makes sense because i am not sure you are not
really creating a new resource. A 303 response must not be cached. A
307 response would be convenient for automatic redirection.
Paul.
[1]
http://greenbytes.de/tech/webdav/rfc2616.html#header.location