Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Content Negotiation in Jetty 9.3

See https://github.com/eclipse/jetty.project/issues/458 and https://github.com/eclipse/jetty.project/issues/459

On 29 March 2016 at 09:43, Greg Wilkins <gregw@xxxxxxxxxxx> wrote:

Bob,

Currently jetty doesn't have any particular support for content negotiation.

However, this could potentially be done as a RewriteHandler rule, which would be pretty simple in some respects as such a handler would have access to the code that already exists in Jetty to evaluate quality based header values to give an iteration of acceptable content types.       However, if the RewriteHandler is installed before a context, then it would not be able to easily ask if a resource exists or not (which may not be able to be asked if the resource is dynamic).

You could also do it as a Servlet Filter, which would have access to the context resource base, but would have to copy the code to evaluate the quality values.

While we have never really had any demand for Content-Negotiation, if somebody was to contribute either a Rule or a Filter, then we be happy to include it in future releases.  Also very happy to answer questions if you want to have a shot at writing such a rule and/or filter.

This is the quality list method.... which is actually ancient code using Enumeration (because of Servlet spec).... hmmm really should be updated and moved to HttpField class....  I'll do that in the next week or so.

cheers










On 29 March 2016 at 07:04, Bob Morris <morris.bob@xxxxxxxxx> wrote:
Short: Seeking complete example of Content Negotiation configuration in Jetty 9.3

Long:
In a jetty 9.3.6 static installation I'm trying to support Content Negotiation as required by the Linking Open Data project and dbpedia.
 
To ${jetty.home}/etc/jetty-rewrite.xml we already have added some correctly functioning regex rewrites in a rule of class RewritePatternRule. These probably could be used in a HeaderPatternRule if I am correct that this is the right place to do it. I am looking for examples of doing it this way, because I don't really follow what <Set>...</Set> elements there should be in the children of the class declaration. I can't see that HeaderPatternRule supports the forwarded return, or if that belongs there at this point at all.  An example would be welcome of some <Call> elements that supply returns, whether they go in the same <handler>, how they are related to the HeaderPatternRule, etc.

At a minimum, I'd want something like
to return the rdf that we already know how to generate and fetch by rewriting the URI simply as
http://mydataserver.edu/id/theID.rdf and requesting that.

Maybe I am confusing unrelated components of the Content Negotiation ecosystem, in which case I am clueless about what is required. Nice would be a complete functioning example.

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--



--

Back to the top