Class RequestContextAwareTag
- java.lang.Object
- javax.servlet.jsp.tagext.TagSupport
- org.springframework.web.servlet.tags.RequestContextAwareTag
- All Implemented Interfaces:
Serializable
,IterationTag
,JspTag
,Tag
,TryCatchFinally
- Direct Known Subclasses:
HtmlEscapeTag
,HtmlEscapingAwareTag
public abstract class RequestContextAwareTag extends TagSupport implements TryCatchFinally
Superclass for all tags that require aRequestContext
.The
RequestContext
instance provides easy access to current state like theWebApplicationContext
, theLocale
, theTheme
, etc.Mainly intended for
DispatcherServlet
requests; will use fallbacks when used outsideDispatcherServlet
.- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
RequestContext
,DispatcherServlet
, Serialized Form
Field Summary
Fields Modifier and Type Field Description protected Log
logger
Logger available to subclassesstatic String
REQUEST_CONTEXT_PAGE_ATTRIBUTE
PageContext
attribute for the page-levelRequestContext
instance.Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
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
Constructors Constructor Description RequestContextAwareTag()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
doCatch(Throwable throwable)
void
doFinally()
int
doStartTag()
Create and expose the current RequestContext.protected abstract int
doStartTagInternal()
Called by doStartTag to perform the actual work.protected RequestContext
getRequestContext()
Return the current RequestContext.Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
Field Detail
REQUEST_CONTEXT_PAGE_ATTRIBUTE
public static final String REQUEST_CONTEXT_PAGE_ATTRIBUTE
PageContext
attribute for the page-levelRequestContext
instance.- See Also:
- Constant Field Values
Constructor Detail
RequestContextAwareTag
public RequestContextAwareTag()
Method Detail
doStartTag
public final int doStartTag() throws JspException
Create and expose the current RequestContext. Delegates todoStartTagInternal()
for actual work.- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Throws:
JspException
- See Also:
REQUEST_CONTEXT_PAGE_ATTRIBUTE
,JspAwareRequestContext
getRequestContext
protected final RequestContext getRequestContext()
Return the current RequestContext.
doStartTagInternal
protected abstract int doStartTagInternal() throws Exception
Called by doStartTag to perform the actual work.- Returns:
- same as TagSupport.doStartTag
- Throws:
Exception
- any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag- See Also:
TagSupport.doStartTag()
doCatch
public void doCatch(Throwable throwable) throws Throwable
- Specified by:
doCatch
in interfaceTryCatchFinally
- Throws:
Throwable
doFinally
public void doFinally()
- Specified by:
doFinally
in interfaceTryCatchFinally