used spaces for indentation

Project: http://git-wip-us.apache.org/repos/asf/struts-extras/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-extras/commit/7879bafe
Tree: http://git-wip-us.apache.org/repos/asf/struts-extras/tree/7879bafe
Diff: http://git-wip-us.apache.org/repos/asf/struts-extras/diff/7879bafe

Branch: refs/heads/master
Commit: 7879bafe58fd7d82d8e31f34dd88736e337f0a12
Parents: 1a64217
Author: Stefaan Dutry <stefaan.du...@gmail.com>
Authored: Mon Mar 27 23:25:40 2017 +0200
Committer: Stefaan Dutry <stefaan.du...@gmail.com>
Committed: Mon Mar 27 23:25:40 2017 +0200

----------------------------------------------------------------------
 .../HttpsOffloadAwareServletRedirectResult.java | 200 +++++++++----------
 1 file changed, 100 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-extras/blob/7879bafe/struts2-custom-results-plugin/src/main/java/org/apache/struts2/dispatcher/HttpsOffloadAwareServletRedirectResult.java
----------------------------------------------------------------------
diff --git 
a/struts2-custom-results-plugin/src/main/java/org/apache/struts2/dispatcher/HttpsOffloadAwareServletRedirectResult.java
 
b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/dispatcher/HttpsOffloadAwareServletRedirectResult.java
index 751e783..b3ee26a 100644
--- 
a/struts2-custom-results-plugin/src/main/java/org/apache/struts2/dispatcher/HttpsOffloadAwareServletRedirectResult.java
+++ 
b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/dispatcher/HttpsOffloadAwareServletRedirectResult.java
@@ -42,105 +42,105 @@ import 
com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.inject.Inject;
 
 public class HttpsOffloadAwareServletRedirectResult extends 
