|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.terasoluna.fw.web.thin.AbstractControlFilter<E>
E
- Specifies controller class.public abstract class AbstractControlFilter<E>
Abstract class that performs access control by using the controller which is implemented as bean.
This class is the upper class of the class that performs access control by using the bean
which is fetched from DI container.
To use the implementation class of this class,
perform the following settings in deployment descriptor(web.xml)
and Bean definition file.
The id attribute which is defined in Bean definition file should be set as sampleXxxController. In the "class" attribute of <bean> element, set the class that implements the interface which represents each of the filters (here it is referred as SampleXxxController).
*Xxx differs depending on the Filter that provides each function.
<filter>
<filter-name>
xxxControlFilter
</filter-name>
<filter-class>
jp.terasoluna.sample.XxxControlFilter
</filter-class>
<init-param>
<param-name>controller</param-name>
<param-value>
"sampleXxxController"
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>xxxControlFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<error-page>
<exception-type>
jp.terasoluna.sample.XxxException
</exception-type>
<location>/XxxError.jsp</location>
</error-page>
Bean definition file
<bean id="sampleXxxController"
class="jp.terasoluna...SampleXxxController" />
Filter provides the default value in the "id" attribute of <bean> element defined in Bean definition file. In this case, <init-param> elements can be omitted from the <filter> element in deployment descriptor(web.xml).
Field Summary | |
---|---|
protected javax.servlet.FilterConfig |
config
Filter configuration information. |
private static org.apache.commons.logging.Log |
log
Log class. |
Constructor Summary | |
---|---|
AbstractControlFilter()
|
Method Summary | |
---|---|
void |
destroy()
It is called when filter process is performed. Processing is not performed in this class. |
abstract void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
Performs access control. |
protected E |
getController()
Fetches controller instance from DI container. |
protected abstract java.lang.Class |
getControllerClass()
Returns the interface that should be implemented by the class which performs access control. |
abstract java.lang.String |
getDefaultControllerBeanId()
Returns default id at the time of fetching controller from DI container. |
protected abstract java.lang.String |
getErrorCode()
Returns error code which indicates the failure in generating the controller. |
void |
init(javax.servlet.FilterConfig config)
When the filter changes to "Service start state", it is called by the container. After creating an instance of the filter, container calls init method only once. In order to request the filter to execute the filter process, init method should finish normally. Container cannot change the Filter to service state when the init method is any of the following. ServletException is thrown. It is not restored within the time defined by container. Either the implementation class of the controller does not exist or the settings are abnormal. |
protected void |
setConfig(javax.servlet.FilterConfig config)
Sets filter configuration information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
protected javax.servlet.FilterConfig config
Constructor Detail |
---|
public AbstractControlFilter()
Method Detail |
---|
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
config
- FilterConfig instance.
javax.servlet.ServletException
- Exception which is thrown at the time of abnormal initialization.Filter.init(javax.servlet.FilterConfig)
protected void setConfig(javax.servlet.FilterConfig config)
config
- Filter configuration informationprotected E getController()
protected abstract java.lang.Class getControllerClass()
protected abstract java.lang.String getErrorCode()
public abstract java.lang.String getDefaultControllerBeanId()
public abstract void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
req
- HTTP requestres
- HTTP responsechain
- Filter chain
java.io.IOException
- I/O error
javax.servlet.ServletException
- Servlet exceptionFilter.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
javax.servlet.FilterChain)
public void destroy()
destroy
in interface javax.servlet.Filter
Filter.destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |