I'm developing a JWS application as an applet replacement. So far I've been able to launch my app from its parent application via a link in an HTML page to static JNLP. But my app really needs to be launched by dynamic JNLP since the argument values will be different with each execution. So I decided to extend the JnlpDownloadServlet in the manner shown [here][1]. My download servlet is called download
, which is mapped to a URL pattern \download
and which references a JSP called myJnlp.jsp
, which currently contains some static JNLP, in the overriden method service
:
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
HttpServletRequest request = (HttpServletRequest) req;
resp.setContentType("application/x-java-jnlp-file");
request.getRequestDispatcher("/myJnlp.jsp").include(request, resp);
}
When I try to invoke my download servlet, I get the following error:
javax.servlet.ServletException: File "/myJnlp.jsp" not found
org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:384)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
com.myCompany.parentApp.myDownloadServlet.service
I placed myJnlp.jsp
in the directory jsp
which is the directory that contains the other JSPs used by the parent application. Did I put the JNLP page in the wrong location or did I specify it incorrectly in my servlet code?
I solved this by creating a subdirectory called myJWSApp
, then I placed the JNLP JSP in that directory then referenced it as
request.getRequestDispatcher("myJWSApp/myJnlp.jsp").include(request, resp);
Thanks to @rickz whose comment pointed me in the right direction...