ICEfaces
  1. ICEfaces
  2. ICE-1579

Seam: apps break when deployed in the context root

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.6DR#4
    • Fix Version/s: None
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      JBoss 4.0.5
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      create a 'serverBasePath' factory:

      <!--
           Factory to resolve the http request base path as in http(s)://<host-name>:<server-port>/<context-path>/
           Usage: <base href="#{serverBasePath}"/> to be placed in the html 'head' of each template page.
           -->
           <factory
            name="serverBasePath"
            auto-create="true"
            value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/"/>
       
      Then use it in a page or template like so:

       <head>
           <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
           <title>Title here</title>
        [b]<base href="#{serverBasePath}"/>[/b]
           <link rel='stylesheet' type='text/css' href='./xmlhttp/css/xp/xp.css'/>
           <link href="stylesheet/theme.css" rel="stylesheet" type="text/css" />
       </head>
      Show
      create a 'serverBasePath' factory: <!--      Factory to resolve the http request base path as in http(s)://<host-name>:<server-port>/<context-path>/      Usage: <base href="#{serverBasePath}"/> to be placed in the html 'head' of each template page.      -->      <factory       name="serverBasePath"       auto-create="true"       value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/"/>   Then use it in a page or template like so:  <head>      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />      <title>Title here</title>   [b]<base href="#{serverBasePath}"/>[/b]      <link rel='stylesheet' type='text/css' href='./xmlhttp/css/xp/xp.css'/>      <link href="stylesheet/theme.css" rel="stylesheet" type="text/css" />  </head>

      Description

      application resources don't resolve properly and posts hang when running a Seam app in the context root:

      <module>
           <web>
               <web-uri>Ice-seam-gen.war</web-uri>
               <context-root>/Ice-seam-gen</context-root>
           </web>
       </module>

        Activity

        Hide
        Andrew Murphy added a comment -

        There are actually two issues here:

        1. Relative path resolution of server resources (images/css/etc); and,
        2. Configuration of a root context (as in '/') within application.xml breaks form processing.

        Issue 1 should not be described as a problem as it simply requires the configuration of a Seam factory in components.xml (as
        described in workaround above). This factory includes the server context within the base href so any change in the context-root
        within application.xml automatically resolves the relative paths.

        Issue 2 is a problem and is what should be covered by this JIRA. Form processing breaks, or more specifically hangs and then
        times out with no errors or exception stacktraces, when the context root for the application is set to '/' (i.e. ROOT). All non-root
        declarations work e.g. /Ice-seam-gen, /MyApp, etc.

        I trust this clarifies things.

        Show
        Andrew Murphy added a comment - There are actually two issues here: 1. Relative path resolution of server resources (images/css/etc); and, 2. Configuration of a root context (as in '/') within application.xml breaks form processing. Issue 1 should not be described as a problem as it simply requires the configuration of a Seam factory in components.xml (as described in workaround above). This factory includes the server context within the base href so any change in the context-root within application.xml automatically resolves the relative paths. Issue 2 is a problem and is what should be covered by this JIRA. Form processing breaks, or more specifically hangs and then times out with no errors or exception stacktraces, when the context root for the application is set to '/' (i.e. ROOT). All non-root declarations work e.g. /Ice-seam-gen, /MyApp, etc. I trust this clarifies things.
        Hide
        Kyle Burke added a comment -

        I don't necessarily agree with your dismissal of issue 1. In the end, using the Seam factory and <base> tag is still just a workaround, because you can't use the following:

        <img src="/images/myimage.gif"/>
        or
        <script src="/js/my.js"></script>

        i.e. prefixed with a slash. Of course <ice:graphicImage/> resolves using this syntax.

        Show
        Kyle Burke added a comment - I don't necessarily agree with your dismissal of issue 1. In the end, using the Seam factory and <base> tag is still just a workaround, because you can't use the following: <img src="/images/myimage.gif"/> or <script src="/js/my.js"></script> i.e. prefixed with a slash. Of course <ice:graphicImage/> resolves using this syntax.
        Hide
        Ken Fyten added a comment -

        Marking as Closed / Invalid as part of legacy ICEfaces 1.x, 2.x JIRA cleanup.

        Note: This issue may be resolved in a newer ICEfaces release, available here: http://www.icesoft.org/java/downloads/icefaces-downloads.jsf

        If the issue persists with the current ICEfaces release, please create a new JIRA for it.

        Show
        Ken Fyten added a comment - Marking as Closed / Invalid as part of legacy ICEfaces 1.x, 2.x JIRA cleanup. Note: This issue may be resolved in a newer ICEfaces release, available here: http://www.icesoft.org/java/downloads/icefaces-downloads.jsf If the issue persists with the current ICEfaces release, please create a new JIRA for it.

          People

          • Assignee:
            Unassigned
            Reporter:
            Philip Breau
          • Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: