users@jersey.java.net

[Jersey] Re: ResourceMethodDispatchAdapter in 2.0?

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Tue, 2 Jul 2013 12:01:52 -0700

Could Jackson Guava module help with Optional handling? It can't do much
wrt wiring to 404, but perhaps combination of error reporting from module
(proper jackson exception that can be caught at a later point) and default
exception handling could do the trick.

-+ Tatu +-



On Mon, Jul 1, 2013 at 3:22 PM, Coda Hale <coda.hale_at_gmail.com> wrote:

> Any ideas?
>
>
> On Tue, Jun 18, 2013 at 9:04 AM, Coda Hale <coda.hale_at_gmail.com> wrote:
>
>> I have more than a few use cases. :)
>>
>> First, I have an implementation which records the elapsed time spent
>> inside the resource method using my Metrics library. I haven't found a way
>> of doing this which allows me to directly observe the method invocation.
>>
>> Second, I have an implementation which, if the resource method returns a
>> Guava Optional without a value, returns a 404. Otherwise, it passes the
>> Optional's value to the MessageBodyWriter. I tried writing a filter for
>> this, but then Jersey refuses the resource method because
>> Optional<Whatever> doesn't have a MessageBodyWriter. I tried writing a
>> MessageBodyWriter, but trying to inject the MessageBodyWorkers equivalent
>> was producing dependency cycles in HK2.
>>
>> Third, I have an implementation which wraps the resource method
>> invocation in a Hibernate unit of work. Like the first example, this needs
>> to directly wrap the invocation.
>>
>> Any advice is appreciated, thank you.
>>
>>
>> On Tue, Jun 18, 2013 at 8:18 AM, Marek Potociar <
>> marek.potociar_at_oracle.com> wrote:
>>
>>> Hi,
>>>
>>> We have not ported this API to Jersey 2.0 yet. We would like to first
>>> understand the use cases where the API is used and see if there is perhaps
>>> a better way of solving those. Can you please share more details about you
>>> use case?
>>>
>>> Many thanks,
>>> Marek
>>>
>>>
>>> On Jun 15, 2013, at 1:52 AM, Coda Hale <coda.hale_at_gmail.com> wrote:
>>>
>>> I'm trying to find the best way of porting ResourceMethodDispatchAdapter
>>> implementations, but coming up a bit short.
>>>
>>> Any suggestions?
>>>
>>> --
>>> Coda Hale
>>> http://codahale.com
>>>
>>>
>>>
>>
>>
>> --
>> Coda Hale
>> http://codahale.com
>>
>
>
>
> --
> Coda Hale
> http://codahale.com
>