Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1950

UrlHelper.buildUrl does not output port even if forceAddSchemeHostAndPort turned on (TestCase included)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.8
    • 2.0.10, 2.1.0
    • Plugin - Tags
    • None
    • Important

    Description

      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(); }

      Attachments

        Activity

          People

            jholmes James Holmes
            samokk Sami Dalouche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: