org.directwebremoting.util
Class IdGenerator

java.lang.Object
  extended by org.directwebremoting.util.IdGenerator

public class IdGenerator
extends java.lang.Object

Code to generate page ids. IdGenerators are expensive to setup so it is suggested that you share instances wherever possible. This action will also enhance security. Much of this code is adapted from org.apache.catalina.session.ManagerBase. Specifically Revision 1.37 which has been unchanged in the past 18 months. I have taken out the /dev/urandom stuff and simplified things to the point where we can audit it to work out what might be broken.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
IdGenerator()
          Seed the random number
 
Method Summary
 java.lang.String generateId(int length)
          Generate and return a new session identifier.
 java.lang.String getAlgorithm()
           
 void setAlgorithm(java.lang.String algorithm)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdGenerator

public IdGenerator()
Seed the random number

Method Detail

generateId

public java.lang.String generateId(int length)
Generate and return a new session identifier.

Parameters:
length - The number of bytes to generate
Returns:
A new page id string

getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the algorithm

setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
Parameters:
algorithm - the algorithm to set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Copyright ? 2005