dev@jsr311.java.net

Re: JSR311: Limit extensions pre-processing

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 11 Jul 2008 12:38:48 -0400

Stephan Koops wrote:
> Hi,
>
> Marc Hadley schrieb:
>> On Jul 9, 2008, at 8:30 PM, Roy T. Fielding wrote:
>>> [...]
>> Given the above I think the only reasonable thing to do right now is
>> to remove the automatic URI-based conneg feature. Even limiting it to
>> safe operation would violate the mapping of specific resources to
>> generic resource classes. If we had a longer than the two weeks
>> remaining before proposed final draft we could perhaps investigate
>> other approaches but that's not an option for this rev of the
>> specification.
> If a browser access a resource, some browsers (e.g. IE 7, FF 2) will
> request XML with a higher priority than HTML. Not fine, but it's the
> reality. So I think for GET (inclusive HEAD), OPTIONS and other safe
> methods it is good.
>

IMO, just create new Java methods to do things. Its a little more
verbose, but... so what?


@Path("foo.html")
@Produces("text/html")
@GET
public String getHtml() {...}


@Path("foo.xml")
@Produces("application/xml")
@GET
public String getXml() {...}


@GET
@Produces("application/xml", "text/html")
@Path("foo")
public Response get() {
    if (wantsHtml) return Response.entity(getHtml());
    else if (wantsXml) return Response.entity(getXml());
}

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com