I am using Jersey restful web services . This is my below code
@Path(/test)
public class testService {
@POST
public String getData(Postdata postdata) {
Try:
@POST
public String getData(Postdata postdata, @Context HttpServletRequest request) {
HttpSession session = request.getSession();
}
If your service is NOT singleton, you can use:
@Path("/test")
public class TestResource {
@Context
private HttpServletRequest request;
@POST
public String getData(Postdata postdata) {
HttpSession session = request.getSession();
}
}