[jboss-user] [EJB 3.0 Users] - JBoss 5.1.0 GA + EJB 3.0: RESTful Web Services with Jersey

longbeach do-not-reply at jboss.com
Thu Dec 10 13:02:34 EST 2009


Hi,
I am using the Jersey implementation of the RESTful API (JSR -311) in an Enterprise application using JBoss as a server.

I am using EJB 3.0 of course. Not EJB 3.1, which is still not available with JBoss.

I'd like to expose a stateless session bean as a restful web service. Here is the code of its interface :


  | import javax.ejb.Remote;
  | import javax.ws.rs.GET;
  | import javax.ws.rs.Path;
  | 
  | @Path("/something")
  | @Remote
  | public interface blablaRemote {
  | 	
  | 	   @GET
  | 	    String get();
  | 	   
  | 		//public boolean doSomething(String one);
  | 
  | }
  | 

And the code of the bean :


  | import javax.ejb.Stateless;
  | 
  | @Stateless
  | public class blablaBean implements blablaRemote  {
  | 	
  | 	public String get() {
  | 
  |         return "HELLO FROM SESSION BEAN";
  |     }
  | 
  | }
  | 

My EJBs are located in an EJB project which is inside an Enterprise application (EAR file). How do you call that exposed resftul web service ?
I do have a Web project in that Enterprise application.

If using an URL, for a GET resource, what would it be like ?

http://localhost/EARname/something  ?
http://localhost/EARname/EJBProjectName/something  ?
...

Thanks for helping.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4270052#4270052

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4270052



More information about the jboss-user mailing list