users@jersey.java.net

Some questions on the usage of LoggingFilter

From: Srinivas Naresh Bhimisetty <Srinivas.Bhimisetty_at_Sun.COM>
Date: Tue, 18 Nov 2008 09:49:48 +0530

Hi,

  I have a doubt on the usage of LoggingFilter. Can the LoggingFilter
api be used to send requests and get response the following way:
------------------------------------------------------------------------------------
        LoggingFilter loggingFilter = new LoggingFilter();
        ClientRequest request = ClientRequest.create().build(BASE_URI,
"GET");
        ClientResponse clientResponse = loggingFilter.handle(request);
------------------------------------------------------------------------------------

When I tried running the above code, the following error was thrown:
----------------------------------------------------------------------------
java.lang.NullPointerException
        at
com.sun.jersey.api.client.filter.LoggingFilter.handle(LoggingFilter.java:152)
        at
com.sun.jersey.qe.tests.jmaki.JMakiBackendWebappTest.doTestPutPrinterBasedOnId(JMakiBackendWebappTest.java:251)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        ....
--------------------------------------------------------------------------------------------------------------------

  This indicates that the ClientHandler is null. Should this handler be
set, if we want to use the API this way? If so, is there a way it could
be set?
 Moreover, is this a proper use case?

Thanks,
Naresh