Author: markt
Date: Sun Sep 13 16:57:06 2015
New Revision: 1702795
URL: http://svn.apache.org/r1702795
Log:
Simplify ApplicationFilterFactory.
It is a utility class so use static methods rather than going via a
getInstance() method.
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=1702795&r1=1702794&r2=1702795&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java Sun
Sep 13 16:57:06 2015
@@ -708,9 +708,8 @@ final class ApplicationDispatcher implem
}
// Get the FilterChain Here
- ApplicationFilterFactory factory =
ApplicationFilterFactory.getInstance();
- ApplicationFilterChain filterChain = factory.createFilterChain(request,
-
wrapper,servlet);
+ ApplicationFilterChain filterChain =
+ ApplicationFilterFactory.createFilterChain(request, wrapper,
servlet);
// Call the service() method for the allocated servlet instance
try {
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=1702795&r1=1702794&r2=1702795&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
Sun Sep 13 16:57:06 2015
@@ -34,25 +34,8 @@ import org.apache.tomcat.util.descriptor
*/
public final class ApplicationFilterFactory {
- private static ApplicationFilterFactory factory = null;
-
-
private ApplicationFilterFactory() {
- // Prevent instantiation outside of the getInstanceMethod().
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return the factory instance.
- */
- public static ApplicationFilterFactory getInstance() {
- if (factory == null) {
- factory = new ApplicationFilterFactory();
- }
- return factory;
+ // Prevent instance creation. This is a utility class.
}
@@ -63,8 +46,9 @@ public final class ApplicationFilterFact
*
* @param request The servlet request we are processing
* @param servlet The servlet instance to be wrapped
+
*/
- public ApplicationFilterChain createFilterChain
+ public static ApplicationFilterChain createFilterChain
(ServletRequest request, Wrapper wrapper, Servlet servlet) {
// get the dispatcher type
@@ -168,7 +152,7 @@ public final class ApplicationFilterFact
* @param filterMap Filter mapping being checked
* @param requestPath Context-relative request path of this request
*/
- private boolean matchFiltersURL(FilterMap filterMap, String requestPath) {
+ private static boolean matchFiltersURL(FilterMap filterMap, String
requestPath) {
// Check the specific "*" special URL pattern, which also matches
// named dispatches
@@ -201,7 +185,7 @@ public final class ApplicationFilterFact
* @param testPath URL mapping being checked
* @param requestPath Context-relative request path of this request
*/
- private boolean matchFiltersURL(String testPath, String requestPath) {
+ private static boolean matchFiltersURL(String testPath, String
requestPath) {
if (testPath == null)
return false;
@@ -252,7 +236,7 @@ public final class ApplicationFilterFact
* @param filterMap Filter mapping being checked
* @param servletName Servlet name being checked
*/
- private boolean matchFiltersServlet(FilterMap filterMap,
+ private static boolean matchFiltersServlet(FilterMap filterMap,
String servletName) {
if (servletName == null) {
@@ -278,7 +262,7 @@ public final class ApplicationFilterFact
* Convenience method which returns true if the dispatcher type
* matches the dispatcher types specified in the FilterMap
*/
- private boolean matchDispatcher(FilterMap filterMap, DispatcherType type) {
+ private static boolean matchDispatcher(FilterMap filterMap, DispatcherType
type) {
switch (type) {
case FORWARD :
if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) >
0) {
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java?rev=1702795&r1=1702794&r2=1702795&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java Sun
Sep 13 16:57:06 2015
@@ -168,10 +168,8 @@ final class StandardWrapperValve
request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR,
requestPathMB);
// Create the filter chain for this request
- ApplicationFilterFactory factory =
- ApplicationFilterFactory.getInstance();
ApplicationFilterChain filterChain =
- factory.createFilterChain(request, wrapper, servlet);
+ ApplicationFilterFactory.createFilterChain(request, wrapper,
servlet);
// Call the filter chain for this request
// NOTE: This also calls the servlet's service() method
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]