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 02:50:22 -0700

It seems like some of the jersey template related stuff is too magical. It
would be far better if path resolution was required to be explicitly
defined in the code, such as @Template (autoResolve = true) or something
like that. Even though I read the docs, it wasn't obvious that it was
resolving to package/Class/index.jsp by default, for example. So, even
running it in tomcat, and it still didn't work.

I'm going to see if I can define exactly why I couldn't figure it out
initially, so that perhaps I can suggest an update to the docs. But yes,
another one of the aspects of it not working, leading me in wild goose
chase, was that the grizzly container does not work with templates.

Was it not working with the light weight containers documented anywhere in
the docs? It certainly doesn't appear that it was.

On Sat, Feb 20, 2016 at 2:28 AM, Mark Thornton <mthornton_at_optrak.com> wrote:

> What container are you using? As far as I can recall, HttpServletRequest
> is injected when running in a servlet container. It does not work in any of
> the Http server containers (Grizzly, Jetty, JDK). The main thing I want
> from a servlet request is the remote IP address, the absence of which is
> awkward in the non servlet containers.
>
> Regards,
> Mark Thornton
>
> On 19 February 2016 at 22:36, Trenton D. Adams <trenton.d.adams_at_gmail.com>
> wrote:
>
>> Good day,
>>
>> 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
>>
>> 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.
>>
>
>