ServletContext.getRealPath(String) is generally not portable and not
reliable method of accessing the contents of the web application. For
example when running from a non-expanded war this method returns null
for all paths. On the other hand, ServletContext.getResource(String)
should work irregardless of particular application server and deployment
method.
cheers,
Rafał
On 07/08/2011 09:24 AM, Klaus Reimer wrote:
On 07/07/2011 07:17 PM, Fred Bricon wrote:
Please give this dev build a try so we can definitely release 0.13.1
ASAP and reinstate m2e-wtp in the m2e marketplace.
I have a serious problem with it. An existing web application of mine
uses code like this to access some files in the WEB-INF directory (WAR
is always deployed exploded):
File webInfDir = servlet.getServletContext().getRealPath("WEB-INF");
With the old m2e-wtp getRealpath returned the web root directory from
the eclipse project where the real files are located. But now it returns
the target/m2e-wtp/web-resources directory which is always empty. So my
web project can't access the files in the web root.
Is there a known workaround? If not then I have to add some java code to
the web project so it detects the m2e-wtp deployment and auto-corrects
the path.
_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users