org.apache.turbine.util
Class GenerateUniqueId
java.lang.Object
|
+--org.apache.turbine.util.GenerateUniqueId
- public class GenerateUniqueId
- extends java.lang.Object
This class generates a unique 10+ character id. This is good for
authenticating users or tracking users around.
This code was borrowed from Apache
JServ.JServServletManager.java. It is what Apache JServ uses to
generate session ids for users. Unfortunately, it was not included
in Apache JServ as a class, so I had to create one here in order to
use it.
- Version:
- $Id: GenerateUniqueId.java,v 1.1.1.1 2001/08/16 05:09:39 jvanzyl Exp $
- Author:
- Jon S. Stevens, Neeme Praks
Method Summary |
static java.lang.String |
getIdentifier()
Get the unique id. |
java.lang.String |
getIdentifier(java.lang.String jsIdent)
Get the unique id. |
static void |
main(java.lang.String[] args)
Simple test of the functionality. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
session_count
private static int session_count
lastTimeVal
private static long lastTimeVal
randomSource
private static java.util.Random randomSource
maxRandomLen
public static final long maxRandomLen
maxSessionLifespanTics
public static final long maxSessionLifespanTics
ticDifference
public static final long ticDifference
GenerateUniqueId
public GenerateUniqueId()
getIdentifier
public static java.lang.String getIdentifier()
- Get the unique id.
NOTE: This must work together with
get_jserv_session_balance() in jserv_balance.c
- Returns:
- A String with the new unique id.
getIdentifier
public java.lang.String getIdentifier(java.lang.String jsIdent)
- Get the unique id.
- Parameters:
jsIdent
- A String.- Returns:
- A String with the new unique id.
main
public static void main(java.lang.String[] args)
- Simple test of the functionality.
- Parameters:
args
- A String[] with the command line arguments.
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.