GaneshP
GaneshP

Reputation: 766

set custom session id java (apache tomcat)

I want to set custom session id for my web application ,I have alogorithm to generate session id my web application should use that algo for generating session id. please suggest me how cam i set my algorithm as session id generation in tomcat..

session Manager --> i tried this but it provide complete session behaviour modification control ,i just want to set session id as per my algo no session behaviour changes

Implementing com.sun.entrprises.uui.uuidgenerator ---> tried this also but not able to understand exactly how to do this

please suggest me simplest solution just to set my algo as session generation algorithm

Note: you might suggest not to do it but i needed it for my project

Upvotes: 2

Views: 5204

Answers (1)

Dirk Lachowski
Dirk Lachowski

Reputation: 3151

Extending org.apache.catalina.session.StandardManager should do what you want. Do something like this:

public class MySessionManager extends StandardManager {

    @Override
    protected synchronized String generateSessionId() { 
        String sessionId = <Your session id generation algo>;
        return sessionId;
    }
}

After you have your session manager, follow this answer.

Upvotes: 2

Related Questions