Could it be:

String somefile = contextPath + File.separator + "abc.zip";

or about the same:

String somefile = contextPath +"/abc.zip";


Henry Chen wrote:

Hi,



I want to write to a file. I use the following method:



String contextPath =
cycle.getRequestContext().getRequest().getContextPath();

ServletContext context =
cycle.getRequestContext().getServlet().getServletContext();

String somefile = contextPath +"abc.zip";

String outFileName = context.getResource(somfile).getFile();



This return a null value for context.getResource(somfile). I tried
getRealPath(), it worked, but it was deprecated. Anybody knows what the
problem is here? Or there are some other better ways?




Many Thanks.



Henry




--
Ivano Pagano

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to