org.mmbase.bridge.jsp.taglib
Class ContextTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--org.mmbase.bridge.jsp.taglib.ContextReferrerTag
                    |
                    +--org.mmbase.bridge.jsp.taglib.ContextTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class ContextTag
extends ContextReferrerTag

Groups tags. The tags can referrence each other, by use of the group hash of this class. You can have several types, but they have a certain order. The most complex Context is a Context of type 'session'. If you try to get something from a session context, it will first search in the session, if it cannot find it there, it will try to find a multipart post with that key, if that is also not there, it will try a parameter, and finally it will try to see if the object was registered in this page. Inside a session context you will by the way not register anything in the hashmap of the context, because the session is used for that already.

Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
static int TYPE_MULTIPART
           
static int TYPE_NOTSET
           
static int TYPE_PAGE
           
static int TYPE_PARAMETERS
           
static int TYPE_PARENT
           
static int TYPE_SESSION
           
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
pageContextTag, referid
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ContextTag()
           
 
Method Summary
 int doAfterBody()
           
 int doStartTag()
           
 boolean findAndRegister(int from, java.lang.String referid, java.lang.String newid)
           
 boolean findAndRegister(java.lang.String externid, java.lang.String newid)
          Searches a key in request, postparameters, session, parent context and registers it in this one.
 byte[] getBytes(java.lang.String key)
           
 java.lang.String getId()
          Returns the id of the context.
 java.util.Vector getKeys()
           
 Node getNode(java.lang.String key)
           
 java.lang.Object getObject(java.lang.String key)
           
 java.lang.String getObjectAsString(java.lang.String key)
           
 java.lang.String getStringFindAndRegister(java.lang.String id)
           
 boolean isPresent(java.lang.String key)
          'present' means ='not null'.
 void register(java.lang.String newid, java.lang.Object n)
          Register an Object with a key in the context.
 void registerNode(java.lang.String key, Node n)
           
 void release()
          Release all allocated resources.
 void setId(java.lang.String i)
           
 void setPageContext(javax.servlet.jsp.PageContext pc)
           
 void unRegister(java.lang.String key)
           
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
findParentTag, findParentTag, getAttributeValue, getContextTag, getContextTag, getReferid, getReferIdValue, setContext, setReferid, stringSplitter, stringSplitter
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getParent, getValue, getValues, removeValue, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

TYPE_NOTSET

public static final int TYPE_NOTSET

TYPE_PAGE

public static final int TYPE_PAGE

TYPE_PARENT

public static final int TYPE_PARENT

TYPE_PARAMETERS

public static final int TYPE_PARAMETERS

TYPE_MULTIPART

public static final int TYPE_MULTIPART

TYPE_SESSION

public static final int TYPE_SESSION
Constructor Detail

ContextTag

public ContextTag()
Method Detail

release

public void release()
Description copied from class: ContextReferrerTag
Release all allocated resources.
Overrides:
release in class ContextReferrerTag

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pc)
Overrides:
setPageContext in class ContextReferrerTag

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport

setId

public void setId(java.lang.String i)
Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport

getId

public java.lang.String getId()
Returns the id of the context. If there was no id-attibute in this tag, then the id is implicitily 'context'.
Overrides:
getId in class javax.servlet.jsp.tagext.TagSupport

registerNode

public void registerNode(java.lang.String key,
                         Node n)
                  throws javax.servlet.jsp.JspTagException
Parameters:
key - the key (id) of the node to register
node - the node to put in the hashmap

findAndRegister

public boolean findAndRegister(int from,
                               java.lang.String referid,
                               java.lang.String newid)
                        throws javax.servlet.jsp.JspTagException

findAndRegister

public boolean findAndRegister(java.lang.String externid,
                               java.lang.String newid)
                        throws javax.servlet.jsp.JspTagException
Searches a key in request, postparameters, session, parent context and registers it in this one.

register

public void register(java.lang.String newid,
                     java.lang.Object n)
              throws javax.servlet.jsp.JspTagException
Register an Object with a key in the context. If the Context is a session context, then it will be put in the session, otherwise in the hashmap.

unRegister

public void unRegister(java.lang.String key)
                throws javax.servlet.jsp.JspTagException

isPresent

public boolean isPresent(java.lang.String key)
                  throws javax.servlet.jsp.JspTagException
'present' means ='not null'. 'null' means 'registered, but not present'. not registered is not present, of course.

getObject

public java.lang.Object getObject(java.lang.String key)
                           throws javax.servlet.jsp.JspTagException

getStringFindAndRegister

public java.lang.String getStringFindAndRegister(java.lang.String id)
                                          throws javax.servlet.jsp.JspTagException

getObjectAsString

public java.lang.String getObjectAsString(java.lang.String key)
                                   throws javax.servlet.jsp.JspTagException

getBytes

public byte[] getBytes(java.lang.String key)
                throws javax.servlet.jsp.JspTagException

getNode

public Node getNode(java.lang.String key)
             throws javax.servlet.jsp.JspTagException

getKeys

public java.util.Vector getKeys()

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspTagException
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport


MMBase 2001