|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.tiles.ControllerSupport org.springframework.web.servlet.view.tiles.ComponentControllerSupport
public abstract class ComponentControllerSupport
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 Tiles' ControllerSupport class rather than
implementing Tiles' Controller interface 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.
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 |
---|
public ComponentControllerSupport()
Method Detail |
---|
public final void perform(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws ServletException, IOException
execute
,
converting non-Servlet/IO Exceptions to ServletException.
This is the only execution method available in Struts 1.1.
perform
in interface Controller
perform
in class ControllerSupport
public final void execute(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception
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
.
execute
in interface Controller
execute
in class ControllerSupport
Exception
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)
protected void initApplicationContext() throws BeansException
ApplicationContextException
- in case of initialization errors
BeansException
- if thrown by application context methodsprotected final ApplicationContext getApplicationContext()
protected final WebApplicationContext getWebApplicationContext()
protected final MessageSourceAccessor getMessageSourceAccessor()
protected final ServletContext getServletContext()
protected final File getTempDir()
protected abstract void doPerform(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response) throws Exception
This method will be called both in the Struts 1.1 and Struts 1.2 case,
by perform
or execute
, respectively.
componentContext
- current Tiles component contextrequest
- current HTTP requestresponse
- current HTTP response
Exception
- in case of errorsController.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)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |