ICEfaces
  1. ICEfaces
  2. ICE-7941

Add parameter for configuring the base path of an application

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2, EE-1.8.2.GA_P03
    • Fix Version/s: EE-1.8.2.GA_P06
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 1.8.x
    • Assignee Priority:
      P1
    • Salesforce Case Reference:
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)

      Description

      Feature Request: Add ability for an application to use a relative path to the xmlhttp servlet.

      Scenario:

      Instead of rendering the page as follows:

      <script src="/app-context/xmlhttp/1332234398300/icefaces-d2d.js" type="text/javascript"></script>

      It renders the page as so:
      <script src="./app-context/xmlhttp/1332234398300/icefaces-d2d.js" type="text/javascript"></script>

      The reason being, we have two sites hosted and redirected by the front end apache servers:

      https://www.web.com/app1/app-context/MainPage.iface
      and
      https://www.web.com/app-context/MainPage.iface

      What is happening is that when the absolute path being put in the render response, we get redirected to the second instance of the app-context. When in fact I want to go to the first instance.
      1. data.xml
        0.5 kB
        Mircea Toma

        Activity

        Hide
        Mircea Toma added a comment -

        Modified D2DViewHandler.getResourceURL and D2DViewHandler.getActionURL methods to use a different context path when calculating the absolute URLs. The different context path can be defined using the "com.icesoft.faces.publicContextPath" context parameter.

        Show
        Mircea Toma added a comment - Modified D2DViewHandler.getResourceURL and D2DViewHandler.getActionURL methods to use a different context path when calculating the absolute URLs. The different context path can be defined using the "com.icesoft.faces.publicContextPath" context parameter.
        Hide
        Mircea Toma added a comment -

        In order to test this issue a reverse proxy is needed so that the browser will access the application using a different context path than the one naturally assigned by the app server (the WAR or directory name of the application).

        I used http://j2ep.sourceforge.net/ reverse proxy which can be deployed as WAR application along with the tested application.
        Once the j2ep-1.0 app is deployed its configuration will need to be changed so that the reverse proxying is done locally. See the attached data.xml file, this will need to be replaced and j2ep-1.0 app restarted to take this new configuration into effect.

        Then Tomcat will need to be configured to define the root path "/" for the JSESSIONID cookies so that when local application is accessed the cookie is set on the browser (which sees the application under a different context path) . To do that just add sessionCookiePath="/" attribute to the Context tag in $tomcat/conf/context.xml (... and restart Tomcat so that new configuration is effective).

        If normally we access the app with http://localhost:8080/component-showcase/ URL to access it through the proxy http://localhost:8080/j2ep-1.0/bla/component-showcase/ URL should be used.

        Show
        Mircea Toma added a comment - In order to test this issue a reverse proxy is needed so that the browser will access the application using a different context path than the one naturally assigned by the app server (the WAR or directory name of the application). I used http://j2ep.sourceforge.net/ reverse proxy which can be deployed as WAR application along with the tested application. Once the j2ep-1.0 app is deployed its configuration will need to be changed so that the reverse proxying is done locally. See the attached data.xml file, this will need to be replaced and j2ep-1.0 app restarted to take this new configuration into effect. Then Tomcat will need to be configured to define the root path "/" for the JSESSIONID cookies so that when local application is accessed the cookie is set on the browser (which sees the application under a different context path) . To do that just add sessionCookiePath="/" attribute to the Context tag in $tomcat/conf/context.xml (... and restart Tomcat so that new configuration is effective). If normally we access the app with http://localhost:8080/component-showcase/ URL to access it through the proxy http://localhost:8080/j2ep-1.0/bla/component-showcase/ URL should be used.
        Hide
        Mircea Toma added a comment -

        Just for reference ... this issue seems to be quite old, see ICE-1558.

        Show
        Mircea Toma added a comment - Just for reference ... this issue seems to be quite old, see ICE-1558 .
        Hide
        Mircea Toma added a comment - - edited

        Carmen, you can try to change the server.xml file in Tomcat to force it to used the root path for all the cookies. This is another configuration approach for Tomcat:

        If emptySessionPath attribute on the HTTP connector in server.xml is set to true, all paths for session cookies will be set to /. This can be useful for portlet specification implementations. If not specified, this attribute is set to false.

        <Connector port="8080" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443" emptySessionPath="true"/>

        Show
        Mircea Toma added a comment - - edited Carmen, you can try to change the server.xml file in Tomcat to force it to used the root path for all the cookies. This is another configuration approach for Tomcat: If emptySessionPath attribute on the HTTP connector in server.xml is set to true, all paths for session cookies will be set to /. This can be useful for portlet specification implementations. If not specified, this attribute is set to false. <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" emptySessionPath="true"/>
        Hide
        Carmen Cristurean added a comment -

        Verified with ICEfaces 1.8.GA-P06 Build 1 (w/ auctionMonitor and component-showcase applications), in IE8, FF19, Chrome24.
        This worked only after adding the emptySessionPath attribute to the Connector in $tomcat/config/server.xml.

        Show
        Carmen Cristurean added a comment - Verified with ICEfaces 1.8.GA-P06 Build 1 (w/ auctionMonitor and component-showcase applications), in IE8, FF19, Chrome24. This worked only after adding the emptySessionPath attribute to the Connector in $tomcat/config/server.xml.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: