-
1. Re: Seam Conversation thru Web Service
tom_goring May 19, 2008 5:34 PM (in response to rcridlig)Hi,
I think you need to do both.
I.e. make sure your ws client always propagates the conversationId AND make sure you have actually started a long running conversation in your seam back end.
-
2. Re: Seam Conversation thru Web Service
bgroeneveld Jan 13, 2010 9:04 PM (in response to rcridlig)We appear to be running into the same issue. We have defined a RESTEasy service which works nicely, stateless, and we can get it to read / write to our db. Now we would like to take advantage of Seam's extended persistence context by having the stateless service interact with conversationally scoped Seam components. To test this we setup a seam app defaulting on startup to MANUAL flush mode
<core:manager default-flush-mode="MANUAL"
so we can demonstrate flushing to the db after a second HTTP request to the service while it interacts with conversationally scoped Seam components - but no luck so far. We have even added this to our config, according to the manual:
<resteasy:application destroy-session-after-request="false"/>
Recommendations?
-
3. Re: Seam Conversation thru Web Service
ndipiazza Oct 20, 2010 2:34 PM (in response to rcridlig)I think I am having the same problems. I am developing with jboss seam 4.2.3 and making a very very simple REST web service.
I just login with one REST method doLoginRest, and then secondly i check to see if the login is valid with the REST method testLogin.
I login, then i call the testLogin method and clearly the login did not stick between method invocations.
I have <resteasy:application destroy-session-after-request="false"/> set in my components.xml file.
Any ideas?
My code is below.
@Scope(ScopeType.SESSION)
@Transactional
public class MyClass {
@In(required=false) private User currentUser; // don't have to be logged in to use this class
/**
* Do the login as a REST service.
*/
@GET
@Path("/doLogin")
public String doLoginRest(@QueryParam("userId") String userId, @QueryParam("password") String password) throws IOException {
Credentials creds = identity.getCredentials();
creds.setUsername(userId);
creds.setPassword(password);
identity.setRememberMe(true);
Context session = Contexts.getSessionContext();
currentUser = (User) session.get("currentUser"); // This at this point is NOT null, login worked!!!
return identity.login();
}
/**
* Test if the login worked
*/
@GET
@Path("/testLogin")
public String doTestLogin() {
Context session = Contexts.getSessionContext();
currentUser = (User) session.get("currentUser");
return ""+(currentUser != null); // This is false everytime
}
}