users@jersey.java.net

[Jersey]

From: <alee_at_ufi.com>
Date: Fri, 19 Aug 2011 11:49:10 +0000 (GMT)

Hi,

I'm a bit confused.

I've created an injectable that extends AbstractHttpContextInjectable
(As discussed here:
http://codahale.com/what-makes-jersey-interesting-injection-providers/)
.

My Service method is a @PUT and the injectable is correctly attempting
to inject the value and calls my T getValue(HttpContext context)
method.

Inside this method I try to get the form by calling:
Form form = context.getRequest().getFormParameters()

The returned form is empty. If I make the method call twice in
succession then the second call will return the populated form!:
context.getRequest().getFormParameters() ;
Form form = context.getRequest().getFormParameters() ;

After looking at the FormParamInjectable I noticed it checks the
properties first:
Form form =
context.getProperties().get(FormDispatchProvider.FORM_PROPERTY);

The form in the properties is populated in my case, so my temporary
solution is:
 Form form =
context.getProperties().get(FormDispatchProvider.FORM_PROPERTY);
        if (form == null) {
            form = context.getRequest().getFormParameters();
        }

and this works, but I would have thought that getting the params via
the request would just work - is this a bug?

Cheers,
Andy

FYI
I'm using Jersey 1.8 with Java 1.6 and deploying the app on Jboss.