How to get a session in ERRest?
How to get a session in ERRest?
- Subject: How to get a session in ERRest?
- From: Pascal Robert <email@hidden>
- Date: Fri, 27 May 2011 11:28:25 -0400
How do I get a session in ERRest? I was thinking that touching the session() object would be enough to get a cookie with the session ID in it, like this:
public WOActionResults loginAction() throws Throwable {
try {
String username = request().stringFormValueForKey("username");
String password = request().stringFormValueForKey("password");
Member member = Member.validateLogin(session().defaultEditingContext(), username, password);
NSLog.out.appendln(session().sessionID());
return response(member, ERXKeyFilter.filterWithNone());
} catch (MemberException ex) {
return errorResponse(ex, 401);
}
}
session().sessionID() does contains a session ID, but no session ID is sent in the response (I do have setStoresIDsInCookies(true) in Session). Now, if I redirect to another page (eg, pageWithName(Main.class) instead of response(member, ERXKeyFilter.filterWithNone()), I do get the cookie with the session ID.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden