Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > getRealPath()

Reply
Thread Tools

getRealPath()

 
 
Manish Hatwalne
Guest
Posts: n/a
 
      08-14-2003
The documentation of -
public java.lang.String getRealPath(java.lang.String path)
of ServletContext says -

<quote>
The real path returned will be in a form appropriate to the computer and
operating system on which the servlet container is running, including the
proper path separators. This method returns null if the servlet container
cannot translate the virtual path to a real path for any reason (such as
when the content is being made available from a .war archive).
</quote>

What would be the workaround in this case? I need to deploy my application
as a war file and I also need to get the real path of a web document.

I can store the path in the web.xml file, but want to avaoid it as long as
it is possible. Is there any other way of doing this?

TIA,
- Manish


 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      08-15-2003
Manish Hatwalne wrote:
> The documentation of -
> public java.lang.String getRealPath(java.lang.String path)
> of ServletContext says -
>
> <quote>
> The real path returned will be in a form appropriate to the computer and
> operating system on which the servlet container is running, including the
> proper path separators. This method returns null if the servlet container
> cannot translate the virtual path to a real path for any reason (such as
> when the content is being made available from a .war archive).
> </quote>
>
> What would be the workaround in this case? I need to deploy my application
> as a war file and I also need to get the real path of a web document.


You seem to have missed something... there's a reason that getRealPath
returns null in that context: If you deploy your web application as a
war file, there IS no real path for any of your web app resources,
because there's no file corresponding to any resource. They are all in
the war file. You're essentially saying "I need a house with no
windows, but I also need the ability to open a window."

So since the question you asked is inherently without meaning, what is
your real requirement?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments