you can use servlet.
@WebServlet("/Test.pdf")
public class PdfServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
File file = new File("D:\\Test\\Test.pdf");
response.setHeader("Content-Type", getServletContext().getMimeType(file.getName()));
response.setHeader("Content-Length", String.valueOf(file.length()));
response.setHeader("Content-Disposition", "inline; filename=\"Test.pdf\"");
Files.copy(file.toPath(), response.getOutputStream());
}
}
(if Servlet 3.0 is not available, then map it in web.xml the usual way, if Java 7 is not available, then use a read/write loop the usual way)
Just copypaste this class in its entirety into your project and open the desired PDF file by /contextpath/Test.pdf instead of /contextpath/youroriginal.jsp (after having organized it in a package and autocompleted the necessary imports in the class, of course).
E.g. as follows in a JSP where you'd like to show the PDF inline:
<object data="${pageContext.request.contextPath}/Test.pdf"
type="application/pdf" width="500" height="300">
<a href="${pageContext.request.contextPath}/Test.pdf">Download file.pdf</a>