You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sami Dalouche (JIRA)" <ji...@apache.org> on 2007/05/27 18:44:42 UTC
[jira] Created: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
-------------------------------------------------------------------------------------------------------
Key: WW-1950
URL: https://issues.apache.org/struts/browse/WW-1950
Project: Struts 2
Issue Type: Bug
Components: Views
Reporter: Sami Dalouche
If you add this test to UrlHelperTest, you will find out that it fails..
public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
mockHttpServletRequest.expectAndReturn("getScheme", "http");
mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
assertEquals(expectedUrl, result);
mockHttpServletRequest.verify();
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Work started: (WW-1950) UrlHelper.buildUrl does not output
port even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "James Holmes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on WW-1950 started by James Holmes.
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
> Assignee: James Holmes
> Fix For: 2.1.0
>
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "James Holmes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Holmes resolved WW-1950.
------------------------------
Resolution: Fixed
Fix Version/s: 2.0.10
Fixed on the 2_0_X branch in SVN revision 565492.
Fixed on the trunk (Struts 2.1) in SVN revision 565609.
Thanks for the heads up and the test case!
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
> Assignee: James Holmes
> Fix For: 2.0.10, 2.1.0
>
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "Rainer Hermanns (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rainer Hermanns updated WW-1950:
--------------------------------
Fix Version/s: 2.1.0
Assignee: Rainer Hermanns
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
> Assignee: Rainer Hermanns
> Fix For: 2.1.0
>
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "James Holmes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41824 ]
James Holmes commented on WW-1950:
----------------------------------
The reason why this test fails is because Struts 2 does not currently use the port from the current request to build new URLs. Instead, Struts 2 uses the two configurable ports ("struts.url.http.port" and "struts.url.https.port").
The only scenario where the port from the request should be used is in when not switching between schemes. I have fixed that scenario and added the attached test case. The test case passes with the fix for using the request port when not switching schemes.
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
> Assignee: James Holmes
> Fix For: 2.1.0
>
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "James Holmes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Holmes reassigned WW-1950:
--------------------------------
Assignee: James Holmes (was: Rainer Hermanns)
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
> Assignee: James Holmes
> Fix For: 2.1.0
>
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-1950) UrlHelper.buildUrl does not output port
even if forceAddSchemeHostAndPort turned on (TestCase included)
Posted by "Sami Dalouche (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sami Dalouche updated WW-1950:
------------------------------
Affects Version/s: 2.0.8
> UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)
> -------------------------------------------------------------------------------------------------------
>
> Key: WW-1950
> URL: https://issues.apache.org/struts/browse/WW-1950
> Project: Struts 2
> Issue Type: Bug
> Components: Views
> Affects Versions: 2.0.8
> Reporter: Sami Dalouche
>
> If you add this test to UrlHelperTest, you will find out that it fails..
> public void testForceAddSchemeHostAndPortWithNonStandardPort() throws Exception {
> String expectedUrl = "http://localhost:9090/contextPath/path1/path2/myAction.action";
> Mock mockHttpServletRequest = new Mock(HttpServletRequest.class);
> mockHttpServletRequest.expectAndReturn("getScheme", "http");
> mockHttpServletRequest.expectAndReturn("getServerName", "localhost");
> mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath");
> mockHttpServletRequest.expectAndReturn("getServerPort", 9090);
> Mock mockHttpServletResponse = new Mock(HttpServletResponse.class);
> mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl);
> String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true);
> assertEquals(expectedUrl, result);
> mockHttpServletRequest.verify();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.