dev@jsr311.java.net

Re: Redirection and creation <was> Re: Container Independence

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Tue, 17 Apr 2007 21:17:46 +1000

On 4/17/07, Jerome Louvel <jerome.louvel_at_noelios.com> wrote:
>
>
> Marc,
>
> > > I would use it only if the order of
> > > the calls doesn't really matter.
> > >
> > I like the suggestion of a builder approach for type-safe
> > building of a set of metadata.
>
> For this use case, that could be nice indeed.


Even if the order of calls are significant, there is room for using a
builder chain transparent to the user (similar to guice):
   respondWith( MyData() ) //EntityBuilder

      //ContentMetaBuilder
      .as("text/html")
      .marshalledBy( MyDataSerializer.class )

      //LocationMetaBuilder
      .foundAt("...")
      .contentFoundAt("...")

    ; //etc.

Not perhaps the best examples of headers, but you get the idea. Also, IDE
auto-completion will guide a user neatly through the steps in the metadata
"language."

> I'm OK with being a little generic in naming the setters but I think
> > we should be quite explicit about the mapping to HTTP headers (when
> > used with HTTP which I expect will be the majority of the time). I
> > don't like the idea of different implementations using
> > different HTTP headers for the same Java artifacts, that would be
> > likely to cause problems.


Is this strictly in a low-level HttpResponse (or equivalent) artifact? Or
are we talking about a high-level javabean alternative to the above?

Dhanji.