|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.presentation.servlet.CB2PlugIn
Struts plugin to enable CB2 presentation level for a Struts module. This plugin should be set up for each module that uses CB2. Regardless of how any instances of the plugin you install for different modules they all will share the same application context, business logic level and other basic application-wide subsystems, however each module will have its own presentation level subsystems such as CB2 pages.
The plugin expects the following init parameters:
/WEB-INF/pages-config.xml
.com.boylesoftware.cb2.presentation.servlet.CB2RequestProcessor
.
If not specified defaults to CB2RequestProcessor
.com.boylesoftware.cb2.presentation.servlet.UIState
.
If not specified the module will be provided with the default
UIState
implementation.ServletRequest.setCharacterEncoding
method before passing
control to any action or page.
ServletResponse.setContentType
, as
well as set HTTP header "Content-Type" using
HttpServletResponse.setHeader
. The difference of this
mechanism from Struts' controller "contentType" attribute is that Struts
only calls setContentType
and does not explicitely sets
the "Content-Type" HTTP response header, which may be required in some
Servlet Container implementations for proper results. As in Struts,
CB2 sets the content type before passing control to any action or page,
which, if desired, may override it. Note, that if this parameter is
specified, the framework sets content type on every
response. More often it is better to control this on per page basis via
"contentType" attribute of <page>
elements in the PL
configuration file, and since "contentType" attribute is inheritable, you
can achieve the same effect by specifying it for an abstract page, which is
extended by all other pages.
Below is a sample fragment of a struts config file:
... <plug-in className="com.boylesoftware.cb2.presentation.servlet.CB2PlugIn"> <set-property property="pages-config" value="/WEB-INF/pages-config-mymodule.xml"/> <set-property property="uistate" value="my.package.MyUIState"/> </plug-in> ...
Note that this plugin installs its own implementation of the
RequestProcessor
for the module and therefore it is
not compatible with other plugins that do the same, for example with
TilesPlugin
.
This implementation supports persistent sessions provided that you
set com.boylesoftware.cb2.keepBLSessions
application
property to true
so the BLManager
does not
destroy BLO containers when the application goes down. Note that if you
turn on persistent sessions in your servlet container implementation
and forget to set the com.boylesoftware.cb2.keepBLSessions
property you will get errors when using restored sessions.
Constructor Summary | |
CB2PlugIn()
|
Method Summary | |
void |
destroy()
Destroys the plugin when the application goes down. |
static CB2Application |
getApplication(javax.servlet.ServletContext servletCtx)
Finds the CB2Application instance for the web-application. |
void |
init(org.apache.struts.action.ActionServlet servlet,
org.apache.struts.config.ModuleConfig config)
Initialize the plugin for a module. |
void |
setController(java.lang.String controllerClassName)
Sets the controller class name init parameter. |
void |
setLockedUrl(java.lang.String lockedUrl)
Sets the URL of the "application is locked" page. |
void |
setPagesConfig(java.lang.String pagesConfig)
Sets the pages config file URL init parameter. |
void |
setRequestCharEncoding(java.lang.String requestCharEncoding)
Sets optional request character encoding. |
void |
setResponseContentType(java.lang.String responseContentType)
Sets optional response content type. |
void |
setUistate(java.lang.String uiStateClassName)
Sets the UI state bean class name init parameter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CB2PlugIn()
Method Detail |
public void setPagesConfig(java.lang.String pagesConfig)
pagesConfig
- pages config file servlet context relative URL.public void setController(java.lang.String controllerClassName)
controllerClassName
- the controller class name.public void setUistate(java.lang.String uiStateClassName)
uiStateClassName
- the UI state bean class name.public void setLockedUrl(java.lang.String lockedUrl)
lockedUrl
- the page's URL.public void setRequestCharEncoding(java.lang.String requestCharEncoding)
requestCharEncoding
- the request character encoding.public void setResponseContentType(java.lang.String responseContentType)
responseContentType
- the reponse content type string.public void init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig config) throws javax.servlet.ServletException
init
in interface org.apache.struts.action.PlugIn
servlet
- reference to the Struts action servlet.config
- the module configuration.
javax.servlet.ServletException
- if the plugin cannot be initialized.public void destroy()
destroy
in interface org.apache.struts.action.PlugIn
public static CB2Application getApplication(javax.servlet.ServletContext servletCtx)
CB2Application
instance for the web-application.
servletCtx
- the web-application's servlet context.
CB2Application instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |