users@jersey.java.net

Re: [Jersey] form to pojo

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 16 Feb 2010 22:11:55 +0100

Hi Trolly,

You can do this:

public class MyFormBean {
   @FormParam("x") String s;
   @FormParam("y") String y;
}

@Path("/")
public class MyResource {
   @POST
   public void post(@Inject MyFormBean f) {
     ...
   }
}

The same construction/injection rules apply to MyFormBean as they do
for any resource class.

Hth,
Paul.

On Feb 16, 2010, at 6:17 PM, Trolly Rogers wrote:

> Hi All - I think I'm overlooking something obvious in the Jersey
> documentation. Is there any out of the box way for Jersey to bind a
> posted form to a pojo? I'm convinced there is, I just can't find any
> info on it.
>
> The link below is what I'm looking to do (minus the custom message
> body reader coding).
>
> http://wikis.sun.com/display/Jersey/getting+form+data+as+a+populated+javabean
>