You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by sd...@apache.org on 2017/03/29 09:56:53 UTC
[04/16] struts-extras git commit: added
HttpsOffloadAwareServletActionRedirectResult
added HttpsOffloadAwareServletActionRedirectResult
Project: http://git-wip-us.apache.org/repos/asf/struts-extras/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-extras/commit/276471cc
Tree: http://git-wip-us.apache.org/repos/asf/struts-extras/tree/276471cc
Diff: http://git-wip-us.apache.org/repos/asf/struts-extras/diff/276471cc
Branch: refs/heads/master
Commit: 276471cc49c84e5016d2beaf7770a5e036e5e191
Parents: 02a1ca6
Author: Stefaan Dutry <st...@gmail.com>
Authored: Tue Mar 28 08:35:36 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Tue Mar 28 08:35:36 2017 +0200
----------------------------------------------------------------------
...OffloadAwareServletActionRedirectResult.java | 123 +++++++++++++++++++
.../HttpsOffloadAwareServletRedirectResult.java | 12 ++
2 files changed, 135 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts-extras/blob/276471cc/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletActionRedirectResult.java
----------------------------------------------------------------------
diff --git a/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletActionRedirectResult.java b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletActionRedirectResult.java
new file mode 100644
index 0000000..0cd1390
--- /dev/null
+++ b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletActionRedirectResult.java
@@ -0,0 +1,123 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts2.result;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.result.ServletRedirectResult;
+import org.apache.struts2.views.util.UrlHelper;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.inject.Inject;
+
+public class HttpsOffloadAwareServletActionRedirectResult extends HttpsOffloadAwareServletRedirectResult {
+ /* The default parameter */
+ public static final String DEFAULT_PARAM = "actionName";
+
+ protected String actionName;
+ protected String namespace;
+ protected String method;
+
+ public HttpsOffloadAwareServletActionRedirectResult() {}
+
+ public HttpsOffloadAwareServletActionRedirectResult(String actionName) {
+ this(null, actionName, null, null);
+ }
+
+ public HttpsOffloadAwareServletActionRedirectResult(String actionName, String method) {
+ this(null, actionName, method, null);
+ }
+
+ public HttpsOffloadAwareServletActionRedirectResult(String namespace, String actionName, String method) {
+ this(namespace, actionName, method, null);
+ }
+
+ public HttpsOffloadAwareServletActionRedirectResult(String namespace, String actionName, String method, String anchor) {
+ super(null, anchor);
+ this.namespace = namespace;
+ this.actionName = actionName;
+ this.method = method;
+ }
+
+ /**
+ * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
+ */
+ public void execute(ActionInvocation invocation) throws Exception {
+ actionName = conditionalParse(actionName, invocation);
+ if (namespace == null) {
+ namespace = invocation.getProxy().getNamespace();
+ } else {
+ namespace = conditionalParse(namespace, invocation);
+ }
+ if (method == null) {
+ method = "";
+ } else {
+ method = conditionalParse(method, invocation);
+ }
+
+ String tmpLocation = actionMapper.getUriFromActionMapping(new ActionMapping(actionName, namespace, method, null));
+
+ setLocation(tmpLocation);
+
+ super.execute(invocation);
+ }
+
+ /**
+ * Sets the action name
+ *
+ * @param actionName The name
+ */
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ /**
+ * Sets the namespace
+ *
+ * @param namespace The namespace
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ /**
+ * Sets the method
+ *
+ * @param method The method
+ */
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/struts-extras/blob/276471cc/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletRedirectResult.java
----------------------------------------------------------------------
diff --git a/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletRedirectResult.java b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletRedirectResult.java
index 201eb3b..9de6739 100644
--- a/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletRedirectResult.java
+++ b/struts2-custom-results-plugin/src/main/java/org/apache/struts2/result/HttpsOffloadAwareServletRedirectResult.java
@@ -52,6 +52,18 @@ public class HttpsOffloadAwareServletRedirectResult extends ServletRedirectResul
this.urlHelper = urlHelper;
}
+ public HttpsOffloadAwareServletRedirectResult() {
+ super();
+ }
+
+ public HttpsOffloadAwareServletRedirectResult(String location) {
+ this(location, null);
+ }
+
+ public HttpsOffloadAwareServletRedirectResult(String location, String anchor) {
+ super(location, anchor);
+ }
+
/**
* Redirects to the location specified by calling
* {@link HttpServletResponse#sendRedirect(String)}.