users@jersey.java.net

[Jersey] Re: Digest for list users_at_jersey.java.net

From: Simon Roberts <simon_at_dancingcloudphotography.com>
Date: Sat, 10 May 2014 07:24:50 -0700

(Libor, I commented to this effect on your blog post)

This looks interesting, but, through ignorance, I failed at the first
hurdle... I don't know (and an hour of poking around hasn't enlightened me)
how I set these properties/how I use a ResourceConfig. I think I might be
able to make my Application class into a ResourceConfig, but I'd prefer to
partition the Jersey specific parts more cleanly than that (as I deploy to
other containers)

Can anyone point me at a trivial example that shows how to push a
ResourceConfig object "into" the Jersey system? Should it be pushed
somewhere from code? Should it be mentioned in web.xml? Should it be
injected? Perhaps something I haven't even thought of?

I did try putting

@Context Configuration conf;

in my Application class, but it crashed it with CDI failures (NetBeans 8.0/
Jersey in Glassfish 4) so I assume that's not what I'm supposed to do.

Thanks,
Simon

Hello Eric.
> No, it should be enough to set mentioned properties.
> -lk
>
>
>
> On 07 May 2014, at 15:32, Eric Stein <steine_at_locustec.com> wrote:
>
> Libor,
> Thanks for replying. I did actually find your blog post .. it was the
> link I provided in my first email. The post was very well done, and I tried
> to follow it. I somehow managed to get it working without the Debug feature
> set - I think maybe cleaning the project did it. I'm still not seeing the
> trace in the headers, though. Was there something else I needed to set
> besides those two properties (Tracing = ALL, Tracing_Threshold=VERBOSE)?
>
> Eric
>
> *From:* Libor Kramolis [mailto:libor.kramolis_at_oracle.com<libor.kramolis_at_oracle.com>
> ]
> *Sent:* Tuesday, May 06, 2014 5:20 PM
> *To:* users_at_jersey.java.net
> *Subject:* [Jersey] Re: Enable Tracing
>
> Hello.
>
> I have written blog post about configuring tracing support -
> http://yatel.kramolis.cz/2013/11/jersey-2-tracing-support.html.
>
> I expect ‘com.sun.jersey.config...’ properties are Jersey 1 specific. Do
> not you combine both Jersey versions? You can be inspired by unit tests:
> https://github.com/jersey/jersey/tree/736dd8c2d000c037bcb711d76290da8456d49446/tests/integration/tracing-support/src/main/java/org/glassfish/jersey/tests/integration/tracing
> .
>
> -lk
>
>
>
> On 06 May 2014, at 20:32, Eric Stein <steine_at_locustec.com> wrote:
>
>
> It looks like if I set the VM property
> -Dcom.sun.jersey.config.feature.Debug=true
>
> I get the log messages in the log file, but still not in the headers. Is
> there any way to set the Debug feature to true within the scope of the
> ResourceConfig?
>
> *From:* Eric Stein
> *Sent:* Tuesday, May 06, 2014 2:09 PM
> *To:* users_at_jersey.java.net
> *Subject:* Enable Tracing
>
> I'm running Jersey 2.4 and trying to enable tracing. My ResourceConfig
> looks like:
>
> *public* MyResourceConfig() {
> *super*();
>
> *this*.registerClasses(
> JacksonFeature.*class*,
> JsonFactoryResolver.*class*);
> *this*.registerClasses(
> QueryResource.*class*);
> *this*.registerClasses(
> RuntimeExceptionMapper.*class*);
> *this*.registerClasses(
> LoggingFilter.*class*);
>
> *final* Map<String, Object> properties = *new* HashMap<String,
> Object>();
> properties.put("com.sun.jersey.api.json.POJOMappingFeature",
> Boolean.*TRUE*);
> properties.put("com.sun.jersey.config.feature.Debug", Boolean.
> *TRUE*);
> properties.put(ServerProperties.*TRACING*, "ALL");
> properties.put(ServerProperties.*TRACING_THRESHOLD*, "VERBOSE");
> *this*.addProperties(properties);
> }
>
> My JerseyTest instance returns a MyResourceConfig instance from
> configure(). When I run my tests, though, I don't see any trace logged to
> my console and there's nothing in the headers:
>
>
>