Commons Digester
  1. Commons Digester
  2. DIGESTER-110

Create APIs that accept URL values directly, instead of only Strings to be converted to URLs

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.8
    • Labels:
      None

      Description

      Currently, Digester provides a number of convenience methods such as parse() that access the XML content to be parsed in a variety of ways. The most commonly used ones are probably those that take the String form of a URL.

      In a web application environment, it is common for applications or frameworks to call ServletContext.getResource() to acquire the URL of a web application resource to be parsed. With the current Digester implementation, this must be converted to a String (using toString() or toExternalForm()), and then – internal to Digester – converted back to a URL. For this to work successfully, there must be a lossless conversion of the URL returned by ServletContext.getResource(), to a String, and then back to a URL. While this process succeeds on most popular servlet containers today, it is not guaranteed to work ... it is entirely reasonable for a servlet container to embed customized information in the URL implementation that is returned by ServletContext.getResource(), and this information would be lost in the conversions described above.

      To be safe, Digester should provide alternative public APIs that accept URLs directly, in addition to the current APIs maintained for backwards compatibility. At a minimum, that would mean adding the following public method signatures to Digester itself:

      • public Object parse(java.net.URL url)
      • public void register(java.lang.String publicId, java.net.URL entityURL)

      plus any other scenarios where strings are used as URLs.

      1. URLTestCase.java
        4 kB
        Craig McClanahan
      2. diffs.txt
        10 kB
        Craig McClanahan

        Issue Links

          Activity

          Craig McClanahan created issue -
          Craig McClanahan made changes -
          Field Original Value New Value
          Link This issue blocks VALIDATOR-209 [ VALIDATOR-209 ]
          Craig McClanahan made changes -
          Attachment diffs.txt [ 12345643 ]
          Craig McClanahan made changes -
          Attachment URLTestCase.java [ 12345644 ]
          Craig McClanahan made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.8 Final [ 12312178 ]
          Henri Yandell made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Craig McClanahan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development