org.mmbase.bridge.jsp.taglib
Class ContextTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.mmbase.bridge.jsp.taglib.ContextReferrerTag
              extended byorg.mmbase.bridge.jsp.taglib.ContextTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, ContextProvider, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag, TagIdentifier

public class ContextTag
extends ContextReferrerTag
implements ContextProvider

A ContextTag is like parentheses, and as such can act as a 'namespace' (if it has an id) or as 'scope' (if it doesn't).

The context can be seen as a container for variables and their values.

(ContextReferrer) Tags living under a context tag can 'register' themselves in the context (by use of the 'id' attribute') and in that way become a variable. Other tags can refer to such variables.

A ContextTag is a ContextReferrer itself too, and therefore it is possible to 'nest' contextes. And perhaps we will also make it possible to treat contextes as variables and e.g. pass them to another page as a whole.

It is also possible to put something into the Context by hand. For that you can use the `ImportTag'.

Writing out the value of a variable can be done with the `Write' Tag.

Version:
$Id: ContextTag.java,v 1.65.2.1 2004/07/05 17:19:57 michiel Exp $
Author:
Michiel Meeuwissen
See Also:
ImportTag, WriteTag, Serialized Form

Field Summary
static java.lang.String DEFAULTENCODING_KEY
           
 
Fields inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
contextId, EVAL_BODY, helper, id, pageContextTag, writerid
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
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()
           
 java.lang.Object findAndRegister(int from, java.lang.String referid, java.lang.String newid)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
protected  java.lang.Object findAndRegister(int from, java.lang.String referid, java.lang.String newid, boolean check)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 java.lang.Object findAndRegister(java.lang.String id)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 java.lang.Object findAndRegister(java.lang.String externid, java.lang.String newid)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 java.lang.String findAndRegisterString(java.lang.String id)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegisterString
 byte[] getBytes(java.lang.String key)
          hmm..
 java.lang.Object getContainerObject(java.lang.String key)
          Deprecated. Use getContextProvider().getContextContainer().getObject
 ContextContainer getContextContainer()
           
 boolean isPresent(java.lang.String key)
          Deprecated. Use getContextProvider().getContextContainer().isPresent
 boolean isRegistered(java.lang.String key)
          Deprecated. Use getContextProvider().getContextContainer().isRegistered
 void register(java.lang.String newid, java.lang.Object n)
          Deprecated. Use getContextProvider().getContextContainer().register
 void register(java.lang.String newid, java.lang.Object n, boolean check)
          Deprecated. Use getContextProvider().getContextContainer().register
 void registerNode(java.lang.String key, Node node)
          Deprecated. Use getContextProvider().getContextContainer().registerNode
 void reregister(java.lang.String id, java.lang.Object n)
          Deprecated. Use getContextProvider().getContextContainer().reregister
 void setCloudContext(CloudContext cc)
          This context can also serve as a 'cloudcontext'.
 void setPageContext(javax.servlet.jsp.PageContext pc)
           
 void setReferid(java.lang.String r)
          ContextReferrers normally can have the attribute 'referid'.
 void unRegister(java.lang.String key)
          Deprecated. Use getContextProvider().getContextContainer().unRegister
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
doEndTag, findParentTag, findParentTag, findParentTag, findParentTag, findWriter, findWriter, getAttribute, getAttributeBoolean, getAttributeInteger, getAttributeInteger, getAttributeValue, getContentTag, getContextProvider, getContextTag, getId, getLocale, getObject, getPageContext, getReferid, getString, getWriterValue, haveBody, release, setContext, setEscape, setId, setJspvar, setVartype, setWrite, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
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 org.mmbase.bridge.jsp.taglib.TagIdentifier
getId
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

DEFAULTENCODING_KEY

public static final java.lang.String DEFAULTENCODING_KEY
See Also:
Constant Field Values
Constructor Detail

ContextTag

public ContextTag()
Method Detail

setReferid

public void setReferid(java.lang.String r)
                throws javax.servlet.jsp.JspTagException
Description copied from class: ContextReferrerTag
ContextReferrers normally can have the attribute 'referid'. If a ContextReferrer has the 'id' attribute it registers its output in the surrounding Context. With 'referid' you can 'repeat' a tag which had the 'id' attribute.

Overrides:
setReferid in class ContextReferrerTag
Throws:
javax.servlet.jsp.JspTagException

setCloudContext

public void setCloudContext(CloudContext cc)
This context can also serve as a 'cloudcontext'. That means that the cloud context commmunicates its cloudcontext to the context.


setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pc)
Specified by:
setPageContext in interface javax.servlet.jsp.tagext.Tag
Overrides:
setPageContext in class ContextReferrerTag

getContextContainer

public ContextContainer getContextContainer()
Specified by:
getContextContainer in interface ContextProvider

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspTagException

registerNode

public void registerNode(java.lang.String key,
                         Node node)
                  throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().registerNode

Precisely like 'register', only it wants a Node.

Parameters:
key - the key (id) of the node to register
node - the node to put in the hashmap
Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(int from,
                                        java.lang.String referid,
                                        java.lang.String newid)
                                 throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Searches a key in request, postparameters, session, parent context and registers it in this one. Returns null if it could not be found.

Throws:
javax.servlet.jsp.JspTagException

findAndRegister

protected java.lang.Object findAndRegister(int from,
                                           java.lang.String referid,
                                           java.lang.String newid,
                                           boolean check)
                                    throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(java.lang.String externid,
                                        java.lang.String newid)
                                 throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Throws:
javax.servlet.jsp.JspTagException

register

public void register(java.lang.String newid,
                     java.lang.Object n,
                     boolean check)
              throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().register

Throws:
javax.servlet.jsp.JspTagException

register

public void register(java.lang.String newid,
                     java.lang.Object n)
              throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().register

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.

Throws:
javax.servlet.jsp.JspTagException

unRegister

public void unRegister(java.lang.String key)
                throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().unRegister

Throws:
javax.servlet.jsp.JspTagException

reregister

public void reregister(java.lang.String id,
                       java.lang.Object n)
                throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().reregister

Registers an variable again. This can be used to change the type of a variable, e.g.

Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.6

isPresent

public boolean isPresent(java.lang.String key)
                  throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().isPresent

'present' means 'not null'. 'null' means 'registered, but not present'. Not registered is not present, of course.

Throws:
javax.servlet.jsp.JspTagException

isRegistered

public boolean isRegistered(java.lang.String key)
                     throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().isRegistered

Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(java.lang.String id)
                                 throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Throws:
javax.servlet.jsp.JspTagException

findAndRegisterString

public java.lang.String findAndRegisterString(java.lang.String id)
                                       throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegisterString

Throws:
javax.servlet.jsp.JspTagException

getContainerObject

public java.lang.Object getContainerObject(java.lang.String key)
                                    throws javax.servlet.jsp.JspTagException
Deprecated. Use getContextProvider().getContextContainer().getObject

Throws:
javax.servlet.jsp.JspTagException

getBytes

public byte[] getBytes(java.lang.String key)
                throws javax.servlet.jsp.JspTagException
hmm.. This kind of stuf must move to ImportTag, I think.

Throws:
javax.servlet.jsp.JspTagException

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspTagException
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Throws:
javax.servlet.jsp.JspTagException


MMBase build 1.7.1.20041002