i have a sesscion scoped bean in 2 Rest-Services, but the bean isn't SessionScoped. With JSF all works fine, but if i use RestEasy i get 2 different instances in the Services. The SessionScoped doesn't work =(.
Example:
Client
publicclassRestClient{privatestaticfinalStringuri="http://localhost:8080/xxRest"; public static void main(String[] args) { // this initialization only needs to be done once per VM RegisterBuiltin.register(ResteasyProviderFactory.getInstance()); CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); Service1 service1 = ProxyFactory.create(Service1.class, uri); Service2 service2 = ProxyFactory.create(Service2.class, uri); service1.putName("HelloWorld");System.out.println(service1.getName());System.out.println(service2.getName());}}
On server side:
Bean
@SessionScoped
public class ParamBean implements Serializable{
private static final long serialVersionUID = -3890162219225972547L;
private String name;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
Service 1
public class Service1Impl implements Service1{
@Inject
private ParamBean bean;
@Override
public String getName() {
return bean.getName();
}
@Override
public void putName(String name) {
bean.setName(name);
}
}
Service 2
public class Service2Impl implements Service2{
@Inject
private ParamBean bean;
@Override
public String getName() {
return bean.getName();
}
}
The log output is
Hello World
null -> =(
if it helps, i can send the java project.
I think the magic is in the FacesServlet, because with JSF it works fantasticly.
Thanks for help =)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Could you please raise a JIRA issue in the official RESTEasy issue tracker? https://issues.jboss.org/browse/RESTEASY
I will take a look. Also, If you could attach the java project there, it would be awesome.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i have a sesscion scoped bean in 2 Rest-Services, but the bean isn't SessionScoped. With JSF all works fine, but if i use RestEasy i get 2 different instances in the Services. The SessionScoped doesn't work =(.
Example:
Client
On server side:
Bean
Service 1
Service 2
The log output is
Hello World
null -> =(
if it helps, i can send the java project.
I think the magic is in the FacesServlet, because with JSF it works fantasticly.
Thanks for help =)
Could you please raise a JIRA issue in the official RESTEasy issue tracker? https://issues.jboss.org/browse/RESTEASY
I will take a look. Also, If you could attach the java project there, it would be awesome.