Oracle recommends using a sample JnlpDownloadServletto run JNLP from a web application.
For some reason, I can’t use it and I have to encode my JNLP launch myself.
This is what I came up with (Servlet that runs it):
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
performTask(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
performTask(request, response);
}
private void performTask(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("application/x-java-jnlp-file");
byte [] b = getJNLP(..some params..).getBytes();
response.setContentLength((int) b.length);
OutputStream responseOutputStream = response.getOutputStream();
responseOutputStream.write(b);
}
getJNLPis a method that returns the entire JNLP file as String.
It seems to be working fine. But I don’t miss anything. Are there any additional headers, etc.?
UPDATE: , JnlpDownloadServlet, , JNLP webapps - Java-1 DOTNET. , , JnlpDownloadServlet DOTNET webapp. ( ) DOTNET, JNLP. Java.