On 19:59, Imran M Yousuf wrote:
> I am using it for a CMS where the representation of a content can be
> user defined. That is, a user can say that "use this representation
> template (e.g. a velocity template) to generate x/y media format of
> this content". So what I have is user defined media types and clients
> accept media types, I want to choose the best fit of them. Please let
> me know if further clarification is needed.
>
I'm doing a similar thing and I've solved most of my problems by
creating a servlet filter that intercepts all requests and replaces the
accept header field with a request parameter if it is present (the
original header field is available by a pseudo field). This then
simplifies the rest of my code as I can rely on jersey to call the
correct resource method and generate the right data type in the response
based on the accept header. The only thing I have to do is have a
different response method for html but thinking about it now, I could
simply create MediaWriters for my data objects that return the correct
jsp pages if html is requested.. Possibly.
John