physical path of Webapp / Reading a file?

Discussion in 'Java' started by sven abels, Nov 11, 2003.

  1. sven abels

    sven abels Guest

    Hi!

    I've written a class that uses an xml-file to read it's configuration and it
    works
    fine in my programs.
    I can read my confiuration file by accessing
    ....readSettings("settings.xml");...

    I'd like to use my class in a Web-Application with Tomcat, too but whenever
    I
    want to read the file, I get the message, that Java/Tomcat searches for it
    in
    the tomcat-bin-directory.

    Is there a way to read the xml-file from the WEB-INF/classes-directory or
    is there a way to get the physical path of the current Web-Application in
    a JSP/Servlet???
     
    sven abels, Nov 11, 2003
    #1
    1. Advertisements

  2. sven abels

    joe zobkiw Guest

    Is there a way to read the xml-file from the WEB-INF/classes-directory or
    I just read this this morning...sounds like just what you need...

    http://developer.java.sun.com/developer/EJTechTips/2003/tt0626.html#1

    In summary: The method javax.servlet.ServletContext.getResourcePaths
    allows a Web component to query the container about the resources
    contained in the Web archive.
     
    joe zobkiw, Nov 11, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.