public final class ServletUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COMPOSE_STACK_ATTRIBUTE_NAME
The name of the attribute that will contain the compose stack.
|
static java.lang.String |
CURRENT_CONTAINER_ATTRIBUTE_NAME
Name of the attribute used to store the current used container.
|
static java.lang.String |
FORCE_INCLUDE_ATTRIBUTE_NAME
Name of the attribute used to store the force-include option.
|
| Modifier and Type | Method and Description |
|---|---|
static ArrayStack<java.lang.Object> |
getComposeStack(HttpServletRequest request)
Returns the compose stack, that is used by the tags to compose
definitions, attributes, etc.
|
static TilesContainer |
getContainer(ServletContext context)
Returns the default Tiles container.
|
static TilesContainer |
getContainer(ServletContext context,
java.lang.String key)
Returns a specific Tiles container.
|
static TilesContainer |
getCurrentContainer(ServletRequest request,
ServletContext context)
Returns the current container that has been set, or the default one.
|
static ServletContext |
getServletContext(TilesApplicationContext applicationContext)
Gets a servlet context from a TilesApplicationContext.
|
static ServletTilesRequestContext |
getServletRequest(TilesRequestContext request)
Opens a TilesRequestContext until it finds a ServletTilesRequestContext.
|
static boolean |
isForceInclude(HttpServletRequest request)
Returns true if forced include of the result is needed.
|
static void |
setContainer(ServletContext context,
TilesContainer container)
Configures the default container to be used in the application.
|
static void |
setContainer(ServletContext context,
TilesContainer container,
java.lang.String key)
Configures the container to be used in the application.
|
static void |
setCurrentContainer(ServletRequest request,
ServletContext context,
java.lang.String key)
Sets the current container to use in web pages.
|
static void |
setCurrentContainer(ServletRequest request,
ServletContext context,
TilesContainer container)
Sets the current container to use in web pages.
|
static void |
setForceInclude(HttpServletRequest request,
boolean forceInclude)
Sets the option that enables the forced include of the response.
|
static java.io.IOException |
wrapServletException(ServletException ex,
java.lang.String message)
Wraps a ServletException to create an IOException with the root cause if present.
|
public static final java.lang.String COMPOSE_STACK_ATTRIBUTE_NAME
public static final java.lang.String FORCE_INCLUDE_ATTRIBUTE_NAME
public static final java.lang.String CURRENT_CONTAINER_ATTRIBUTE_NAME
public static boolean isForceInclude(HttpServletRequest request)
request - The HTTP request.true the include operation must be forced.public static void setForceInclude(HttpServletRequest request,
boolean forceInclude)
request - The HTTP request.forceInclude - If true the include operation must be
forced.public static TilesContainer getContainer(ServletContext context)
context - The servlet context to use.public static TilesContainer getContainer(ServletContext context, java.lang.String key)
context - The servlet context to use.key - The key under which the container is stored. If null, the
default container will be returned.public static void setContainer(ServletContext context,
TilesContainer container)
context - The servlet context object to use.container - The container object to set.public static void setContainer(ServletContext context,
TilesContainer container,
java.lang.String key)
context - The servlet context object to use.container - The container object to set.key - The key under which the container will be stored.public static void setCurrentContainer(ServletRequest request,
ServletContext context,
java.lang.String key)
request - The request to use.context - The servlet context to use.key - The key under which the container is stored.public static void setCurrentContainer(ServletRequest request,
ServletContext context,
TilesContainer container)
request - The request to use.context - The servlet context to use.container - The container to use as the current container.public static TilesContainer getCurrentContainer(ServletRequest request, ServletContext context)
request - The request to use.context - The servlet context to use.public static java.io.IOException wrapServletException(ServletException ex,
java.lang.String message)
ex - The exception to wrap.message - The message of the exception.public static ArrayStack<java.lang.Object> getComposeStack(HttpServletRequest request)
request - The HTTP request.public static ServletTilesRequestContext getServletRequest(TilesRequestContext request)
request - The request to open.NotAServletEnvironmentException - If a servlet-based request
context could not be found.public static ServletContext getServletContext(TilesApplicationContext applicationContext)
applicationContext - The application context to analyze.NotAServletEnvironmentException - If the application context is not
servlet-based.