Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7673649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:33:40+00:00 2026-05-31T16:33:40+00:00

The question is rather of academic nature… I’ve got the following architecture: Apache server

  • 0

The question is rather of academic nature…
I’ve got the following architecture: Apache server in front of Jboss AS workers using mod_jk to talk with each other.
What algorithm is used to generate the JSESSIONID or what is it based on? It seem to be similar to output of hash algorithm of some kind (md5 perhaps)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:33:41+00:00Added an answer on May 31, 2026 at 4:33 pm

    Here is the code snippet used to generate sessionId for tomcat. I pulled it from Tomcat 5.5.35 Source code. You can find the source code here. The sessionId seems to be generated by ManagerBase class located here. I am adding the code snippet from ManagerBase here for convenience.

    Hope this helps.

    Good luck!

    /**
     * Generate and return a new session identifier.
     */
    protected synchronized String generateSessionId() {
    
        byte random[] = new byte[16];
        String jvmRoute = getJvmRoute();
        String result = null;
    
        // Render the result as a String of hexadecimal digits
        StringBuffer buffer = new StringBuffer();
        do {
            int resultLenBytes = 0;
            if (result != null) {
                buffer = new StringBuffer();
                duplicates++;
            }
    
            while (resultLenBytes < this.sessionIdLength) {
                getRandomBytes(random);
                random = getDigest().digest(random);
                for (int j = 0;
                j < random.length && resultLenBytes < this.sessionIdLength;
                j++) {
                    byte b1 = (byte) ((random[j] & 0xf0) >> 4);
                    byte b2 = (byte) (random[j] & 0x0f);
                    if (b1 < 10)
                        buffer.append((char) ('0' + b1));
                    else
                        buffer.append((char) ('A' + (b1 - 10)));
                    if (b2 < 10)
                        buffer.append((char) ('0' + b2));
                    else
                        buffer.append((char) ('A' + (b2 - 10)));
                    resultLenBytes++;
                }
            }
            if (jvmRoute != null) {
                buffer.append('.').append(jvmRoute);
            }
            result = buffer.toString();
        } while (sessions.containsKey(result));
        return (result);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really simple question but rather than asking for an academic explanation I want to
This is a rather academic question, I realise it matters little regarding optimization, but
I know this is a rather academic question, but I wonder how one would
Excuse if this is more a file format conversion question rather than programming, but
My question is rather subjective, moderators please do not close it, for I want
The question is rather straightforward but not answered by searching. How do I determine
My question is rather simple. Let's suppose I'm executing the algorithm A star (search
my question is rather simple, if you have an pure virtual class (interface) but
Rather Trivial Question. So I tried to do this: if (array[0]==some_string) where array is
My question might sound rather strange, but still I didn't find any reference and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.