struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1476064 - in /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng: filter/ listener/ servlet/
Date Fri, 26 Apr 2013 06:32:25 GMT
Author: lukaszlenart
Date: Fri Apr 26 06:32:25 2013
New Revision: 1476064

URL: http://svn.apache.org/r1476064
Log:
Re-formats code

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareAndExecuteFilter.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/servlet/StrutsServlet.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java?rev=1476064&r1=1476063&r2=1476064&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
Fri Apr 26 06:32:25 2013
@@ -22,12 +22,17 @@ package org.apache.struts2.dispatcher.ng
 
 import org.apache.struts2.StrutsStatics;
 import org.apache.struts2.dispatcher.Dispatcher;
-import org.apache.struts2.dispatcher.ng.PrepareOperations;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
 import org.apache.struts2.dispatcher.ng.ExecuteOperations;
 import org.apache.struts2.dispatcher.ng.InitOperations;
-import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.dispatcher.ng.PrepareOperations;
 
-import javax.servlet.*;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -63,15 +68,15 @@ public class StrutsExecuteFilter impleme
         HttpServletRequest request = (HttpServletRequest) req;
         HttpServletResponse response = (HttpServletResponse) res;
 
-		if (excludeUrl(request)) {
-			chain.doFilter(request, response);
-			return;
-		}
+        if (excludeUrl(request)) {
+            chain.doFilter(request, response);
+            return;
+        }
 
         // This is necessary since we need the dispatcher instance, which was created by
the prepare filter
-		if (execute == null) {
-			lazyInit();
-		}
+        if (execute == null) {
+            lazyInit();
+        }
 
         ActionMapping mapping = prepare.findActionMapping(request, response);
 
@@ -89,13 +94,14 @@ public class StrutsExecuteFilter impleme
         }
     }
 
-	private boolean excludeUrl(HttpServletRequest request) {
-		return request.getAttribute(StrutsPrepareFilter.REQUEST_EXCLUDED_FROM_ACTION_MAPPING) !=
null;
-	}
+    private boolean excludeUrl(HttpServletRequest request) {
+        return request.getAttribute(StrutsPrepareFilter.REQUEST_EXCLUDED_FROM_ACTION_MAPPING)
!= null;
+    }
 
     public void destroy() {
         prepare = null;
         execute = null;
         filterConfig = null;
     }
+
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareAndExecuteFilter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareAndExecuteFilter.java?rev=1476064&r1=1476063&r2=1476064&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareAndExecuteFilter.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareAndExecuteFilter.java
Fri Apr 26 06:32:25 2013
@@ -27,7 +27,12 @@ import org.apache.struts2.dispatcher.ng.
 import org.apache.struts2.dispatcher.ng.InitOperations;
 import org.apache.struts2.dispatcher.ng.PrepareOperations;
 
-import javax.servlet.*;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -41,7 +46,7 @@ import java.util.regex.Pattern;
 public class StrutsPrepareAndExecuteFilter implements StrutsStatics, Filter {
     protected PrepareOperations prepare;
     protected ExecuteOperations execute;
-	protected List<Pattern> excludedPatterns = null;
+    protected List<Pattern> excludedPatterns = null;
 
     public void init(FilterConfig filterConfig) throws ServletException {
         InitOperations init = new InitOperations();
@@ -54,7 +59,7 @@ public class StrutsPrepareAndExecuteFilt
 
             prepare = new PrepareOperations(filterConfig.getServletContext(), dispatcher);
             execute = new ExecuteOperations(filterConfig.getServletContext(), dispatcher);
-			this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
+            this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
 
             postInit(dispatcher, filterConfig);
         } finally {
@@ -63,7 +68,6 @@ public class StrutsPrepareAndExecuteFilt
             }
             init.cleanup();
         }
