users@jersey.java.net

Re: [Jersey] How to understand jersey trace?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 6 Oct 2010 17:41:51 +0200

On Oct 6, 2010, at 4:46 PM, Franco Graziosi wrote:
> I am trying to understand how Jersey trace works, can anybody point a
> documentation about it?
>

There is not anything beyond the blog i wrote:

   http://blogs.sun.com/sandoz/entry/tracing_in_jersey


> Until yesterday my application worked fine, now I get a 404 and
> apparently the
> handling class is not called (at least using a debugger) and I don't
> understand
> why, since seems to be accepted (see trace 003 below).
>
> I am trying to understand what "accept" and "match" exactly mean,
> and why the
> "mapped exception to resource" occurs.
>
> I use a groovy script to submit requests to Jersey and display
> responses from an
> xml template that saves my time and shows the exact trace (by the
> way available
> to whoever wish, just email me). Here is the output of Jersey trace:
>
>
> Jersey-Trace:
> 000: accept root resource classes: "/rest/apps.legitimation"
> 001: match path "/rest/apps.legitimation" -> "/application
> \.wadl(/.*)?",
> "/([^/]+?)(/.*)?"
> 002: accept right hand path java.util.regex.Matcher[pattern=/([^/]
> +?)(/.*)?
> region=0,23 lastmatch=/rest/apps.legitimation]: "/rest/
> apps.legitimation" ->
> "/rest" : "/apps.legitimation"
> 003: accept resource: "rest" -> @Path("/{task}")
> net.sinsys.x2p.ezrest.Dispatcher_at_addd9f
> 004: match path "/apps.legitimation" -> ""
> 005: accept termination: "/apps.legitimation"
> 006: mapped exception to response:
> com.sun.jersey.api.NotFoundException_at_b1203b -> 404
>

The "accept termination" states that the terminating matching rule
(the last one) was reached, which means that no other preceding rules
could match the request.

The phrase "accept termination" is not very clear so i changed it to
"accept termination (matching failure)".

The line 004 states that the the "/apps.legitimation" will be matched
against one regular expression that is "", and of course this fails.

What are the methods on your resource class Dispatcher? are then any
sub-resource methods?

Paul.