public class WebAppContext extends BaseSiteMeshContext
SiteMeshContext implementation specifically for webapps running in a Servlet
container. Makes HttpServletRequest, HttpServletResponse and
ServletContext available to web-app specific SiteMesh components.| Modifier and Type | Field and Description |
|---|---|
static String |
CONTENT_KEY
Key that the
ContentProperty is stored under in the HttpServletRequest
attribute. |
static String |
CONTEXT_KEY
Key that the
WebAppContext is stored under in the HttpServletRequest
attribute. |
| Constructor and Description |
|---|
WebAppContext(String contentType,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext servletContext,
ContentProcessor contentProcessor,
ResponseMetaData metaData,
boolean includeErrorPages) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decorate(String decoratorPath,
Content content,
Writer out)
Dispatches to another path to render a decorator.
|
protected void |
dispatch(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path)
Dispatch to the actual path.
|
String |
getContentType() |
String |
getPath()
Get path of the page currently being displayed.
|
javax.servlet.http.HttpServletRequest |
getRequest() |
static String |
getRequestPath(javax.servlet.http.HttpServletRequest request) |
javax.servlet.http.HttpServletResponse |
getResponse() |
javax.servlet.ServletContext |
getServletContext() |
decorate, getContentProcessor, getContentToMergepublic static final String CONTENT_KEY
ContentProperty is stored under in the HttpServletRequest
attribute. It is "org.sitemesh.content.Content".public static final String CONTEXT_KEY
WebAppContext is stored under in the HttpServletRequest
attribute. It is "org.sitemesh.SiteMeshContext".public WebAppContext(String contentType, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, ContentProcessor contentProcessor, ResponseMetaData metaData, boolean includeErrorPages)
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public javax.servlet.ServletContext getServletContext()
public String getContentType()
public String getPath()
SiteMeshContextpublic static String getRequestPath(javax.servlet.http.HttpServletRequest request)
protected void decorate(String decoratorPath, Content content, Writer out) throws IOException
This path may anything that handles a standard request (e.g. Servlet, JSP, MVC framework, etc).
The end point can access the ContentProperty and SiteMeshContext by using
looking them up as HttpServletRequest attributes under the keys
CONTENT_KEY and
CONTEXT_KEY respectively.
decorate in class BaseSiteMeshContextIOExceptionprotected void dispatch(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionCopyright © 2015. All Rights Reserved.