org.mmbase.bridge.jsp.taglib
Class ContextTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.mmbase.bridge.jsp.taglib.ContextReferrerTag
              extended by org.mmbase.bridge.jsp.taglib.ContextTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, TryCatchFinally, ContextProvider, 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 39578 2009-11-09 09:57:03Z michiel $
Author:
Michiel Meeuwissen
See Also:
ImportTag, WriteTag, Serialized Form

Field Summary
static String CONTAINER_KEY_PREFIX
           
static String CONTEXTTAG_KEY
           
static String DEFAULTENCODING_KEY
           
static String ISELIGNORED_PARAM
           
(package private)  int number
           
 
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
(package private)  ContextContainer createContainer(ContextContainer c)
           
 int doAfterBody()
           
 int doEndTag()
           
 void doFinally()
           
 int doStartTag()
           
 Object findAndRegister(int from, String referid, String newid)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
protected  Object findAndRegister(int from, String referid, String newid, boolean check)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 Object findAndRegister(String id)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 Object findAndRegister(String externid, String newid)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegister
 String findAndRegisterString(String id)
          Deprecated. Use getContextProvider().getContextContainer().findAndRegisterString
 Object getContainerObject(String key)
          Deprecated. Use getContextProvider().getContextContainer().getObject
 ContextContainer getContextContainer()
           
 SerializableInputStream getInputStream(String key)
           
 boolean isPresent(String key)
          Deprecated. Use getContextProvider().getContextContainer().isPresent
 boolean isRegistered(String key)
          Deprecated. Use getContextProvider().getContextContainer().isRegistered
 void register(String newid, Object n)
          Deprecated. Use getContextProvider().getContextContainer().register
 void register(String newid, Object n, boolean check)
          Deprecated. Use getContextProvider().getContextContainer().register
 void registerNode(String key, Node node)
          Deprecated. Use getContextProvider().getContextContainer().registerNode
 void reregister(String id, Object n)
          Deprecated. Use getContextProvider().getContextContainer().reregister
 void setCloudContext(CloudContext cc)
          This context can also serve as a 'cloudcontext'.
 void setPageContext(PageContext pc)
           
 void setReferid(String r)
          ContextReferrers normally can have the attribute 'referid'.
 void setScope(String s)
           
 String toString()
           
 void unRegister(String key)
          Deprecated. Use getContextProvider().getContextContainer().unRegister
protected static ServletRequest unwrap(ServletRequest req)
           
 
Methods inherited from class org.mmbase.bridge.jsp.taglib.ContextReferrerTag
appendMoreParameters, doCatch, fillStandardParameters, findLoopOrQuery, findParentTag, findParentTag, findWriter, findWriter, getAttribute, getAttribute, getAttributeBoolean, getAttributeInteger, getAttributeInteger, getAttributeValue, getContentTag, getContextProvider, getContextTag, getCurrentBlock, getDefaultLocale, getEscapedValue, getFormTag, getId, getLocale, getLocaleFromContext, getObject, getObjectConditional, getPageContext, getPageContextTag, getQuery, getReferid, getString, getTaglibVersion, getThreadPageContext, getTimeZone, getWriterValue, haveBody, release, setContext, setEscape, setId, setJspvar, setListdelimiter, setPageContextOnly, 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, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.jsp.taglib.ContextProvider
getPageContext
 
Methods inherited from interface org.mmbase.bridge.jsp.taglib.TagIdentifier
getId
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

CONTEXTTAG_KEY

public static final String CONTEXTTAG_KEY
See Also:
Constant Field Values

CONTAINER_KEY_PREFIX

public static final String CONTAINER_KEY_PREFIX
See Also:
Constant Field Values

DEFAULTENCODING_KEY

public static final String DEFAULTENCODING_KEY
See Also:
Constant Field Values

ISELIGNORED_PARAM

public static final String ISELIGNORED_PARAM
See Also:
Constant Field Values

number

int number
Constructor Detail

ContextTag

public ContextTag()
Method Detail

setReferid

public void setReferid(String r)
                throws 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
Parameters:
r - referid value
Throws:
JspTagException - when parsing of attributes fails

setScope

public void setScope(String s)
              throws JspTagException
Throws:
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(PageContext pc)
Specified by:
setPageContext in interface Tag
Overrides:
setPageContext in class ContextReferrerTag

createContainer

ContextContainer createContainer(ContextContainer c)
Parameters:
c - Parent context-container, if null then a container writing to page context will be instantiated.

getContextContainer

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

unwrap

protected static ServletRequest unwrap(ServletRequest req)
Since:
MMBase-1.9

doStartTag

public int doStartTag()
               throws JspTagException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class BodyTagSupport
Throws:
JspTagException

registerNode

public void registerNode(String key,
                         Node node)
                  throws 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:
JspTagException

findAndRegister

public Object findAndRegister(int from,
                              String referid,
                              String newid)
                       throws 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:
JspTagException

findAndRegister

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

Throws:
JspTagException

findAndRegister

public Object findAndRegister(String externid,
                              String newid)
                       throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Throws:
JspTagException

register

public void register(String newid,
                     Object n,
                     boolean check)
              throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().register

Throws:
JspTagException

register

public void register(String newid,
                     Object n)
              throws 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:
JspTagException

unRegister

public void unRegister(String key)
                throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().unRegister

Throws:
JspTagException

reregister

public void reregister(String id,
                       Object n)
                throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().reregister

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

Throws:
JspTagException
Since:
MMBase-1.6

isPresent

public boolean isPresent(String key)
                  throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().isPresent

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

Throws:
JspTagException

isRegistered

public boolean isRegistered(String key)
                     throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().isRegistered

Throws:
JspTagException

findAndRegister

public Object findAndRegister(String id)
                       throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegister

Throws:
JspTagException

findAndRegisterString

public String findAndRegisterString(String id)
                             throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().findAndRegisterString

Throws:
JspTagException

getContainerObject

public Object getContainerObject(String key)
                          throws JspTagException
Deprecated. Use getContextProvider().getContextContainer().getObject

Throws:
JspTagException

getInputStream

public SerializableInputStream getInputStream(String key)
                                       throws JspTagException
Throws:
JspTagException

doAfterBody

public int doAfterBody()
                throws JspTagException
Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class BodyTagSupport
Throws:
JspTagException

doEndTag

public int doEndTag()
             throws JspTagException
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class ContextReferrerTag
Throws:
JspTagException

doFinally

public void doFinally()
Specified by:
doFinally in interface TryCatchFinally
Overrides:
doFinally in class ContextReferrerTag

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null