ICEfaces
  1. ICEfaces
  2. ICE-4942

ResourceRegistry should allow registering resources without pre-pending the request context path

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      n/a

      Description

      D2DViewHandler, getResourceURL(FacesContext context, String path) checks to see if the path contains a leading '/'. If so, it blindly appends the request context path, whether or not the given path already contains the context root path. This conflicts with the behaviour of the ResourceRegistry, which returns URLs that contain the root context path, and makes it difficult to use a URL derived from the ResourceRegistry on any component that first calls getResourceURL(..) to transform a path. We should first check if the given path argument contains the context path before appending, if it does, we should simply return the path unchanged, as we do if the path does not contain a leading '/'.

      suggested fix:

      Index: C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java
      ===================================================================
      --- C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (revision 19267)
      +++ C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (working copy)
      @@ -308,9 +308,9 @@
           }
       
           public String getResourceURL(FacesContext context, String path) {
      - ExternalContext extContext = context.getExternalContext();
      - if (path.startsWith("/")) {
      - return (extContext.getRequestContextPath() + path);
      + String requestContextPath = context.getExternalContext().getRequestContextPath();
      + if (path.startsWith("/") && !path.startsWith(requestContextPath)) {
      + return (requestContextPath + path);
               } else {
                   return path;
               }

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19286 Wed Sep 23 06:06:44 MDT 2009 mircea.toma ICE-4942 Add methods for registering resources that return a path that considers the web-application context as root.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/ResourceRegistry.java

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: