Title: Message
There is no "real" path access from a war so the null return value is unfortunately correct: bin-there-dun-that. URL's will work but you will have to convert your file to an URL based on the session context:
 
    toURL(String file)
    {
         int port = context.getRequest().getServerPort();
         String host = context.getRequest().getServerName();
        String root = ((HttpServletRequest)context.getRequest()).getContextPath();
         return "http://" + host + ":" + port + root + "/" + file;
    }
----- Original Message -----
Sent: Thursday, January 23, 2003 10:32 PM
Subject: [JBoss-user] Access files in a war archive

Can anyone show me how access a xml file in .war archive through a relative path?
 
I try using the following codes but in vain.

servlet.getServletContext().getRealPath(pathname) which return null;

servlet.getServletContext().getResourceAsStream(pathname) also

Thanks

regards,

Stephen

Reply via email to