users@jersey.java.net

Re: [Jersey] POST a collection of JAXB objects ?

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Sun, 19 Apr 2009 19:38:13 +0200

ok, my problem here continue to be the ejb reference.. since I can't
use the Grizzly test and the JerseyClient it seems not to work with
JUnit..

On the browser I can access the URL and it returns my objects, but
when I try with a normal JUnit test case it always fail..

        @Test
        public void readEvents() {
                String url = "http://fgaucho.dyndns.org:8080/footprint-service/event";
                Client client = Client.create();
                WebResource webResource = client.resource(url);
                FpEvent response = webResource.path("test4").get(FpEvent.class);
                System.out.println(response);
        }

The URL
http://fgaucho.dyndns.org:8080/footprint-service/event/test4
it will return a FpEvent type

The URL
http://fgaucho.dyndns.org:8080/footprint-service/event/test4
it will return a JAXBElement<FpEvent type>

but none works.. I am not sure if the Jersey Client works in a normal
JUnit class.......




On Sun, Apr 19, 2009 at 5:28 PM, Arul Dhesiaseelan <arul_at_fluxcorp.com> wrote:
> Hi Felipe,
>
> You could use the GenericType[1] to wrap your collection and post it to your resource.
>
> Please refer the bundled JAXB sample for details [2].
>
> -Arul
>
>
> [1] https://jersey.dev.java.net/nonav/apidocs/1.0.3/jersey/com/sun/jersey/api/client/GenericType.html
> [2] http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.0.3/
>
> ----- Original Message -----
> From: Felipe Gaúcho
> [mailto:fgaucho_at_gmail.com]
> To: users_at_jersey.dev.java.net
> Sent: Sun, 19 Apr
> 2009 02:51:57 -0600
> Subject: [Jersey] POST a collection of JAXB objects ?
>
>
>> how to post a collection of Jaxb annotated classes ? how to deserialize them
>> ?
>>
>> * in soap, I use to create an element to represent the collection of
>> the others...
>>
>> should I use Multipart form data, or how do I deserialize an url
>> encoded collection of objects ?
>>
>> --
>>
>> Please help to test this application:
>> http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>



-- 
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces