users@glassfish.java.net

[gf-users] how to access images in WEB-INF?

From: thufir <hawat.thufir_at_gmail.com>
Date: Sat, 14 Feb 2015 18:53:05 -0800

How do I load an image from WEB-INF with JSP's? I'm using Glassfish and
NB.

Filter code:

String path = filterConfig.getServletContext().getContextPath();
contextPath = "http://localhost:8080" + context + path;
String duke = contextPath + "/duke.gif";

which results in the following html:

<img src="http://localhost:8080/WebApplication/duke.gif">


Which is fine, but any user gets to access that image. I want to move
the image to WEB-INF so that it's not accessible for users.


see also:

http://forums.netbeans.org/viewtopic.php?t=62749