users@jersey.java.net

[Jersey] Re: custom injector not working

From: Trenton D. Adams <trenton.d.adams_at_gmail.com>
Date: Sat, 20 Feb 2016 17:43:30 -0700

Okay, I found my problem. I initially started out using a custom
ResourceConfig, because I was using grizzly. For some reason, I was under
the impression that in a servlet environment it would simply be detected.
So, I didn't put 2 and 2 together regarding web.xml configuration vs
ResourceConfig configuration. Since I had some of the features configured
in web.xml, and they were working, but I also had them in ResourceConfig, I
was under the impression my ResourceConfig was working.

I'm guessing that the docs can be updated to be more clear on
ResourceConfig loading, but I'm not sure how yet. I'll think about it, and
see if I can change the docbook stuff to save someone else the grief.
Overall, the documentation is quite good, it's just a bit glitchy for a
newb. :D

Anyhow, I've now removed all my configs from web.xml, and replaced them
with...
<init-param>
    <param-name>javax.ws.rs.Application</param-name>
    <param-value>com.example.MyResourceConfig</param-value>
</init-param>

And all my problems vanished.

I'm on research and study leave one week out of every 3, so I'll probably
work on updating those docs in a couple of weeks.



On Sat, Feb 20, 2016 at 1:51 PM, Trenton D. Adams <trenton.d.adams_at_gmail.com
> wrote:

> Cool. I've always wanted to take a look at docbook. Is there an editor
> that's used for that? Or just editing of the raw xml?
>
> On Sat, Feb 20, 2016 at 1:44 PM, Jakub Podlesak <jakub.podlesak_at_oracle.com
> > wrote:
>
>> I believe you are looking for this:
>> https://jersey.java.net/contribute.html
>> You should be able to submit a pull request (see Submit patches section).
>>
>> Cheers,
>>
>> ~Jakub
>>
>>
>> On 20.2.2016 21:32, Trenton D. Adams wrote:
>>
>> So is there a way of doing unit testing on stuff like this then?
>>
>> Also, it would be nicer if the docs had prominent warning there, that it
>> will *not* work with grizzly. I was just under the assumption that grizzly
>> was a servlet container. I am completely new to all of this, so it's good
>> if documentation tries to be explicit. Especially when some stuff does
>> work with grizzly, and some stuff does not.
>>
>> Who's in charge of them? I'm assuming there's a git repo somewhere that
>> I could fork, and suggest some changes to them?
>>
>> On Sat, Feb 20, 2016 at 12:56 PM, Jakub Podlesak <
>> jakub.podlesak_at_oracle.com> wrote:
>>
>>> Hi Trenton,
>>>
>>> The docs seems fine to me. It states: "The following examples should
>>> work on top of Jersey Servlet integration module.".
>>> Since your code is based on Grizzly HTTP server, it does not fit the
>>> above condition (i.e. there is no Servlet container in your play).
>>>
>>> Maybe you just want to rewrite your code to run on a Servlet container?
>>>
>>> HTH,
>>>
>>> ~Jakub
>>>
>>>
>>> On 20.2.2016 01:06, Trenton D. Adams wrote:
>>>
>>> Good day,
>>>
>>> Apparently I sent this prior to being approved on the list. Here we go
>>> again...
>>>
>>> Okay, so, following the guide at
>>> https://jersey.java.net/documentation/latest/user-guide.html#d0e16644 results
>>> in code at https://gist.github.com/anonymous/e16a60970e9f1e42c536 and
>>> except stack trace at
>>> <https://gist.github.com/anonymous/56676819f74ecefd604c>
>>> https://gist.github.com/anonymous/56676819f74ecefd604c
>>>
>>> It seems like Jersey doesn have an HttpServletRequest injector, so my
>>> injector doesn't work. Is that right? And if so, do the docs maybe need
>>> to be updated?
>>>
>>> Either way, how do I go about following the guide, and getting a custom
>>> injector working?
>>>
>>> Thanks.
>>>
>>>
>>>
>>
>>
>