users@jersey.java.net

New feature - ResourceDebuggingFilter

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Tue, 15 Sep 2009 16:52:32 +0200

Hello,

many request has been made for a possibility of tracking resource/path
matching process. Jersey now offers a way to do this - server side
filter, which is aimed to debugging stage of development.

This filter logs matching process of every request. Output looks like
following for every match level (it actually differs; depend on whats
being matched - Resource method, Sub-Resource method or Sub-Resource
locator).

====================
[#|2009-09-15T16:34:15.438+0200|INFO|glassfish|com.sun.jersey.api.container.filter.ResourceDebuggingFilterFactory.AbstractRequestFilter|_ThreadID=30;_ThreadName=Thread-3;|Sub-Resource
Locator matched.
 Path: sub01
 Matched Result: java.util.regex.Matcher[pattern=/sub01(/.*)?
region=0,20 lastmatch=/sub01/subsub01/lala]
 Resource: com.sun.jersey.samples.helloworld.resources.Path02
 Method: public com.sun.jersey.samples.helloworld.resources.Path02_sub01
com.sun.jersey.samples.helloworld.resources.Path02.Sub01()|#]
====================

Filter is present in 1.1.3-ea-SNAPSHOT version of Jersey. If you want to
enable this filter in your application, all you have to do is add init
param to web.xml:

        <init-param>
            
<param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
            
<param-value>com.sun.jersey.api.container.filter.ResourceDebuggingFilterFactory</param-value>
        </init-param>


Feel free to reply into this thread if you have any comments /
suggestions about this.

Regards,
Pavel