users@jersey.java.net

Re: [Jersey] FormParam problem in InjectableProvider and Spring

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 19 Nov 2009 13:39:59 +0100

On Nov 19, 2009, at 1:19 PM, Cemo Koc wrote:

>
> Hi,
>
> @Inject annotation can not work me. I can see these logs at my console
>
> [#|2009-11-19T14:05:54.450+0200|SEVERE|sun-appserver2.1|
> com.sun.jersey.spi.container.ContainerRequest|
> _ThreadID=26;_ThreadName=TP-Processor3;_RequestID=d0825c03-00a7-4c9d-
> bbb7-778764691361;|A
> message body reader for Java type, class xxx.Sample, and MIME media
> type,
> application/x-www-form-urlencoded, was not found|#]
>

That indicates you are not using the latest bits. What is the date of
the Jersey version output in the logs?


>
> And for your other question, I wanted to say that I suspected about
> one
> thing... While I was debugging, I saw such a thing... I just want
> to share
> with you....
>
> http://img36.imageshack.us/img36/7444/prtscrcapture2o.jpg
>
> http://n2.nabble.com/file/n4031501/prtscrcapture2o.jpg
>

That is really odd. It makes no sense because they are all registered
as follows in WebApplicatonImpl:

        // Add per-request-based injectable providers
        injectableFactory.add(new CookieParamInjectableProvider(mpep));
        injectableFactory.add(new HeaderParamInjectableProvider(mpep));
        injectableFactory.add(new HttpContextInjectableProvider());
        injectableFactory.add(new MatrixParamInjectableProvider(mpep));
        injectableFactory.add(new PathParamInjectableProvider(mpep));
        injectableFactory.add(new QueryParamInjectableProvider(mpep));
        injectableFactory.add(new FormParamInjectableProvider(mpep));


>
> And the test case testFormParamBean in FormParamTest is running
> perfectly.
>

I updated those tests. For example there is a test for the following:

    @Path("/")
    public static class FormResourceBeanNoFormParam {
        @POST
        @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
        public String post(@Inject ParamBean pb) {
            return pb.a + pb.b;
        }
    }

Paul.