users@jersey.java.net

Re: [Jersey] Post entity with Webresource

From: xworker <andreas_at_onecoder.com>
Date: Fri, 11 Sep 2009 01:48:26 -0500 (CDT)

Hi

Tried that. Like this:

 PermitConverter p = new PermitConverter();
       p.setPermitName("test");
       

        wr =
client.resource("http://localhost:8080/permit-backend/resources/permits");
        wr.post(new GenericType<PermitConverter>(){}, p);

Got this exception:
 javax.faces.el.EvaluationException:
com.sun.jersey.api.client.ClientHandlerException:
java.lang.IndexOutOfBoundsException: Index: 0, Size:0


Naresh-11 wrote:
>
> Hi,
>
> xworker wrote:
>> Hi
>>
>> Im trying to do a simple post with an entity from my backingbean to my
>> REST
>> ws service.
>>
>> Something like this:
>>
>> webresource.post(ClientResponse.class, myEntity);
>>
>> Whats the correct way of doing this?
> you can definitely do it this way.
>> All the examples I've seen just send
>> strings and not entitys.
>>
> Please refer the JAXB sample's [1] MainTest class. Most of the test
> methods of this test class, use post() method for actually POSTing
> entities.
>
> [1]
> http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.1.3-ea-SNAPSHOT/jaxb-1.1.3-ea-SNAPSHOT-project.zip
>
> -Naresh
>> /xw
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>

-- 
View this message in context: http://n2.nabble.com/Post-entity-with-Webresource-tp3623826p3623907.html
Sent from the Jersey mailing list archive at Nabble.com.