new session on each request
new session on each request
- Subject: new session on each request
- From: Zak Burke <email@hidden>
- Date: Thu, 24 Jan 2008 13:40:35 -0500
I'm going a little bit mad here. I am working on a new app and cannot
get session management to work correctly. Requests to the root of the
app (.../simple.woa) generate new sessions; requests generated from
within the app (submitting a form) reuse existing sessions. I must
have some basic setting goofed up, but I cannot figure out what it is.
I am running MacOS 10.4.x; Apache 1.3; WO 5.3; Eclipse 3.3.1.1;
WOLips 3.3.4763.
I have simplified this to the point of creating a brand new
WebObjects Application from the "File > New..." menu and doing
nothing but adding some debugging to Application.java, telling
Session.java to store info in cookies and overriding
domainForIDCookies to return "/", and adding a form to Main.java that
stores some trivial data in the session.
Submitting the form works fine; I can submit again and again and the
same session is used. I see post URLs like this:
http://localhost/wo/WebObjects/simple.woa/wo/0.4
As soon as I try to re-enter the application, however, by visiting
the root URL,
http://localhost/wo/WebObjects/simple.woa
a new session is created.
Here is the debugging I've added to Application.java:
public WOSession _initializeSessionInContext(WOContext context) {
WOSession session = super._initializeSessionInContext(context);
NSLog.out.appendln("SESSION CREATED IN CONTEXT");
return session;
}
public WOSession restoreSessionWithID(String sid, WOContext c) {
NSLog.out.appendln("RESTORING SESSION WITH ID " + sid);
WOSession session = super.restoreSessionWithID(sid, c);
return session;
}
public WOResponse dispatchRequest(WORequest r) {
NSLog.out.appendln("COOKIES: " + r.cookies());
return super.dispatchRequest(r);
}
Here is output from the log:
FIRST RQUEST: .../simple.woa/
COOKIES: (<com.webobjects.appserver.WOCookie name=woinst value=("1")
path=null domain=null isSecure=false>,
<com.webobjects.appserver.WOCookie name=wosid value=
("iHZpiQht9xREEO8ObOsAlw") path=null domain=null isSecure=false>)
Initialized session 1: nS0KIh62645y4OOwzlmC0w
SESSION CREATED IN CONTEXT
SECOND REQUEST: form submission from .../simple.woa/
COOKIES: (<com.webobjects.appserver.WOCookie name=woinst value=("1")
path=null domain=null isSecure=false>,
<com.webobjects.appserver.WOCookie name=wosid value=
("nS0KIh62645y4OOwzlmC0w") path=null domain=null isSecure=false>)
RESTORING SESSION WITH ID nS0KIh62645y4OOwzlmC0w
THIRD REQUEST: form submission from .../simple.woa/wo/0.4
COOKIES: (<com.webobjects.appserver.WOCookie name=woinst value=("1")
path=null domain=null isSecure=false>,
<com.webobjects.appserver.WOCookie name=wosid value=
("nS0KIh62645y4OOwzlmC0w") path=null domain=null isSecure=false>)
RESTORING SESSION WITH ID nS0KIh62645y4OOwzlmC0w
FOURTH REQUEST: .../simple.woa/
COOKIES: (<com.webobjects.appserver.WOCookie name=woinst value=("1")
path=null domain=null isSecure=false>,
<com.webobjects.appserver.WOCookie name=wosid value=
("nS0KIh62645y4OOwzlmC0w") path=null domain=null isSecure=false>)
Initialized session 2: 9SVOQyQrdNTKaNlrgK4uyM
SESSION CREATED IN CONTEXT
It's slightly fishy to me that WO is reporting the path and domain as
null, but when I look at the cookie in Firefox those values are
correctly filled in (/ and localhost, respectively). Besides, the
same cookie is correctly read in requests two and three, when the
session is restored.
Any ideas? I'm totally stumped.
zak.
_______________________________________________
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