On 12/31/2012 12:42 PM, Nuwan Bandara wrote:
> Hi,
> I'm new to Resteasy $ Webservices. I'm in the process of exposing one of
> my stateless session bean remote interface as a resteasy web service.
> Application configuration is done and able to expose the methods as web
> services.

My $5 bet is that you will have a lot of problems exposing an existing 
SLSB as a RESTful service.  I suggest writing a new RESTful interface 
that delegates to the SLSB.

> Here are my questions:
>  1. I have a method that is suppose to update a one database value
>     depending on the values pass by the client. I can ether accept the
>     param as @PathParam or @QueryParam. Which one is better and why?

pathparam is part of the URL.  Use this if the Object you are talking to 
is something that exists and is more permanent (it can be linked to). 
queryparam is, well, for querying, i.e.


>  2. As I've understand I can use @GET to do this. Al the same time I see
>     @POST also can be used. Which one is better and please explain me why?

GET is for reads only.
PUT is for updates.  A PUT request should be idempotent.  meaning, no 
matter how many times you send the same exact request to the same exact 
URL, it won't change the underlying resource.  Think of PUT as saving a 
file to disk.  PUT can also be used for creates, but only if you know 
the exact URL of the resource you are creating ahead of time.

POST is for creates/updates.  It is also an anything goes method.  it is 
not idempotent.

Bill Burke
JBoss, a division of Red Hat

Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
Resteasy-users mailing list

Reply via email to