Viggo Navarsete wrote:
No, the "Testing Value" will not be there on the second request! But, it shouldn't be too difficult for you to actually test it, or? But I would assume that if you set a value on the simpleSingletonBean on the first request, then it would still be there on the second request!
I did try an example and below are the codes
package com.sample.rest.service;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.test.ejb.PrimaryStatelessBean;
import com.test.ejb.SampleSingletonBean;
@Stateless
@Path("/services")
public class PrimaryStatelessBean{
@EJB
PrimaryStatelessBean primaryStatelessBean;
@EJB
SampleSingletonBean sampleSingletonBean;
@GET
@Path("/getValue")
@Produces("text/xml")
public String getValue(){
//To get initial value
System.out.println("Before Setting Value::" + primaryStatelessBean.getMessage());
//set value for the Bean
primaryStatelessBean.setMessage("Hi Buddy Cool!!");
//After setting value
System.out.println("After Setting Value::" + primaryStatelessBean.getMessage());
return "<MESSAGE>"+primaryStatelessBean.getMessage()+"</MESSAGE><REQUEST_COUNT>"+ sampleSingletonBean.getCount() +"</REQUEST_COUNT>";
}