On May 20, 2009, at 4:22 PM, Rabick, Mark A (IS) wrote:
> I have an object that contains another object:
>
> Public class Node {
> public String id;
> public Map map;
> // more stuff...
> }
>
> Public class Map {
> public string id;
> // more stuff...
> }
>
> Lets say I have Node {id=1111; Map map {id=xxxx}}
>
> That is, the embedded Map is {id=xxxx}
>
> I have top-level resources for each independent entity:
>
> /nodes/{nodeId}
> /maps/{mapId}
>
> I have extended the /nodes URI:
>
> /nodes/{nodeId}/map
>
> Which I currently have returning a response with status code 300
> (Multiple Choices) that puts the addressable URI for the map in the
> Location header:
>
> /nodes/1111 // returns the Node
> /maps/xxxx // returns the Map
>
> /nodes/1111/map
>
> Returns:
> Status: 300
> Location: /maps/xxxx
>
> It basically gives me the URI of the Map for a given Node. I was
> just looking at the HTTP/1.1 spec and found
>
> 303 See Other
>
> I think this is the better status because I only have 1 choice.
> It's basically a redirect. 303/See Other is not available in
>
> javax.ws.rs.core.Response.Status
>
Here it is:
https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/core/Response.Status.html
#SEE_OTHER
and here:
https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/core/Response.html
#seeOther(java.net.URI)
>
> or
> Com.sun.jersey.api.Responses
>
> Questions:
> 1. Is See Other the best option to use for my redirect situation?
>
It looks like a good choice to me.
>
> 2. Any reason all HTTP/1.1 status codes are not included in the enums?
>
We didn't include the less useful ones to avoid cluttering the API
unnecessarily. IIRC, we included those listed as medium or above
importance in the RESTful Web Services book.
Marc.