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:
Musachy Barroso
2009-07-28 00:12:12 +00:00
parent a6f1e0d755
commit 4593090a00
3 changed files with 22 additions and 7 deletions
@@ -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;
@@ -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 {