You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mfs <fa...@gmail.com> on 2008/04/17 06:36:13 UTC

jsessionId - is there a way to generate/set in the container

Guys,

Might not be the question for this list, but still to thought to check.

Is there a way i can provide the unique sessionID to the servlet
api/container, instead of it generating its own (whenever a new HttpSession
is created). Actually we have our own session tracking framework, and now
that i am making a seperate servlet based application, i have come to need
to support interoperability between Servlet HttpSession and the sessions
maintained by our session-tracking framework. 

Given the above context, i was wondering if there is some way i can provide
my own unique sessionId to the servlet container whenever it creates a
unique http session against a user.

Thanks in advance and Regards,

Farhan.
-- 
View this message in context: http://www.nabble.com/jsessionId---is-there-a-way-to-generate-set-in-the-container-tp16738580p16738580.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsessionId - is there a way to generate/set in the container

Posted by mfs <fa...@gmail.com>.
so thats not something exposed by the servlet api itself...if i understand u
correctly?, well though for my development i use tomcat/jetty servlet
containers, but our app is deployed on the oracle app server, which has its
own mini servlet engine (OSE), now given that i would need to extend the
session managers of each and provide my own, and i am getting a stomach ache
by just thinking about it.

Farhan.


markt-2 wrote:
> 
> mfs wrote:
>> Given the above context, i was wondering if there is some way i can
>> provide
>> my own unique sessionId to the servlet container whenever it creates a
>> unique http session against a user.
> 
> You would need to write your own manager. You should be able to extend 
> org.apache.catalina.session.StandardManager and override
> generateSessionId()
> 
> See also http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jsessionId---is-there-a-way-to-generate-set-in-the-container-tp16738580p16747531.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsessionId - is there a way to generate/set in the container

Posted by Mark Thomas <ma...@apache.org>.
mfs wrote:
> Given the above context, i was wondering if there is some way i can provide
> my own unique sessionId to the servlet container whenever it creates a
> unique http session against a user.

You would need to write your own manager. You should be able to extend 
org.apache.catalina.session.StandardManager and override generateSessionId()

See also http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsessionId - is there a way to generate/set in the container

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Farhan,

mfs wrote:
| Actually they don't, its a non-java based framework.

:(

| But Christoper i would still be interested in knowing the approach you
took,
| sounds like an interesting deal to me, now when u say wrap the servlet's
| container's framework, what extended functionality did you provide in that
| case in your wrapper, since the container itself provides everything
as far
| as session tracking is concerned, used your sessionId generation
mechanism ?

No, we had our own framework for a long time, and I simply replaced the
implementation with one that re-used everything coming from the
container. Basically, our framework became a thin wrapper around the
standard HttpSession stuff. Nothing fancy... we just didn't have to
re-write a ton of existing application code. We let the container
generate the session ids and everything.

| or yet implemented your own mean of storing the session in the db for
| example in contrast to in memory hashtable?

I think it was a hashtable implementation, though it was designed to
allow database persistence with a different "driver" (or whatever they
called it at the time).

| what was so unique about that
| wrapper and how did it help inter-op..

It didn't help with interoperability. It helped with maintenance. I had
identified a number of bugs in the implementation and persuaded the team
managers that a re-implementation wrapping the standard
container-managed classes was the best solution. We eliminated a bunch
of bugs /and/ a bunch of code from our own class library, as well as all
the applications based upon it. Everybody wins ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgHu/gACgkQ9CaO5/Lv0PC7jgCghrC4dKxn2z0bhNxy6RwqU0yr
N3YAoL2Hhm/TxYxjEjAmnZ305+Wm761G
=SqfA
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsessionId - is there a way to generate/set in the container

Posted by mfs <fa...@gmail.com>.
Actually they don't, its a non-java based framework.

But Christoper i would still be interested in knowing the approach you took,
sounds like an interesting deal to me, now when u say wrap the servlet's
container's framework, what extended functionality did you provide in that
case in your wrapper, since the container itself provides everything as far
as session tracking is concerned, used your sessionId generation mechanism ?
or yet implemented your own mean of storing the session in the db for
example in contrast to in memory hashtable ? what was so unique about that
wrapper and how did it help inter-op..

Thanks


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Farhan,
> 
> mfs wrote:
> | Actually we have our own session tracking framework, and now
> | that i am making a seperate servlet based application, i have come to
> need
> | to support interoperability between Servlet HttpSession and the sessions
> | maintained by our session-tracking framework.
> 
> Does your current session-tracking framework use HttpServletRequest
> objects to help identify the request? If so, you could re-factor your
> session framework to wrap the container's framework.
> 
> I did this years ago for a company that wrote their own session
> framework. The container-managed one is really the way to go, here.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkgHU4EACgkQ9CaO5/Lv0PAEdQCcCSIq8l6OTa3jPfTwJkE/5DVI
> VQsAoLvjyhc6YdksBV4NnmzPKAE6i39W
> =jKz0
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jsessionId---is-there-a-way-to-generate-set-in-the-container-tp16738580p16751962.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsessionId - is there a way to generate/set in the container

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Farhan,

mfs wrote:
| Actually we have our own session tracking framework, and now
| that i am making a seperate servlet based application, i have come to need
| to support interoperability between Servlet HttpSession and the sessions
| maintained by our session-tracking framework.

Does your current session-tracking framework use HttpServletRequest
objects to help identify the request? If so, you could re-factor your
session framework to wrap the container's framework.

I did this years ago for a company that wrote their own session
framework. The container-managed one is really the way to go, here.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgHU4EACgkQ9CaO5/Lv0PAEdQCcCSIq8l6OTa3jPfTwJkE/5DVI
VQsAoLvjyhc6YdksBV4NnmzPKAE6i39W
=jKz0
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org