This discussion is archived
2 Replies Latest reply: Nov 14, 2012 2:33 AM by gimbal2 RSS

Reading XML from default location

974163 Newbie
Currently Being Moderated
let say I have an XML file from default location. and, I want my servlet to read it everytime comes alive. does a servlet have a special api to do this? Or, I just do what I normally do in a java application in reading xml files?
  • 1. Re: Reading XML from default location
    sabre150 Expert
    Currently Being Moderated
    I didn't know there was a default location!

    If the XML is only to be read by the Servlet then add the file to the Serlet jar file and access it as a jar resource.
  • 2. Re: Reading XML from default location
    gimbal2 Guru
    Currently Being Moderated
    There is no such thing as a world-spanning default location. But many technologies/products do provide specific locations where you can put stuff. For example JBoss allows you to read configuration files from the server instance's conf directory through the 'jboss.server.config.url' system property. But yeah - thats a default location for a JBoss environment. Not for Tomcat, not for Glassfish, not for Weblogic, etc.

    The manual of whatever specific product being used should give hints as to what is possible.

    Of course the jar resource is also a viable answer, if the configuration file is not environment (dev/test/uat/prod) specific.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points