Re: Redirection and creation

From: Dhanji R. Prasanna <>
Date: Fri, 13 Apr 2007 12:07:58 +1000

On 4/13/07, Marc Hadley <> wrote:
> To sketch it out a little more:
> - the API defines a set of fine grained annotations for metadata
> (media-type, location, content location, language etc)


- an @HttpMethod/_at_Method/_at_WebMethod annotated method could return any
> type of object or primitive type

This is roughly what I suggested in another thread and like it but for the
return type of Object (in cases where u have multiple return points)

E.g. the current TemporaryRedirect class would become something like:
> public class TemporaryRedirect extends HttpResponse {
> ...
> @RepresentationLocation
> public URI getLocation() {...}
> }
> But any user-defined class could also set the location header using
> the annotation, the TemporaryRedirect class would be a convenience
> class for those that don't want to define their own (the majority I
> suspect).

If you do, it should be hidden behind a factory similar to JCF's Collections
or j.u.c's Executors factory:


And make it an anonymous or package-local class. There is no point in
exposing such a class as part of the api (unless you want users to be able
to extend TemporaryRedirect, PermanentRedirect etc., which I think is

I prefer this to forcing the user to inject Context and calling some setters
on it.