Create Session in Restful service in EJB module
I am using Restful Service wi开发者_C百科th resteasy implementation and turn ejb. I want to know how we create create session and maintain state in REST service in this case. Is there any examples available?
Simple example what I use:
@Stateless
public class TestResource implements TestResourceLocal {
@Override
public test test(String id, String param) {
//todo
}
}
@Local
@Path("/affilate")
public interface AffiliateResourceLocal {
@GET
@Path("{id}-{param}")
@Produces("application/json")
public void test(@PathParam("id") String id, @PathParam("param") String param);
}
This question talks about state and REST, might be interesting reading for you.
One of the constraints of REST is the stateless constraint, meaning each request from the client contains all data to service the request and any client state is stored on the client.
精彩评论