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

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 16 Apr 2007 12:05:52 -0400

On Apr 16, 2007, at 2:13 AM, Jerome Louvel wrote:
>> I would suggest the
>> api should be more exemplary and guide the developer. I like
>> using a set of Builder patterns:
>> Response.respond(new MyDataObject())
>> .as("text/html")
>> .marshalledBy(MyDataObjectSerializer.class)
>> .expiringOn(...)
>> .foundAt(" ");
>> //etc.
> We experienced with this pattern in the Restlet API prototypes. The
> reactions were mixed. 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.

>> Now, the underlying composition can derive from a low-level
>> HttpResponse or be (similar to) a map of bindings (header ->
>> value), but this is all plumbing hidden from an end user (for
>> the majority of cases).
>> The use of an EDSL (embedded domain-specific language) also
>> gives us a type-safe and readable high-level api as opposed
>> to something like:
>> reponse.getHeaders().add("content-type", "text/xml");
>> //or binding to javabean properties:
>> setContentType("text/html");
>> setLocation("http://...");
> I think that we should provide a mapping from those important HTTP
> data to
> high-level properties or annotations, we should not be too explicit
> about
> the way they are mapped to HTTP headers (their semantics should be
> precise
> however). This concrete mapping should be implementation specific.
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


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