org.davesag.generica.servlet.util
Interface Pipe

All Known Implementing Classes:
PipeImpl

public interface Pipe

There are many cases in web applications where you need to store a bunch of things between requests, but do not want the hassle of having to remember all the bits and peices you may have loaded into the session along the way.

A Pipe fits nicely between the request and the session. You can use a Pipe just like a session, in that you can set, get and remove named attributes, and at the end of the Pipe you just close it and it's gone.

Since:
Generica 1.0
Version:
CVS Revision $Id: Pipe.java,v 1.7 2004/03/30 13:00:42 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Nested Class Summary
static class Pipe.Factory
          Use this Factory class to create or retrieve a named Pipe for the session.
 
Method Summary
 void close()
          close this Pipe and remove it from the session.
 Object getAttribute(String name)
          Get the named attribute from the Pipe.
 Iterator getAttributeNames()
          Get an Iterator of all of the attrbiute names in the pipe.
 void removeAttribute(String name)
          remove a named attribute from the Pipe.
 void setAttribute(String name, Object value)
          Set a named attribute in the Pipe.
 void setName(String name)
          Set the name of the Pipe.
 void setSession(HttpSession session)
          Set the session containing the Pipe.
 

Method Detail

setName

public void setName(String name)
Set the name of the Pipe.

Parameters:
name - The name of the Pipe.

setSession

public void setSession(HttpSession session)
Set the session containing the Pipe.

Parameters:
session - The session that contains the Pipe.

getAttribute

public Object getAttribute(String name)
Get the named attribute from the Pipe.

Parameters:
name - The name of the attribute to get.
Returns:
The Object that matches the name, if any. Null if not.

getAttributeNames

public Iterator getAttributeNames()
Get an Iterator of all of the attrbiute names in the pipe.

Returns:
The names of the keys.

setAttribute

public void setAttribute(String name,
                         Object value)
Set a named attribute in the Pipe.

Parameters:
name - The attribute name.
value - The attribute value.

removeAttribute

public void removeAttribute(String name)
remove a named attribute from the Pipe.

Parameters:
name - The name of the attribute to remove.

close

public void close()
close this Pipe and remove it from the session.



Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.