com.go.teaservlet.util
Class ObjectIdentifier

java.lang.Object
  |
  +--com.go.teaservlet.util.ObjectIdentifier

Deprecated. Use of ObjectIdentifier does not work correctly when Servlet is striped against multiple processes.

public class ObjectIdentifier
extends java.lang.Object

ObjectIdentifier assigns unique string identifiers to objects for retrieval. The string identifier is safe to use in a URL query string for referencing non-persistent objects in between stateless HTTP transactions. For example, a web page could present a list of items that, when an item is clicked, produces another page that shows detail information for the selected item.

The object identifiers that are assigned are not persistent and will be different if the process is restarted. This means that a web page in a browser could contain invalid object identifiers if the web server is restarted. Users of this class should attempt to gracefully handle cases where an object cannot be retrieved, or in rare circumstances, the retrieved object is of an unexpected type.

ObjectIdentifier is not appropriate for use on objects that already support a unique identifier, such as objects that can be retrieved from a database. In that case, use the database's unique identifier for the object instead, and possibly encrypt it.

Internally, ObjectIdentifier makes use of weak references so that identifiers don't prevent objects from being garbage collected.

Version:
7 , 9/13/00
Author:
Brian S O'Neill
See Also:
WeakReference

Method Summary
static java.lang.String identify(java.lang.Object obj)
          Deprecated. Returns a URL-safe string that uniquely identifies the given object.
static java.lang.Object retrieve(java.lang.String identifier)
          Deprecated. Retrieves an object using an identifer string as produced by the identify method, or null if not found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

identify

public static java.lang.String identify(java.lang.Object obj)
Deprecated. 
Returns a URL-safe string that uniquely identifies the given object.

retrieve

public static java.lang.Object retrieve(java.lang.String identifier)
Deprecated. 
Retrieves an object using an identifer string as produced by the identify method, or null if not found. Under rare circumstances, the retrieved object could be an unexpected type, in which case it should be ignored. Therefore, care must be taken when casting the retrieved object.