mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-3196 Add post init hook, and change fields visibility to protected
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@798341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -37,10 +37,10 @@ import java.io.IOException;
|
||||
* been executed in the current chain.
|
||||
*/
|
||||
public class StrutsExecuteFilter implements StrutsStatics, Filter {
|
||||
private PrepareOperations prepare;
|
||||
private ExecuteOperations execute;
|
||||
protected PrepareOperations prepare;
|
||||
protected ExecuteOperations execute;
|
||||
|
||||
private FilterConfig filterConfig;
|
||||
protected FilterConfig filterConfig;
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
this.filterConfig = filterConfig;
|
||||
|
||||
+10
-2
@@ -39,8 +39,8 @@ import java.util.regex.Pattern;
|
||||
* when you don't have another filter that needs access to action context information, such as Sitemesh.
|
||||
*/
|
||||
public class StrutsPrepareAndExecuteFilter implements StrutsStatics, Filter {
|
||||
private PrepareOperations prepare;
|
||||
private ExecuteOperations execute;
|
||||
protected PrepareOperations prepare;
|
||||
protected ExecuteOperations execute;
|
||||
protected List<Pattern> excludedPatterns = null;
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
@@ -54,12 +54,20 @@ public class StrutsPrepareAndExecuteFilter implements StrutsStatics, Filter {
|
||||
prepare = new PrepareOperations(filterConfig.getServletContext(), dispatcher);
|
||||
execute = new ExecuteOperations(filterConfig.getServletContext(), dispatcher);
|
||||
this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
|
||||
|
||||
postInit(dispatcher, filterConfig);
|
||||
} finally {
|
||||
init.cleanup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for post initialization
|
||||
*/
|
||||
protected void postInit(Dispatcher dispatcher, FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
@@ -39,8 +39,8 @@ public class StrutsPrepareFilter implements StrutsStatics, Filter {
|
||||
|
||||
protected static final String REQUEST_EXCLUDED_FROM_ACTION_MAPPING = StrutsPrepareFilter.class.getName() + ".REQUEST_EXCLUDED_FROM_ACTION_MAPPING";
|
||||
|
||||
private PrepareOperations prepare;
|
||||
private List<Pattern> excludedPatterns = null;
|
||||
protected PrepareOperations prepare;
|
||||
protected List<Pattern> excludedPatterns = null;
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
InitOperations init = new InitOperations();
|
||||
@@ -51,10 +51,17 @@ public class StrutsPrepareFilter implements StrutsStatics, Filter {
|
||||
|
||||
prepare = new PrepareOperations(filterConfig.getServletContext(), dispatcher);
|
||||
this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
|
||||
|
||||
postInit(dispatcher, filterConfig);
|
||||
} finally {
|
||||
init.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for post initialization
|
||||
*/
|
||||
protected void postInit(Dispatcher dispatcher, FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
Reference in New Issue
Block a user