users@jersey.java.net

[Jersey] Re: Jersey 2.0

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Thu, 25 Jul 2013 17:32:16 +0200

Hi Nick,

I would suggest you go with the test client Adam provided
in the zip file, that is based on JAX-RS client API.

To play with the POST methods, you will need
to compute correct signatures for your data.

Just for curiosity, i have deployed the sample app into GlassFish 4,
and successfully run the following commands:

curl -i -Hx-signature:tk2sddeO0jepENR1MTA8MNLRB33+2q9xgQkIgqHrRuA= -HContent-type:application/xml --data '<bean><name>arabica</name><type>DARK</type><blend>mexico</blend></bean>' http://localhost:8080/roast-house/api/coffeebeans

HTTP/1.1 201 Created
X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 4.0 Java/Oracle Corporation/1.7)
Server: GlassFish Server Open Source Edition 4.0
Location: arabica
Date: Thu, 25 Jul 2013 15:24:05 GMT
Content-Length: 0


curl -i http://localhost:8080/roast-house/api/coffeebeans

HTTP/1.1 200 OK
X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 4.0 Java/Oracle Corporation/1.7)
Server: GlassFish Server Open Source Edition 4.0
x-signature: S/h9xRUFZF0lfFZ+zStjtR3dMTkG+U14vzXoCYco0Yo=
Content-Type: application/xml
Date: Thu, 25 Jul 2013 15:24:28 GMT
Content-Length: 141

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><beans><bean><name>arabica</name><type>DARK</type><blend>mexico</blend></bean></beans>

curl -i -XDELETE http://localhost:8080/roast-house/api/coffeebeans/arabica

HTTP/1.1 204 No Content
X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 4.0 Java/Oracle Corporation/1.7)
Server: GlassFish Server Open Source Edition 4.0
Date: Thu, 25 Jul 2013 15:29:02 GMT

So with GlassFish, the app works just fine. I have no experience with Tomee
(if you mean Tomcat, then i doubt the app would work as CDI is needed there),
maybe you can give GlassFish (http://www.glassfish.org) a try?

HTH,

~Jakub

On Jul 25, 2013, at 3:31 PM, Nick Khamis <symack_at_gmail.com> wrote:

> Hello Everyone,
>
> I have successfully compiled and ran the coffeebean JAX-RS 2.0 found here:
>
> http://www.oracle.com/technetwork/articles/java/jaxrs20-1929352.html
>
> And trying to make sense of things like Resource Context (Request. Response),
> Filters (Request. Response) and Interceptors (Writer, Reader), Async. It's been
> while since I have worked on server side services, and think it's a
> good time now
> with all the changes with the framework.
>
> The application runs fine contained in Tomee, and Jersey 2.0. The first problem
> I am having is firing the right service that does not cause null
> pointer exception.
> I am using curl to fire the different PUT resource and running into
> null pointers.
> I am setting breakpoint and trying to make sense of the firing order
> to know success.
>
>
> Without saying anymore for the sake of brevity, I will refrain from
> anymore detail.
> Your help is greatly appreciated.
>
> Kind Regards,
>
> Nick