• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in getting the realpath of the application

 
Selva Duraisamy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
I have created the context of my own application outside the Default root of Web logic like,
C:\bea\wlserver6.0\config\mydomain\applications\Myapplication
instead of putting that application in the default root like
C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver\Myapplication.
Now i am getting a problem in getting the path of the request.I want the real path to read some other file in the same folder.
I have tried to get the real path by using
request.getRealPath(request.getRequestURI()).
But it is returning null.
Is there any other way to get the real path ?.

 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You, as the developer of the application, know where it has been placed.

While I normally wouldn't suggest hard-coding a value that could change, that would be one way.

If you want it to be a bit more dynamic you can place it in web.xml as a context parameter, and then just retrieve it in servlet's init. This is the kind of thing I do for file paths.
 
Selva Duraisamy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanx for ur reply.
We are already having a property file.So we can put the path in that itself instead of putting it in the web.xml.
Is there any other way (dynamic) to get the path?.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!