users@jersey.java.net

using Form in JerseyClient

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Wed, 7 Oct 2009 18:53:32 +0200

I am trying to reproduce in code what I can do with curl:

CURL :

curl -d"name=Felipe
Gaúcho&password=test&login=fgaucho&email=fgaucho@gmail.com&url=http://fgaucho.dyndns.org:8080/arena-dwr/confirm"
http://fgaucho.dyndns.org:8080/arena-http/user

CODE:

        public int registerNewUser() {
                Form form = new Form();
                form.add(RegistrationConstants.NAME.value(), "Fake J. Unit");
                form.add(RegistrationConstants.PASSWORD.value(), "fake");
                form.add(RegistrationConstants.LOGIN.value(), "fake");
                form.add(RegistrationConstants.EMAIL.value(), "fake_at_gmail.com");
                form.add(RegistrationConstants.CONFIRMATION_URL.value(),
                                "http://fgaucho.dyndns.org:8080/arena-dwr/confirm");
                Response r = arena.path("user").post(Response.class, form);
                return r.getStatus();
        }

The response code in the code is 500 :(


The Resource Code:

        @POST
        @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
        @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
        public Response insert(@Context UriInfo info,
                        @FormParam("login") String login,
                        @FormParam("password") String password,
                        @FormParam("email") String email, @FormParam("name") String name,
                        @FormParam("url") String url, @FormParam("key") String key,
                        @FormParam("locale") String locale) {