dev@jsr311.java.net

RE: Representation<T> and Entity<T>

From: Jerome Louvel <jerome.louvel_at_noelios.com>
Date: Thu, 12 Apr 2007 10:44:09 +0200

Hi Roy,

> > HTTP definition of the "Location" header:
> > "The Location response-header field is used to redirect the
> > recipient to a
> > location other than the Request-URI for completion of the request or
> > identification of a new resource."
>
> Now that's a poorly constructed sentence. The last "or" refers back
> to the "is used". In other words, Location is used for identification
> of a new resource or redirection to a new location.

Ok, that makes sense. This should ideally be clarified in the next HTTP spec
revision.

> > Note that they mention "to redirect", so @RedirectRef seems more
> > explicit
> > and removes the ambiguity with the other "Content-Location" HTTP
> > header.
>
> Nope. There are at least four distinct types of redirection in
> addition to the other uses of Location. A meaningful annotation
> should distinguish the semantics rather than match the HTTP field
> names that happen to be reused in various ways.

Agreed. To distinguish between various redirection types, we could have a
'type' attribute on a "@RedirectionRef" annotation:

        @RedirectionRef(type=PERMANENT)
        public URI getRedirectURI();

Also, we could add a "@CreationRef" annotation.

@WebResource(uri="/pathToMyResource/{id}")
public class MyPojo{

        @CreationRef
        public String getIdentifier() {...}

}

Best regards,
Jerome