From: Bill B. <bb...@re...> - 2008-12-08 14:18:29
|
I came to the conclusion earlier we needed a few different types of interceptors. 1. wrapping the resource method 2. wrapping the request (like Filters) 3. and maybe wrapping response marshalling I only implemented #1 in a private API. Solomon Duskis wrote: > There's a set/getMediaTypeMappings in SynchronousDispatcher. That's > used to transform an extention (.xml) into an accept header > ("application/xml"). There's a similar notion for languageMappings. It > shouldn't be too difficult to add in a HttpRequestInterceptor that could > be registered with the Dispatcher. > > That would reduce some clutter in SynchronousDispatcher, and also allow > some other clever processing to occur, like a queryParam affecting the > accept-header. > > What do you think? > > -Solomon > > On Fri, Dec 5, 2008 at 7:51 PM, Ryan J. McDonough <ry...@da... > <mailto:ry...@da...>> wrote: > > What I sent is indeed ugly, but that's one way you'd do custom content > negotiation in JAX-RS. However, my point was that code like could be > leveraged/refactored into some type of SPI. My issue with how JAX-RS > does it that feels like boiler plate code that really could be > refactored into something more cohesive. > > However, if your existing service only takes a query parameter to > distinguish media types, I'm not sure this is something that belongs > in JAX-RS or RESTEasy. If we expose a query parameter as a means to > perform content negotiation, we're now placing some limits on what > query parameter names can be used by applications. On the surface, > this sounds like more an application design challenge than an issue > with content negotiation. You could build an internal map of format > value which map to mime types. From there, you can a > MessageBodyWorkers to look up the appropriate provider. > > But again, if we can come up with an SPI that can you can plug this > into, you'd be free to plug this in and I am in favor of the idea of > such an SPI post 1.0. > > > > Ryan- > > > > On Dec 5, 2008, at 4:54 PM, Edelson, Justin wrote: > > > There's an existing service that uses ?format=XXX as a query string > > that > > would be nice to port to JAX-RS. The format values are NOT straight > > mime-types, more like the way you have the ability to alias mime > types > > to names in the existing resteasy.media.type.mappings functionality: > > atom : application/xml+atom > > mrss : text/xml > > html : text/html > > > > etc. etc. etc. > > > > I'll have to look into the Variant stuff that Ryan mentioned, but > that > > looked pretty ugly to me. > > > > Justin > > > > -----Original Message----- > > From: Bill Burke [mailto:bb...@re... > <mailto:bb...@re...>] > > Sent: Friday, December 05, 2008 4:33 PM > > To: Edelson, Justin > > Cc: res...@li... > <mailto:res...@li...> > > Subject: Re: [Resteasy-developers] Revisiting custom content type > > negotiation > > > > No there is not a way to plug in custom negotiation. Can you explain > > your need for it? Your use case? It would help to formulate an SPI. > > > > Edelson, Justin wrote: > >> There was a brief thread at the end of October about allowing for > >> custom content type negotiation. The outcome was that the > >> extension-based content-type selection feature would be documented. > >> This is great, but I wonder if we can revisit the initial question - > >> is there a way to allow for custom content type negotiation > >> strategies > > to be plugged into Resteasy? > >> > >> Justin Edelson > >> VP, Platform Engineering > >> MTV Networks Digital > >> > >> > >> > >> > >> > ---------------------------------------------------------------------- > >> -- > >> > >> > ---------------------------------------------------------------------- > >> -------- SF.Net email is Sponsored by MIX09, March 18-20, 2009 > in Las > >> Vegas, Nevada. > >> The future of the web can't happen without you. Join us at MIX09 to > >> help pave the way to the Next Web now. Learn more and register at > >> http://ad.doubleclick.net/clk;208669438;13503038;i?http:// > >> 2009.visitmi > >> x.com/ <http://x.com/> > >> > >> > >> > ---------------------------------------------------------------------- > >> -- > >> > >> _______________________________________________ > >> Resteasy-developers mailing list > >> Res...@li... > <mailto:Res...@li...> > >> https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > -- > > Bill Burke > > JBoss, a division of Red Hat > > http://bill.burkecentral.com > > > > > ------------------------------------------------------------------------------ > > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, > > Nevada. > > The future of the web can't happen without you. Join us at MIX09 to > > help > > pave the way to the Next Web now. Learn more and register at > > > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > > _______________________________________________ > > Resteasy-developers mailing list > > Res...@li... > <mailto:Res...@li...> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, > Nevada. > The future of the web can't happen without you. Join us at MIX09 to > help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > <mailto:Res...@li...> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |