Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.servlet.view.tiles
Class ComponentControllerSupport

    java.lang.Object
      org.apache.struts.tiles.ControllerSupport
          org.springframework.web.servlet.view.tiles.ComponentControllerSupport

All Implemented Interfaces:
  Controller

    public abstract class ComponentControllerSupport

extends ControllerSupport

Convenience class for Spring-aware Tiles component controllers. Provides a reference to the current Spring application context, e.g. for bean lookup or resource loading.

Derives from the Tiles `ControllerSupport` class rather than implementing the Tiles `Controller` interface in order to be compatible with Struts 1.1 and 1.2. Implements both Struts 1.1's `perform` and Struts 1.2's `execute` method accordingly.

Since:
  22.08.2003
Author:
  Juergen Hoeller, Alef Arendsen
See Also:
  `WebApplicationObjectSupport`

Constructor Summary
`ComponentControllerSupport()`

Method Summary
`protected abstract void` | `doPerform(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response)` Perform the preparation for the component, allowing for any Exception to be thrown.
`void` | `execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)` This implementation delegates to `doPerform`, lazy-initializing the application context reference if necessary.
`protected ApplicationContext` | `getApplicationContext()` Return the current Spring ApplicationContext.
`protected MessageSourceAccessor` | `getMessageSourceAccessor()` Return a MessageSourceAccessor for the application context used by this object, for easy message access.
`protected ServletContext` | `getServletContext()` Return the current ServletContext.
`protected File` | `getTempDir()` Return the temporary directory for the current web application, as provided by the servlet container.
`protected WebApplicationContext` | `getWebApplicationContext()` Return the current Spring WebApplicationContext.
`protected void` | `initApplicationContext()` Subclasses can override this for custom initialization behavior.
`void` | `perform(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)` This implementation delegates to `execute`, converting non-Servlet/IO Exceptions to ServletException.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ComponentControllerSupport

    public ComponentControllerSupport()

Method Detail

### perform

    public final void perform(ComponentContext componentContext,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              ServletContext servletContext)
                       throws ServletException,
                              IOException

  This implementation delegates to `execute`, converting non-Servlet/IO Exceptions to ServletException.

  This is the only execution method available in Struts 1.1.

  Specified by:
    `perform` in interface `Controller`
  Overrides:
    `perform` in class `ControllerSupport`
  Throws:
    `ServletException`
    `IOException`
  See Also:
    `execute(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)`

### execute

    public final void execute(ComponentContext componentContext,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              ServletContext servletContext)
                       throws Exception

  This implementation delegates to `doPerform`, lazy-initializing the application context reference if necessary.

  This is the preferred execution method in Struts 1.2. When running with Struts 1.1, it will be called by `perform`.

  Specified by:
    `execute` in interface `Controller`
  Overrides:
    `execute` in class `ControllerSupport`
  Throws:
    `Exception`
  See Also:
    `perform(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)`, `doPerform(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)`

### initApplicationContext

    protected void initApplicationContext()
                                   throws BeansException

  Subclasses can override this for custom initialization behavior. Gets called on initialization of the context for this controller.

  Throws:
    `ApplicationContextException` - in case of initialization errors
    `BeansException` - if thrown by application context methods

### getApplicationContext

    protected final ApplicationContext getApplicationContext()

  Return the current Spring ApplicationContext.

### getWebApplicationContext

    protected final WebApplicationContext getWebApplicationContext()

  Return the current Spring WebApplicationContext.

### getMessageSourceAccessor

    protected final MessageSourceAccessor getMessageSourceAccessor()

  Return a MessageSourceAccessor for the application context used by this object, for easy message access.

### getServletContext

    protected final ServletContext getServletContext()

  Return the current ServletContext.

### getTempDir

    protected final File getTempDir()

  Return the temporary directory for the current web application, as provided by the servlet container.

  Returns:
    the File representing the temporary directory

### doPerform

    protected abstract void doPerform(ComponentContext componentContext,
                                      HttpServletRequest request,
                                      HttpServletResponse response)
                               throws Exception

  Perform the preparation for the component, allowing for any Exception to be thrown. The ServletContext can be retrieved via getServletContext, if necessary. The Spring WebApplicationContext can be accessed via getWebApplicationContext.

  This method will be called both in the Struts 1.1 and Struts 1.2 case, by `perform` or `execute`, respectively.

  Parameters:
    `componentContext` - current Tiles component context
    `request` - current HTTP request
    `response` - current HTTP response
  Throws:
    `Exception` - in case of errors
  See Also:
    `Controller.perform(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)`, `getServletContext()`, `getWebApplicationContext()`, `perform(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)`, `execute(org.apache.struts.tiles.ComponentContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.