Title: Message
How to create a exploded WAR? FYI, i used ANT to create the war archive and there is no JAR file included except in the /WEB-INF/lib directory.
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Bill Burke
Sent: 25 January 2003 01:59
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Access files in a war archive

getRealPath works if the WAR is deployed as an exploded WAR (aka directory structure, no JAR file).
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rod Macpherson
Sent: Friday, January 24, 2003 8:44 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Access files in a war archive

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