> >I want to determine the real, absolute, path to where my servlet is
> >running within my servlet.  Is there any way to do this other
> than passing
> >initialization arguments to the servlet?  I want to create/read/modify a
> >file within the servlet's directory.
>
> String req.getRealPath ("/" ) will get you your root directory. From there
> you should be able to figure out how to specify the servlet directory.
> Note, you may not have the proper permissions to create a file in the
> servlet's directory. That depends on its permission settings.
>

I tried that.  The HttpServletRequest.getRealPath("/") returns the document root, i.e.
        /usr2/local/apache/htdocs
The SevletContext.getRealPath("/") returns null.  My servlet is located at
        /usr2/local/apache/servlets/development/MyServletDir

Any other suggestions?

Brad

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to