Anonymous avatar Anonymous committed b8cd142

https works when default

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@413 573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (2)

src/java/com/opensymphony/webwork/views/jsp/URLTag.java

 package com.opensymphony.webwork.views.jsp;
 
 import com.opensymphony.webwork.views.util.UrlHelper;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.IOException;
-
-import java.net.URLEncoder;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.http.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpUtils;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+import java.util.HashMap;
 
 
 /**
  * You can use the "param" tag inside the body to provide
  * additional request parameters.
  *
- * @see com.opensymphony.webwork.views.jsp.ParamTag
  * @author Rickard �berg (rickard@dreambean.com)
  * @version $Revision$
+ * @see com.opensymphony.webwork.views.jsp.ParamTag
  */
 public class URLTag extends ParametereizedBodyTagSupport {
     //~ Static fields/initializers /////////////////////////////////////////////
 
     // Attributes ----------------------------------------------------
     protected String valueAttr;
-    protected String scheme = "http";
+    protected String schemeAttr;
     protected boolean includeContext = true;
     protected boolean encodeResult = true;
 
         valueAttr = aName;
     }
 
-    public void setScheme(String aScheme) {
-        scheme = aScheme;
+    public void setSchemeAttr(String aScheme) {
+        schemeAttr = aScheme;
     }
 
     public void setIncludeContext(boolean includeContext) {
     public int doEndTag() throws JspException {
         HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
         HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
+        String scheme = request.getScheme();
+        if (schemeAttr != null) {
+            scheme = schemeAttr;
+        }
+
         String result = UrlHelper.buildUrl(value, request, response, params, scheme, includeContext, encodeResult);
 
         String id = getId();

src/test/com/opensymphony/webwork/views/jsp/URLTagTest.java

  */
 package com.opensymphony.webwork.views.jsp;
 
-import com.mockobjects.servlet.MockHttpServletRequest;
 import com.mockobjects.servlet.MockJspWriter;
-import com.mockobjects.servlet.MockPageContext;
-
-import com.opensymphony.xwork.ActionContext;
-import com.opensymphony.xwork.util.OgnlValueStack;
-
-import junit.framework.TestCase;
-
-import java.util.HashMap;
 
 import javax.servlet.jsp.JspException;
 
         }
     }
 
+    public void testHttps() {
+        request.setScheme("https");
+        request.setServerName("localhost");
+        request.setServerPort(443);
+
+        jspWriter.setExpectedData("list-members.action");
+        tag.setValue("'list-members.action'");
+
+        try {
+            tag.doStartTag();
+            tag.doEndTag();
+        } catch (JspException ex) {
+            ex.printStackTrace();
+            fail();
+        }
+    }
+
     public void testAddParameters() {
         request.setAttribute("webwork.request_uri", "/Test.action");
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.