Re: When a session is created?
Re: When a session is created?
- Subject: Re: When a session is created?
- From: Chuck Hill <email@hidden>
- Date: Mon, 20 Jun 2005 10:07:19 -0700
In addition to Mark's excellent advice, check any JavaScript you are
using. If a link is submitting the form, ensure that the script is
returning false. Another good debugging technique for this is to
override dispatchRequest in Application and log out request().uri().
This, combined with the session logging below, will show were in the
page the errant request is coming from.
Chuck
On Jun 20, 2005, at 5:53 AM, Mark Ritchie wrote:
On 20-Jun-05, at 2:59 AM, Sébastien Gruhier wrote:
I would like to know when a session is supposed to be created
because I have noticed that a new session is created on each
submit of a form.
Hi Sébastien,
If this problem happens every time then I would use the debugger
and set a break point on session creation to see what's happening.
When that's not the case, when it happens intermittently then I
sometimes resort to something like this. I override the session
constructor and log when the session is created, it's sessionId and
the stackTrace so I can see exactly how the session is being
created. This has been very enlightening over the years. I hope
it helps:
public Session() {
super();
String message = "Session created (sessionID:" + sessionID
() + ")";
NSLog.err.appendln(message);
new Exception(message).printStackTrace();
}
When a session is created in response to a component action, the
output will look something like this:
[2005-06-20 08:25:00 EDT] <WorkerThread0> Session created
(sessionID:AVSmK1ZBBYLDgt2uI3GbYw)
java.lang.Exception: Session created
(sessionID:AVSmK1ZBBYLDgt2uI3GbYw)
at Session.<init>(Session.java:18)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at com.webobjects.foundation._NSUtilities.instantiateObject
(_NSUtilities.java:577)
at
com.webobjects.appserver.WOApplication.createSessionForRequest
(WOApplication.java:1611)
at
com.webobjects.appserver.WOApplication._initializeSessionInContext
(WOApplication.java:1752)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchW
ithPreparedApplication(WOComponentRequestHandler.java:309)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleReq
uest(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleRequ
est(WOComponentRequestHandler.java:432)
at com.webobjects.appserver.WOApplication.dispatchRequest
(WOApplication.java:1306)
at com.webobjects.appserver._private.WOWorkerThread.runOnce
(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run
(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
Good Luck!
Mark.
__
Mark Ritchie
Diamond Lake Consulting Inc.
Toronto, Ontario, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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