-
     }
 
     /**
@@ -81,20 +85,20 @@ public class StrutsPrepareAndExecuteFilt
             prepare.setEncodingAndLocale(request, response);
             prepare.createActionContext(request, response);
             prepare.assignDispatcherToThread();
-			if ( excludedPatterns != null && prepare.isUrlExcluded(request, excludedPatterns))
{
-				chain.doFilter(request, response);
-			} else {
-				request = prepare.wrapRequest(request);
-				ActionMapping mapping = prepare.findActionMapping(request, response, true);
-				if (mapping == null) {
-					boolean handled = execute.executeStaticResourceRequest(request, response);
-					if (!handled) {
-						chain.doFilter(request, response);
-					}
-				} else {
-					execute.executeAction(request, response, mapping);
-				}
-			}
+            if (excludedPatterns != null && prepare.isUrlExcluded(request, excludedPatterns))
{
+                chain.doFilter(request, response);
+            } else {
+                request = prepare.wrapRequest(request);
+                ActionMapping mapping = prepare.findActionMapping(request, response, true);
+                if (mapping == null) {
+                    boolean handled = execute.executeStaticResourceRequest(request, response);
+                    if (!handled) {
+                        chain.doFilter(request, response);
+                    }
+                } else {
+                    execute.executeAction(request, response, mapping);
+                }
+            }
         } finally {
             prepare.cleanupRequest(request);
         }
@@ -103,4 +107,5 @@ public class StrutsPrepareAndExecuteFilt
     public void destroy() {
         prepare.cleanupDispatcher();
     }
+
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.java?rev=1476064&r1=1476063&r2=1476064&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.java
Fri Apr 26 06:32:25 2013
@@ -25,7 +25,12 @@ import org.apache.struts2.dispatcher.Dis
 import org.apache.struts2.dispatcher.ng.InitOperations;
 import org.apache.struts2.dispatcher.ng.PrepareOperations;
 
-import javax.servlet.*;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -37,12 +42,12 @@ import java.util.regex.Pattern;
  */
 public class StrutsPrepareFilter implements StrutsStatics, Filter {
 
-	protected static final String REQUEST_EXCLUDED_FROM_ACTION_MAPPING = StrutsPrepareFilter.class.getName()
+ ".REQUEST_EXCLUDED_FROM_ACTION_MAPPING";
+    protected static final String REQUEST_EXCLUDED_FROM_ACTION_MAPPING = StrutsPrepareFilter.class.getName()
+ ".REQUEST_EXCLUDED_FROM_ACTION_MAPPING";
 
     protected PrepareOperations prepare;
-	protected List<Pattern> excludedPatterns = null;
+    protected List<Pattern> excludedPatterns = null;
 
-	public void init(FilterConfig filterConfig) throws ServletException {
+    public void init(FilterConfig filterConfig) throws ServletException {
         InitOperations init = new InitOperations();
         Dispatcher dispatcher = null;
         try {
@@ -51,7 +56,7 @@ public class StrutsPrepareFilter impleme
             dispatcher = init.initDispatcher(config);
 
             prepare = new PrepareOperations(filterConfig.getServletContext(), dispatcher);
-			this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
+            this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
 
             postInit(dispatcher, filterConfig);
         } finally {
@@ -77,19 +82,20 @@ public class StrutsPrepareFilter impleme
             prepare.setEncodingAndLocale(request, response);
             prepare.createActionContext(request, response);
             prepare.assignDispatcherToThread();
-			if ( excludedPatterns != null && prepare.isUrlExcluded(request, excludedPatterns))
{
-				request.setAttribute(REQUEST_EXCLUDED_FROM_ACTION_MAPPING, new Object());
-			} else {
-				request = prepare.wrapRequest(request);
-				prepare.findActionMapping(request, response);
-			}
+            if (excludedPatterns != null && prepare.isUrlExcluded(request, excludedPatterns))
{
+                request.setAttribute(REQUEST_EXCLUDED_FROM_ACTION_MAPPING, new Object());
+            } else {
+                request = prepare.wrapRequest(request);
+                prepare.findActionMapping(request, response);
+            }
             chain.doFilter(request, response);
         } finally {
             prepare.cleanupRequest(request);
         }
     }
 
-	public void destroy() {
+    public void destroy() {
         prepare.cleanupDispatcher();
     }
+
 }

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java?rev=1476064&r1=1476063&r2=1476064&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/listener/StrutsListener.java
Fri Apr 26 06:32:25 2013
@@ -32,13 +32,13 @@ import javax.servlet.ServletContextListe
  * Servlet listener for Struts.  The preferred way to use Struts is as a filter via the
  * {@link org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter} and its
variants.
  * This might be useful if Struts config information is needed from other servlet listeners,
like
- * Sitemesh or OSGi 
+ * Sitemesh or OSGi
  */
 public class StrutsListener implements ServletContextListener {
     private PrepareOperations prepare;
 
     public void contextInitialized(ServletContextEvent sce) {
-       InitOperations init = new InitOperations();
+        InitOperations init = new InitOperations();
         Dispatcher dispatcher = null;
         try {
             ListenerHostConfig config = new ListenerHostConfig(sce.getServletContext());

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/servlet/StrutsServlet.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/servlet/StrutsServlet.java?rev=1476064&r1=1476063&r2=1476064&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/servlet/StrutsServlet.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/servlet/StrutsServlet.java
Fri Apr 26 06:32:25 2013
@@ -21,15 +21,16 @@
 package org.apache.struts2.dispatcher.ng.servlet;
 
 import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.dispatcher.ng.ExecuteOperations;
 import org.apache.struts2.dispatcher.ng.InitOperations;
 import org.apache.struts2.dispatcher.ng.PrepareOperations;
-import org.apache.struts2.dispatcher.ng.ExecuteOperations;
-import org.apache.struts2.dispatcher.mapper.ActionMapping;
 
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.*;
 import java.io.IOException;
 
 /**
@@ -88,4 +89,5 @@ public class StrutsServlet extends HttpS
     public void destroy() {
         prepare.cleanupDispatcher();
     }
+
 }



Mime
View raw message