----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Yes, getRealPath() from HttpRequest works.

Thanks everyone

> getRealPath() off of ServletContext will always return null.  Take a look
> at JServConnection.java and JServContext.java.  This
> is one of those things in the servlet spec that (I guess) couldn't be
> reasonably implemented with the original JServ approach.
>
> getRealPath() off of HttpRequest *may* give you the path of the request,
> assuming Apache sent a value for DOCUMENT_ROOT to JServ.
>
> My understanding is that the place where this will get addressed is
> in Jakarta/Tomcat.
>
> - Fernando
>
> >
> > Nope,  still returns null.
> >
> > > Try with absolute path:
> > >
> > > getRealPath("/my_servlet")
> > >
> > > This will probably return:
> > >
> > > /path/to/tomcat/installation/webapps/your_app/my_servlet
> > >
> > >
> > > Juan Alvarez Ferrando
> > >
> > > Corey Wineman wrote:
> > > >
> > > > ----------------------------------------------------------------
> > > > BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> > > > WHEN YOU POST, include all relevant version numbers, log files,
> > > > and configuration files.  Don't make us guess your problem!!!
> > > > ----------------------------------------------------------------
> > > >
> > > > Hello,
> > > >
> > > > I'm new to Apache and JServ, but I didn't see anything that seemed
to
> > answer
> > > > this on the faq. When running servlets using other
> > webservers, the value
> > > > returned from ServletContext's getRealPath() method  was usually the
> > > > document root.
> > > >
> > > > ex:
> > > > String realPath = getServletContext().getRealPath( "my_servlet" );
> > > > realPath would contain the String: "C:\webserver\htdocs\my_servlet"
or
> > > > something similar. Then I could organize any files needed by
> > the servlet
> > > > based on this path.
> > > >
> > > > When I run the same servlets with ApacheJserv, I always get null
> > instead. I
> > > > know that the real path is actually relative to where you ran
> > Jserv. Is
> > > > there anyway to configure it so that getRealPath() will return this
> > path?
> > > > Even better, is there a way to configure things so that
getRealPath()
> > will
> > > > return a path that you specify, say the document root. I know that
you
> > can
> > > > get the document root through the org.apache.jserv.DOCUMENT_ROOT
> > variable.
> > > > Is there another way to get the value of the document root without
> > > > hard-coding any variables into my java code.
> > > >
> > > > I am not doing anything special in my configuration files
> > (that might be
> > the
> > > > problem) and used most of the defaults. I think the only significant
> > thing I
> > > > changed was to add the lines:
> > > > wrapper.env.copy=classpath
> > > > wrapper.env.copy=path
> > > > to jserv.properties so that it could see my servlet classes.
> > > >
> > > > System:
> > > > Win NT
> > > > Apache 1.3.12
> > > > JSDK2.0
> > > > JServ1.1.1
> > > > JDK122
> > > >
> > > > Thanks,
> > > > Corey
> > > >
> > > > --
> > > > --------------------------------------------------------------
> > > > Please read the FAQ! <http://java.apache.org/faq/>
> > > > To subscribe:        [EMAIL PROTECTED]
> > > > To unsubscribe:      [EMAIL PROTECTED]
> > > > Archives and Other:  <http://java.apache.org/main/mail.html>
> > > > Problems?:           [EMAIL PROTECTED]
> > >
> > >
> > > --
> > > --------------------------------------------------------------
> > > Please read the FAQ! <http://java.apache.org/faq/>
> > > To subscribe:        [EMAIL PROTECTED]
> > > To unsubscribe:      [EMAIL PROTECTED]
> > > Archives and Other:  <http://java.apache.org/main/mail.html>
> > > Problems?:           [EMAIL PROTECTED]
> > >
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > Please read the FAQ! <http://java.apache.org/faq/>
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > Archives and Other:  <http://java.apache.org/main/mail.html>
> > Problems?:           [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]
>



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to