Uploaded image for project: '[Read Only] - Hippo Essentials'
  1. [Read Only] - Hippo Essentials
  2. ESSENTIALS-1226

URL Rewriter example for XML Rule contains a bug and better should be inlined in the document content

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • 13.0.0
    • 13.0.0
    • Plugins
    • None

    Description

      The XML Rule example given is the following:

      <rule>
        <note>
          This rule means that requests to /test/status will be redirected to /rewrite-status.
        </note>
        <from>/test/status</from>
        <to type="redirect">/%{context-path}/rewrite-status</to>
      </rule>

      The bug is the leading / before the %

      {context-path}

      : that should not be as it will produce // (double slash) as result (context-path, if not empty, always starts with a /).

      So the example rule should be:

      <rule>
        <note>
          This rule means that requests to /test/status will be redirected to /rewrite-status.
        </note>
        <from>/test/status</from>
        <to type="redirect">%\{context-path}/rewrite-status</to>
      </rule>

      Another problem is that the example is provided as a separate file resource in the document content yaml definition (sample-rewriter-rules.yaml):

            urlrewriter:rule:
              type: string
              resource: sample-rule.xml

      While that is fine for initial bootstrapping, it is less convenient (problematic really) when it is changed, because auto-export currently cannot export it back to a (or even the) file resource! While that is possible (and done) for certain/known String properties for hcm-config definitions, but not for hcm-content definitions!

      The result is that after editing the XML Rule, it gets inlined in the content document anyway, like this:

       

      urlrewriter:rule: |-
      <rule>
      <note>
      This rule means that requests to /test/status will be redirected to /rewrite-status.
      </note>
      <from>/test/status</from>
      <to type="redirect">%{context-path}

      /rewrite-status</to>
      </rule>

       

      Therefore I think it is better to change the URL Rewriter example using the inlined rule content, like above.

      Arggggh: nevermind the above crappy/broken inline content example: Jira seems to not being able to retain the proper rendering, I've tried to fixed it several time. Not working!

      Attachments

        Activity

          People

            Unassigned Unassigned
            adouma Ate Douma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: