org.apache.tiles.request.servlet
Class ServletUtil

Package class diagram package ServletUtil
java.lang.Object
  extended by org.apache.tiles.request.servlet.ServletUtil

public final class ServletUtil
extends Object

Utilities for Tiles request servlet support.

Version:
$Rev: 1375743 $ $Date: 2012-08-21 16:05:58 -0400 (Tue, 21 Aug 2012) $

Method Summary
static ApplicationContext getApplicationContext(ServletContext servletContext)
          Returns the application context getting it from the servlet context.
static ServletContext getServletContext(ApplicationContext applicationContext)
          Gets a servlet context from a TilesApplicationContext.
static ServletRequest getServletRequest(Request request)
          Opens a TilesRequestContext until it finds a ServletTilesRequestContext.
static IOException wrapServletException(ServletException ex, String message)
          Wraps a ServletException to create an IOException with the root cause if present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrapServletException

public static IOException wrapServletException(ServletException ex,
                                               String message)
Wraps a ServletException to create an IOException with the root cause if present.

Parameters:
ex - The exception to wrap.
message - The message of the exception.
Returns:
The wrapped exception.

getApplicationContext

public static ApplicationContext getApplicationContext(ServletContext servletContext)
Returns the application context getting it from the servlet context. It must be first saved creating a ServletApplicationContext and using ApplicationAccess.register(ApplicationContext).

Parameters:
servletContext - The servlet context.
Returns:
The application context, if found, null otherwise.

getServletRequest

public static ServletRequest getServletRequest(Request request)
Opens a TilesRequestContext until it finds a ServletTilesRequestContext.

Parameters:
request - The request to open.
Returns:
The servlet-based request context.
Throws:
NotAServletEnvironmentException - If a servlet-based request context could not be found.

getServletContext

public static ServletContext getServletContext(ApplicationContext applicationContext)
Gets a servlet context from a TilesApplicationContext.

Parameters:
applicationContext - The application context to analyze.
Returns:
The servlet context.
Throws:
NotAServletEnvironmentException - If the application context is not servlet-based.


Copyright © 2001-2012 Apache Software Foundation. All Rights Reserved.