jrun.servlet.session
Class FileSessionStorage

java.lang.Object
  |
  +--jrun.servlet.session.FileSessionStorage
All Implemented Interfaces:
SessionStorage

public class FileSessionStorage
extends java.lang.Object
implements SessionStorage

Provide session storage to the file system. This is the default session storage provider for JRun. Each session object (given as a binary stream) is written to a file named with the session ID.

This session storage provider is also given as a fully working example to illustrate how to create a custom storage provider. The source code can be found in the samples server within SERVER-INF/lib/jrun/samples/session

Author:
Karl Moss, Brian Deitte

Field Summary
static java.lang.String EXT
           
static java.lang.String PREFIX
           
 
Constructor Summary
FileSessionStorage()
           
 
Method Summary
 void destroy()
          Destroy the service.
protected  java.lang.String getFilename(java.lang.String id)
           
 void init(java.util.Properties props)
          Initialize the FileSessionStorage provider.
 void purge()
          Gives the storage provider an opportunity to perform housekeeping.
 void remove(java.lang.String id)
          Removes the session data for the given session ID
 java.io.InputStream retrieve(java.lang.String id)
          Retrieves the session data for the given session ID.
 void store(java.lang.String id, java.io.InputStream in, int len)
          Stores the given session data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

public static final java.lang.String PREFIX

EXT

public static final java.lang.String EXT
Constructor Detail

FileSessionStorage

public FileSessionStorage()
Method Detail

init

public void init(java.util.Properties props)
          throws java.io.IOException

Initialize the FileSessionStorage provider. Valid properties are:

path - The path to the storage directory
Specified by:
init in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
initConfigs - A List containing the InitConfigMetaData objects for persistence configuration

destroy

public void destroy()
Description copied from interface: SessionStorage
Destroy the service. This is called whenever the webapp is destroyed
Specified by:
destroy in interface SessionStorage

store

public void store(java.lang.String id,
                  java.io.InputStream in,
                  int len)
           throws java.io.IOException
Description copied from interface: SessionStorage
Stores the given session data. Note that the input stream will be closed by the caller.
Specified by:
store in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID
in - InputStream containing the session data
len - The length of the session data

retrieve

public java.io.InputStream retrieve(java.lang.String id)
                             throws java.io.IOException
Description copied from interface: SessionStorage
Retrieves the session data for the given session ID. Note that the input stream will be closed by the caller
Specified by:
retrieve in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID
Returns:
The InputStream used to read the session data

remove

public void remove(java.lang.String id)
            throws java.io.IOException
Description copied from interface: SessionStorage
Removes the session data for the given session ID
Specified by:
remove in interface SessionStorage
Following copied from interface: jrun.servlet.session.SessionStorage
Parameters:
id - The session ID

purge

public void purge()
           throws java.lang.Exception
Description copied from interface: SessionStorage
Gives the storage provider an opportunity to perform housekeeping. This is called during server startup after sessions have been restored.
Specified by:
purge in interface SessionStorage

getFilename

protected java.lang.String getFilename(java.lang.String id)


Copyright � 2002 Macromedia Corporation. All Rights Reserved.