Cocoon
  1. Cocoon
  2. COCOON-1485

Source resolving when root sitemap is not in context://

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: * Cocoon Core
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: Other

      Description

      Source resolving doesn't work correctly when the root sitemap is not in the
      servlet context root (context://).

      See also http://marc.theaimsgroup.com/?t=111142599200007&r=1&w=2

        Activity

        Hide
        Vadim Gritsenko added a comment -
        Yep. There is example of mounting sitemap residing in the XML:DB database, and
        source resolution happens against xmldb://... context URI. Here is pointer to
        the env switching code... MountNode:96.
        Show
        Vadim Gritsenko added a comment - Yep. There is example of mounting sitemap residing in the XML:DB database, and source resolution happens against xmldb://... context URI. Here is pointer to the env switching code... MountNode:96.
        Hide
        Carsten Ziegeler added a comment -
        The environment can change to any URL - for example you can mount a sitemap
        with any protocol and source resolving etc. then works relative to that URL.
        I have not looked into the code yet, but imho we could simply add code to the
        tree processor to always change the environment to the location of the sitemap;
        it's already done if the sitemap is mounted. So it should just be a copy of
        this code to the correct place :) This change is then independent of the real
        environment used (http, cli etc.).
        Show
        Carsten Ziegeler added a comment - The environment can change to any URL - for example you can mount a sitemap with any protocol and source resolving etc. then works relative to that URL. I have not looked into the code yet, but imho we could simply add code to the tree processor to always change the environment to the location of the sitemap; it's already done if the sitemap is mounted. So it should just be a copy of this code to the correct place :) This change is then independent of the real environment used (http, cli etc.).
        Hide
        Marco Rolappe added a comment -
        (In reply to comment #2)
        > Could you make a proposal about what has to be changed?

        as said in the last paragraph, before everything else I'd propose to investigate
        the environment and its context. what do they represent? what are they used for?
        what does the environment need the context for? is the context a directory or is
        it only a prefix? I think several problems are related to this one, e.g. cocoon
        executing from within a WAR, mounting with a cocoon: URI, etc.

        a quick fix (hack) would be to have CocoonServlet know (i.e. ask the root
        TreeProcessor) the location of the root sitemap and use that (in getEnvironment)
        instead of the servlet context path.
        Show
        Marco Rolappe added a comment - (In reply to comment #2) > Could you make a proposal about what has to be changed? as said in the last paragraph, before everything else I'd propose to investigate the environment and its context. what do they represent? what are they used for? what does the environment need the context for? is the context a directory or is it only a prefix? I think several problems are related to this one, e.g. cocoon executing from within a WAR, mounting with a cocoon: URI, etc. a quick fix (hack) would be to have CocoonServlet know (i.e. ask the root TreeProcessor) the location of the root sitemap and use that (in getEnvironment) instead of the servlet context path.
        Hide
        Reinhard Poetz added a comment -
        Could you make a proposal about what has to be changed?
        Show
        Reinhard Poetz added a comment - Could you make a proposal about what has to be changed?
        Hide
        Marco Rolappe added a comment -
        the source resolving is not the problem. the question is whether handing the
        TreeProcessor a different path to its sitemap.xmap implies that all relative
        references in that sitemap are relative to that sitemap.xmap's directory, i.e.
        whether it changes the 'context'. a proper definition of the latter would
        propbably help.

        the current situation is (tested 2.1.7):
        - you can direct (the root) TreeProcessor to use a sitemap.xmap which is not in
        the root context directory. this is merely a TreeProcessor configuration thing
        and its only side effect is to read the sitemap from a different location. no
        influence on other processing like source resolving, etc.
        - CocoonServlet (.getEnvironment()) sets the root context of the request
        currently being processed to the path/URL of the servlet context, not to the
        path of the root sitemap. and this is the reason why all relative references in
        the root sitemap are relative to the path/URL of the servlet context.

        the core processing (and the 'context' thing especially) should be
        reinvestigated and thought through since this might also have influence on
        blocks, etc.
        Show
        Marco Rolappe added a comment - the source resolving is not the problem. the question is whether handing the TreeProcessor a different path to its sitemap.xmap implies that all relative references in that sitemap are relative to that sitemap.xmap's directory, i.e. whether it changes the 'context'. a proper definition of the latter would propbably help. the current situation is (tested 2.1.7): - you can direct (the root) TreeProcessor to use a sitemap.xmap which is not in the root context directory. this is merely a TreeProcessor configuration thing and its only side effect is to read the sitemap from a different location. no influence on other processing like source resolving, etc. - CocoonServlet (.getEnvironment()) sets the root context of the request currently being processed to the path/URL of the servlet context, not to the path of the root sitemap. and this is the reason why all relative references in the root sitemap are relative to the path/URL of the servlet context. the core processing (and the 'context' thing especially) should be reinvestigated and thought through since this might also have influence on blocks, etc.

          People

          • Assignee:
            Unassigned
            Reporter:
            Reinhard Poetz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development