karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asookazian2 <asookaz...@gmail.com>
Subject unable to getRealPath for servlet context
Date Thu, 06 Mar 2014 00:12:27 GMT
I found the following Jetty bug report: 

User states the following:

"ServletContext.getRealPath("") returns null instead of returning the root
dir of the webapp"

I am able to reproduce this behavior in my WAR bundle with MANIFEST.MF (WAB
(WebApplication Bundle)) deployment to Karaf 3.0.0.  The version of Jetty is
the following:

karaf@root()> feature:list | grep jetty
cxf-http-jetty                | 3.0.0-milestone2 | x         |
cxf-3.0.0-milestone2    |                                                   
jetty                         | 8.1.9.v20130131  | x         |
standard-3.0.0          |                                                   
pax-jetty                     | 8.1.14.v20131031 | x         |
org.ops4j.pax.web-3.0.5 | Provide Jetty engine support  

I have tried ServletContext.getRealPath("");

I have also tried ServletContext.getRealPath("/");

Both code lines return null.

Is this expected for this version of Karaf/Jetty?  If yes, how can I
determine the real path.

Our scenario involves a properties file that may be installed in
karaf/config/foo directory.  We don't want to load/read the file from inside
the WAR (e.g. WEB-INF) b/c the customer may need to change the file.  

View this message in context: http://karaf.922171.n3.nabble.com/unable-to-getRealPath-for-servlet-context-tp4032109.html
Sent from the Karaf - User mailing list archive at Nabble.com.

View raw message