Re: Representation<T> and Entity<T>

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 11 Apr 2007 10:20:31 -0400

On Apr 11, 2007, at 6:07 AM, Jerome Louvel wrote:
> I propose to unify Entity, HttpRequestContext and
> HttpResponseContext into a
> single Context class that could be inject at the local variable
> level and
> eventually at the parameter level.
You mean like HttpContext :-). You can already write:

public class SomeResourceClass {

   HttpContext context;


The context field is initialized via injection when an instance is
created. The @Resource annotation is one of the common annotations
defined by JSR 250 and given that one can expect that this annotation
will be used in JSR 311 application classes I think we need to avoid
using the same name for any of our annotations :-(.

> It would be a two-way communication point with the API
> implementation and
> could contains methods such as:
> get/setInput(): Representation<T>
> get/setOutput() : Representation<T>
That is in line with the design of the context interfaces though
currently HttpRequestContext and HttpResponseContext manage the
request and response separately. We can discuss whether that is more
or less confusing than mixing the methods in a single interface.
Personally I quite like the separation.


Marc Hadley <marc.hadley at>
CTO Office, Sun Microsystems.