users@jersey.java.net

[Jersey] Trying to write a MessageBodyReader for application/x-www-form-urlencoded

From: Jason Erickson <jason_at_jasonerickson.com>
Date: Wed, 2 Nov 2011 11:45:45 -0700

What I would like to do is something like this:

@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void submitPerson(Person person) {
        personDao.save(person);
}


There might be more to it, but that's the gist. I tried to write a MessageBodyReader<Person> that consumes application/x-www-form-urlencoded, but the readFrom method simply takes an InputStream. I was going to transform that into a MultivaluedMap<String, String> but that's turning out not to be very straightforward for me (I can't instantiate my own). Is there something I'm missing? Do I just have to get down to the nuts and bolts of reading the InputStream and constructing my own map?