public class ConstructPreset
extends org.springframework.web.servlet.tags.RequestContextAwareTag
This class provides the "constructPreset" custom JSP tag that can be used instantiate a Spring Surf preset. It should be used (optionally) with the "presetToken" custom tag as follows:
<constructPreset preset=""> <presetToken key="someKey" value="someValue"></presetToken> <presetToken key="anotherKey" value="anotherValue"></presetToken> </constructPreset>
| Constructor and Description |
|---|
ConstructPreset() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToken(String key,
String value)
Adds a new token to the
tokens map. |
int |
doAfterBody()
This calls the
PresetsManager to actually construct the preset. |
protected int |
doStartTagInternal()
Retrieves the
PresetsManager from the application context the first time the tag is used and at all other
times just returns the EVAL_BODY_INCLUDE constant to process any child tags. |
void |
release()
Extends the super class implementation to ensure that the preset id and token map are reset after each request is processed.
|
void |
setPreset(String preset) |
doCatch, doFinally, doStartTag, getRequestContextpublic void setPreset(String preset)
public void addToken(String key, String value)
Adds a new token to the tokens map. This method is intended to only be called by child PresetToken
tags. This is because it is not possible for a custom tag to have map attributes so they have to be provided through child
tags.
key - The key of the token to add. This should be a substitution value in the preset being constructed.value - The value of the token to add.public void release()
Extends the super class implementation to ensure that the preset id and token map are reset after each request is processed.
release in interface javax.servlet.jsp.tagext.Tagrelease in class javax.servlet.jsp.tagext.TagSupportprotected int doStartTagInternal()
throws Exception
Retrieves the PresetsManager from the application context the first time the tag is used and at all other
times just returns the EVAL_BODY_INCLUDE constant to process any child tags. This is currently hard-coded
to retrieve the default Spring Surf PresetsManager bean with an id of "webframework.presets.manager".
doStartTagInternal in class org.springframework.web.servlet.tags.RequestContextAwareTagExceptionpublic int doAfterBody()
throws javax.servlet.jsp.JspException
This calls the PresetsManager to actually construct the preset. The PresetsManager will have been
retrieved in the doStartTagInternal method the first time the tag was executed and the token map applied will have
been populated by executing any child PresetToken tags.
doAfterBody in interface javax.servlet.jsp.tagext.IterationTagdoAfterBody in class javax.servlet.jsp.tagext.TagSupportjavax.servlet.jsp.JspExceptionCopyright © 2005–2016 Alfresco Software. All rights reserved.