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

Reply via email to