Re: Problem with ServletContext.getResource()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Problem with ServletContext.getResource()

Kent Tong
Henry Chen <henry.chen04 <at> gmail.com> writes:

Try:

ServletContext context =
  cycle.getRequestContext().getServlet().getServletContext();
String somefile = "/abc.zip";
//String outFileName = context.getResource(somfile).getFile();
String outFileName = context.getRealPath(somfile);

As you're trying to write to the file, you can't use getResource().
Instead, use getRealPath(). I don't know why you think getRealPath()
is deprecated.




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]