|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectorg.apache.velocity.tools.view.XMLToolboxManager
org.seasar.velocity.tools.S2ServletToolboxManager
public class S2ServletToolboxManager
NOTE ServletToolboxManagerがシングルトンであるために、それを継承することができなかった。
A toolbox manager for the servlet environment.
A toolbox manager is responsible for automatically filling the Velocity context with a set of view tools. This class provides the following features:
Configuration
The toolbox manager is configured through an XML-based configuration
file. The configuration file is passed to the XMLToolboxManager.load(java.io.InputStream input)
method. The format is shown in the following example:
<?xml version="1.0"?> <toolbox> <tool> <key>link</key> <scope>request</scope> <class>org.apache.velocity.tools.view.tools.LinkTool</class> </tool> <tool> <key>date</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.DateTool</class> </tool> <data type="number"> <key>luckynumber</key> <value>1.37</value> </data> <data type="string"> <key>greeting</key> <value>Hello World!</value> </data> <xhtml>true</xhtml> </toolbox>
The recommended location for the configuration file is the WEB-INF directory of the web application.
フィールドの概要 | |
---|---|
protected static org.apache.commons.logging.Log |
LOG
|
static String |
SESSION_TOOLS_KEY
|
メソッドの概要 | |
---|---|
void |
addData(org.apache.velocity.tools.view.ToolInfo info)
Overrides XMLToolboxManager to put data into appTools map |
void |
addTool(org.apache.velocity.tools.view.ToolInfo info)
Overrides XMLToolboxManager to separate tools by scope. |
static S2ServletToolboxManager |
getInstance(javax.servlet.ServletContext servletContext,
String toolboxFile)
ServletToolboxManager factory method. |
protected Object |
getMutex(javax.servlet.http.HttpSession session)
Returns a mutex (lock object) unique to the specified session to allow for reliable synchronization on the session. |
protected org.apache.commons.digester.RuleSet |
getRuleSet()
Retrieves the rule set Digester should use to parse and load the toolbox for this manager. |
Map |
getToolbox(Object initData)
Overrides XMLToolboxManager to handle the separate scopes. |
void |
setCreateSession(boolean b)
Sets whether or not to create a new session when none exists for the current request and session-scoped tools have been defined for this toolbox. |
void |
setXhtml(Boolean value)
Sets an application attribute to tell velocimacros and tools (especially the LinkTool) whether they should output XHTML or HTML. |
protected boolean |
validateToolInfo(org.apache.velocity.tools.view.ToolInfo info)
Ensures that application-scoped tools do not have request path restrictions set for them, as those will not be enforced. |
クラス org.apache.velocity.tools.view.XMLToolboxManager から継承されたメソッド |
---|
load, load |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
public static final String SESSION_TOOLS_KEY
protected static final org.apache.commons.logging.Log LOG
メソッドの詳細 |
---|
public static S2ServletToolboxManager getInstance(javax.servlet.ServletContext servletContext, String toolboxFile)
public void setCreateSession(boolean b)
Sets whether or not to create a new session when none exists for the current request and session-scoped tools have been defined for this toolbox.
If true, then a call to getToolbox(Object)
will
create a new session if none currently exists for this request and
the toolbox has one or more session-scoped tools designed.
If false, then a call to getToolbox(Object) will never create a new session for the current request. This effectively means that no session-scoped tools will be added to the ToolboxContext for a request that does not have a session object.
The default value is true.
public void setXhtml(Boolean value)
Sets an application attribute to tell velocimacros and tools (especially the LinkTool) whether they should output XHTML or HTML.
ViewContext.XHTML
protected org.apache.commons.digester.RuleSet getRuleSet()
Retrieves the rule set Digester should use to parse and load the toolbox for this manager.
The DTD corresponding to the ServletToolboxRuleSet is:
<?xml version="1.0"?> <!ELEMENT toolbox (create-session?,xhtml?,tool*,data*,#PCDATA)> <!ELEMENT create-session (#CDATA)> <!ELEMENT xhtml (#CDATA)> <!ELEMENT tool (key,scope?,class,parameter*,#PCDATA)> <!ELEMENT data (key,value)> <!ATTLIST data type (string|number|boolean) "string"> <!ELEMENT key (#CDATA)> <!ELEMENT scope (#CDATA)> <!ELEMENT class (#CDATA)> <!ELEMENT parameter (EMPTY)> <!ATTLIST parameter name CDATA #REQUIRED> <!ATTLIST parameter value CDATA #REQUIRED> <!ELEMENT value (#CDATA)>
org.apache.velocity.tools.view.XMLToolboxManager
内の getRuleSet
protected boolean validateToolInfo(org.apache.velocity.tools.view.ToolInfo info)
org.apache.velocity.tools.view.XMLToolboxManager
内の validateToolInfo
info
- a ToolInfo object
public void addTool(org.apache.velocity.tools.view.ToolInfo info)
org.apache.velocity.tools.view.ToolboxManager
内の addTool
org.apache.velocity.tools.view.XMLToolboxManager
内の addTool
public void addData(org.apache.velocity.tools.view.ToolInfo info)
org.apache.velocity.tools.view.ToolboxManager
内の addData
org.apache.velocity.tools.view.XMLToolboxManager
内の addData
public Map getToolbox(Object initData)
org.apache.velocity.tools.view.ToolboxManager
内の getToolbox
org.apache.velocity.tools.view.XMLToolboxManager
内の getToolbox
initData
- the ViewContext
for the current servlet requestprotected Object getMutex(javax.servlet.http.HttpSession session)
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |