Community
Participate
Working Groups
Build Identifier: ServletContext.getRealPath() on a WebAppContext returns null when a non-existing directory path ends with a "/", but returns the path (where the virtual path "would have beeen") when the argument does not end with a "/"? The servlet spec isn't really clear, but only mentions returning null if the context is served from a war which isn't unpacked. The following test demonstrates the issue: @Test public void inconsistentRealPaths() throws Exception { // Given Server server = new Server(0); WebAppContext context = new WebAppContext(".", "/"); server.setHandler(context); server.start(); // When ServletContext ctx = context.getServletContext(); // Then // This passes: assertNotNull(ctx.getRealPath("/doesnotexist")); // This fails: assertNotNull(ctx.getRealPath("/doesnotexist/")); } Reproducible: Always Steps to Reproduce: See included unit test method.
fixed for 7.3.1