In my bean I am getting the URL of an image like this:
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
URL url = ec.getResource("/myImageDirectory/image.png");
How can I do this in a HttpServlet?
I tried the following, but it did not work:
ServletContext sc = getServletContext();
URL url = sc.getResource("/myImageDirectory/image.png");
The HttpServlet is in the same application as the bean.