tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 9356] - ServletContext.getResourcePaths does not return null value
Date Thu, 23 May 2002 15:49:43 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9356>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9356

ServletContext.getResourcePaths does not return null value

avm3@cdc.gov changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|getResource                 |ServletContext.getResourcePa
                   |                            |ths does not return null
                   |                            |value



------- Additional Comments From avm3@cdc.gov  2002-05-23 15:49 -------
According to the servlet spec (2.3 Final)

  getResourcePaths(String)
  ...
  Returns: a Set containing the directory listing, or null if there are no
  resources in the web application whose path begins with the supplied path.

However, Catalina returns an empty Set (rather than a null value) for
paths that do not exist in the WAR.  Here is my test JSP page:

<%!
  public void checkPath(String path, ServletContext context, JspWriter out)
    throws java.io.IOException {

    out.println("CHECKING PATH: " + path);
    java.util.Set resources = context.getResourcePaths(path);
    out.println("  Null return value? " + (resources==null));

    if (resources!=null) {
      out.println("  EMPTY? " + resources.isEmpty());
      java.util.Iterator iter = resources.iterator();
      while (iter.hasNext())
        out.println("  " + iter.next());
    }
    out.println();
  }
%>

<pre>
<%
  checkPath("/", application, out);
  checkPath("/WEB-INF", application, out);
  checkPath("/WEB-INF/", application, out);
  checkPath("/ShOuLd_NoT_eXiST", application, out);
  checkPath("/ShOuLd_NoT_eXiST/", application, out);
%>
</pre>

And here is part of the sample output:

CHECKING PATH: /WEB-INF/
  Null return value? false
  EMPTY? false
  /WEB-INF//web.xml

CHECKING PATH: /ShOuLd_NoT_eXiST
  Null return value? false
  EMPTY? true

CHECKING PATH: /ShOuLd_NoT_eXiST/
  Null return value? false
  EMPTY? true

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message