ServletRedirectResult {
-       private static final long serialVersionUID = -5384946213381645549L;
-       private static final Logger LOG = 
LogManager.getLogger(HttpsOffloadAwareServletRedirectResult.class);
-
-       private UrlHelper urlHelper;
-
-       @Inject
-       public void setUrlHelper(UrlHelper urlHelper) {
-               this.urlHelper = urlHelper;
-       }
-
-       /**
-        * Redirects to the location specified by calling
-        * {@link HttpServletResponse#sendRedirect(String)}.
-        * 
-        * @param finalLocation
-        *            the location to redirect to.
-        * @param invocation
-        *            an encapsulation of the action execution state.
-        * @throws Exception
-        *             if an error occurs when redirecting.
-        */
-       protected void doExecute(String finalLocation, ActionInvocation 
invocation) throws Exception {
-               ActionContext ctx = invocation.getInvocationContext();
-               HttpServletRequest request = (HttpServletRequest) 
ctx.get(ServletActionContext.HTTP_REQUEST);
-               HttpServletResponse response = (HttpServletResponse) 
ctx.get(ServletActionContext.HTTP_RESPONSE);
-
-               if (isPathUrl(finalLocation)) {
-                       if (!finalLocation.startsWith("/")) {
-                               ActionMapping mapping = 
actionMapper.getMapping(request,
-                                               
Dispatcher.getInstance().getConfigurationManager());
-                               String namespace = null;
-                               if (mapping != null) {
-                                       namespace = mapping.getNamespace();
-                               }
-
-                               if ((namespace != null) && (namespace.length() 
> 0) && (!"/".equals(namespace))) {
-                                       finalLocation = namespace + "/" + 
finalLocation;
-                               } else {
-                                       finalLocation = "/" + finalLocation;
-                               }
-                       }
-
-                       // if the URL's are relative to the servlet context, 
append the
-                       // servlet context path
-                       if (prependServletContext && (request.getContextPath() 
!= null)
-                                       && (request.getContextPath().length() > 
0)) {
-                               finalLocation = request.getContextPath() + 
finalLocation;
-                       }
-
-                       finalLocation = fixSchemeIfNeeded(finalLocation, 
request);
-               }
-               ResultConfig resultConfig = 
invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
-               if (resultConfig != null) {
-                       Map<String, String> resultConfigParams = 
resultConfig.getParams();
-
-                       List<String> prohibitedResultParams = 
getProhibitedResultParams();
-                       for (Map.Entry<String, String> e : 
resultConfigParams.entrySet()) {
-                               if 
(!prohibitedResultParams.contains(e.getKey())) {
-                                       Collection<String> values = 
conditionalParseCollection(e.getValue(), invocation,
-                                                       
suppressEmptyParameters);
-                                       if (!suppressEmptyParameters || 
!values.isEmpty()) {
-                                               
requestParameters.put(e.getKey(), values);
-                                       }
-                               }
-                       }
-               }
-
-               StringBuilder tmpLocation = new StringBuilder(finalLocation);
-               urlHelper.buildParametersString(requestParameters, tmpLocation, 
"&");
-
-               // add the anchor
-               if (anchor != null) {
-                       tmpLocation.append('#').append(anchor);
-               }
-
-               finalLocation = 
response.encodeRedirectURL(tmpLocation.toString());
-
-               LOG.debug("Redirecting to finalLocation: {}", finalLocation);
-
-               sendRedirect(response, finalLocation);
-       }
-
-       private String fixSchemeIfNeeded(String location, HttpServletRequest 
request) {
-               if ("https".equals(request.getHeader("X-Forwarded-Proto"))) {
-                       LOG.debug("https offloading happened, fixing 
redirectlocation");
-                       StringBuilder fixedLocation = new StringBuilder();
-                       fixedLocation.append("https");
-                       fixedLocation.append("://");
-                       fixedLocation.append(request.getServerName());
-                       if (request.getServerPort() != 80) {
-                               fixedLocation.append(':');
-                               fixedLocation.append(request.getServerPort());
-                       }
-                       fixedLocation.append(location);
-
-                       return fixedLocation.toString();
-               } else {
-                       return location;
-               }
-       }
+    private static final long serialVersionUID = -5384946213381645549L;
+    private static final Logger LOG = 
LogManager.getLogger(HttpsOffloadAwareServletRedirectResult.class);
+
+    private UrlHelper urlHelper;
+
+    @Inject
+    public void setUrlHelper(UrlHelper urlHelper) {
+        this.urlHelper = urlHelper;
+    }
+
+    /**
+     * Redirects to the location specified by calling
+     * {@link HttpServletResponse#sendRedirect(String)}.
+     * 
+     * @param finalLocation
+     *            the location to redirect to.
+     * @param invocation
+     *            an encapsulation of the action execution state.
+     * @throws Exception
+     *             if an error occurs when redirecting.
+     */
+    protected void doExecute(String finalLocation, ActionInvocation 
invocation) throws Exception {
+        ActionContext ctx = invocation.getInvocationContext();
+        HttpServletRequest request = (HttpServletRequest) 
ctx.get(ServletActionContext.HTTP_REQUEST);
+        HttpServletResponse response = (HttpServletResponse) 
ctx.get(ServletActionContext.HTTP_RESPONSE);
+
+        if (isPathUrl(finalLocation)) {
+            if (!finalLocation.startsWith("/")) {
+                ActionMapping mapping = actionMapper.getMapping(request,
+                        Dispatcher.getInstance().getConfigurationManager());
+                String namespace = null;
+                if (mapping != null) {
+                    namespace = mapping.getNamespace();
+                }
+
+                if ((namespace != null) && (namespace.length() > 0) && 
(!"/".equals(namespace))) {
+                    finalLocation = namespace + "/" + finalLocation;
+                } else {
+                    finalLocation = "/" + finalLocation;
+                }
+            }
+
+            // if the URL's are relative to the servlet context, append the
+            // servlet context path
+            if (prependServletContext && (request.getContextPath() != null)
+                    && (request.getContextPath().length() > 0)) {
+                finalLocation = request.getContextPath() + finalLocation;
+            }
+
+            finalLocation = fixSchemeIfNeeded(finalLocation, request);
+        }
+        ResultConfig resultConfig = 
invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
+        if (resultConfig != null) {
+            Map<String, String> resultConfigParams = resultConfig.getParams();
+
+            List<String> prohibitedResultParams = getProhibitedResultParams();
+            for (Map.Entry<String, String> e : resultConfigParams.entrySet()) {
+                if (!prohibitedResultParams.contains(e.getKey())) {
+                    Collection<String> values = 
conditionalParseCollection(e.getValue(), invocation,
+                            suppressEmptyParameters);
+                    if (!suppressEmptyParameters || !values.isEmpty()) {
+                        requestParameters.put(e.getKey(), values);
+                    }
+                }
+            }
+        }
+
+        StringBuilder tmpLocation = new StringBuilder(finalLocation);
+        urlHelper.buildParametersString(requestParameters, tmpLocation, "&");
+
+        // add the anchor
+        if (anchor != null) {
+            tmpLocation.append('#').append(anchor);
+        }
+
+        finalLocation = response.encodeRedirectURL(tmpLocation.toString());
+
+        LOG.debug("Redirecting to finalLocation: {}", finalLocation);
+
+        sendRedirect(response, finalLocation);
+    }
+
+    private String fixSchemeIfNeeded(String location, HttpServletRequest 
request) {
+        if ("https".equals(request.getHeader("X-Forwarded-Proto"))) {
+            LOG.debug("https offloading happened, fixing redirectlocation");
+            StringBuilder fixedLocation = new StringBuilder();
+            fixedLocation.append("https");
+            fixedLocation.append("://");
+            fixedLocation.append(request.getServerName());
+            if (request.getServerPort() != 80) {
+                fixedLocation.append(':');
+                fixedLocation.append(request.getServerPort());
+            }
+            fixedLocation.append(location);
+
+            return fixedLocation.toString();
+        } else {
+            return location;
+        }
+    }
 
 }

Reply via email to