I have a JSP (A) whose sole purpose is to return an image.
My main JSP (M) can't have direct access to this image path but needs to know if it exists (if not, JSP (A) will return a 404 code).
Here is (mostly) JSP (A) :
File img = new File(<complicated stuff to calculate the path>);
try
{
BufferedImage bi = ImageIO.read(img);
out.clear();
response.setContentType("image/jpeg");
ImageIO.write(bi, "jpg", response.getOutputStream());
}
catch(IIOException e)
{
response.sendError(404);
}
I have tried the following in JSP (M) :
RequestDispatcher rd = request.getRequestDispatcher("../JSP_A");
rd.include(request, response);
System.out.println("### " + response.getStatus());
I get an error:
error: cannot find symbol
symbol: method getStatus()
location: variable response of type HttpServletResponse
I don't understand because getStatus() is of course a method of HttpServletResponse.