commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig McClanahan (JIRA)" <>
Subject [jira] Updated: (DIGESTER-110) Create APIs that accept URL values directly, instead of only Strings to be converted to URLs
Date Fri, 24 Nov 2006 22:43:03 GMT
     [ ]

Craig McClanahan updated DIGESTER-110:

    Attachment: diffs.txt

Here is my proposed changes to Digester (a new unit test case will be submitted separately).
 The primary changes are:

* New public method register(String publicId, URL entityURL)
  that accepts a URL instead of String for the second parameter.

* New public method parse(URL url) that accepts a URL
  to be parsed.

* New public method createInputSourceFromURL(URL url)
  that accepts a URL instead of a String.

* Change existing createInputSourceFromURL(String) to a non static

* Implementations of createInputSourceFromURL() now cache a
  list of InputSource instances that are created on this instance.
  The input streams of these should be closed at the end of

* New protected method cleanup(), whose default implementation
  closes the InputStream for any InputSource that was created by

* All parse() methods are modified to call cleanup() after parsing.

> Create APIs that accept URL values directly, instead of only Strings to be converted
to URLs
> --------------------------------------------------------------------------------------------
>                 Key: DIGESTER-110
>                 URL:
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 1.6 Final
>            Reporter: Craig McClanahan
>         Attachments: diffs.txt
> 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( url)
> * public void register(java.lang.String publicId, entityURL)
> plus any other scenarios where strings are used as URLs.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message