W3C home > Mailing lists > Public > public-lod@w3.org > May 2010

Re: Java Framework for Content Negotiation

From: Richard Cyganiak <richard@cyganiak.de>
Date: Thu, 20 May 2010 18:13:18 +0100
Cc: public-lod@w3.org
Message-Id: <59F57F15-3098-4375-BF9E-D60FE9A19D5B@cyganiak.de>
To: Angelo Veltens <angelo.veltens@online.de>
On 20 May 2010, at 10:49, Angelo Veltens wrote:
> I am just looking for a framework to do content negotiation in java.

There's a reasonably stable and well-tested implementation that is  
used both in the Pubby and D2R Server codebases. See here:
http://d2rq-map.cvs.sourceforge.net/viewvc/d2rq-map/d2r-server/src/de/fuberlin/wiwiss/pubby/negotiation/

This just does the negotiation part (that is, matching an HTTP Accept  
header against a list of media types that the server supports,  
including support for q values). It only supports media type  
negotiation, there's nothing for language negotiation or encoding  
negotiation in there.

The package works like this: You configure a ContentTypeNegotiator  
with the media types supported by your app. Then you use its  
getBestMatch(...) method to determine the best response for a given  
request. The PubbyNegotiator class has a pre-configured negotiator for  
a server that supports HTML and various RDF syntaxes.

Best,
Richard


> Currently I am checking the HttpServletRequest myself quick&dirty.  
> Perhaps someone can recommend a framework/library that has solved  
> this already.
>
> Thanks in advance,
> Angelo
>
Received on Thursday, 20 May 2010 17:13:52 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:29:48 UTC