With that being said, there is a way to get to it but it makes your
application have a hard dependency on the Servlet adapter provided by
Restlet.
final Context context = ...;
final ServletContextAdapter servletContextAdapter =
(ServletContextAdapter) context;
final ServletContext servletContext =
servletContextAdapter.getServletContext();
final String realPath = servletContext.getRealPath("realPath");
But, I agree with Rob, this makes the application less flexible with
your deployment options.
Mitch
________________________________
From: Rob Heittman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 13, 2008 8:12 AM
To: [email protected]
Subject: Re: How to get request running "realpath" just like
what does in servlet api?
I don't think there can be a Restlet equivalent, since there is
no single filesystem root corresponding to a Servlet WAR's "deployment
directory." In the Servlet world the use of getRealPath() is frequently
bad practice anyway, because many containers don't have to extract WARs.
On 2/13/08, cleverpig <[EMAIL PROTECTED]> wrote:
How to get request running "realpath" just like what
does in servlet api?
In Servlet api,there is a
method:request.getRealPath().it can return
request's realpath.
How to do that in restlet in order to access LocalFile?