2014-12-01 73 views
1

我有一個Java Web Start應用程序接收一個參數。因此,使用Apache Tomcat服務器和所有我需要做的是創建一個JSP文件,獲得請求參數,並將其發送到Java應用程序就像波紋管代碼:IIS中的JNLP參數

<%@ page contentType="application/x-java-jnlp-file" %> 
<%@ page session="true" %> 
<% 
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server 
// Getting the URL parameters from the request 
final String PARAM = "docId"; 
String paramDocId = request.getParameter(PARAM); 
%> 

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="printerwebdoc.jsp?<%=PARAM + "=" + paramDocId%>"> 

    <information> 
      <title>Web Doc Printer</title> 
      <vendor>Ambisig</vendor> 
      <description>Web Doc Printer</description> 
    </information> 

    <security> 
      <all-permissions/> 
    </security> 

    <resources> 
      <j2se version="1.6+" /> 
      <jar href="webdocprinter.jar" /> 
    </resources> 

    <application-desc main-class="main.gui.Main"> 
     <argument><%=paramDocId%></argument> 
    </application-desc> 
</jnlp> 

的問題是,現在我需要在IIS服務器上運行此應用程序,並且JSP在此情況下不起作用。

我能做些什麼來將參數傳遞給使用IIS的Java Web Start應用程序?

+1

*「..需要運行IIS服務器上該應用程序和JSP不會在這種情況下工作。」 * IIS支持ASP,不是嗎? – 2014-12-02 00:10:48

+0

我認爲它支持。我可以從ASP文件運行JNLP嗎? – DiogoPinheiro 2014-12-02 09:24:47

+1

可以從任何可以生成該文件的JNLP運行。包括JSP,PHP,ASP ..如果JNLP文件不需要隨時更改,它可以是純文本... – 2014-12-02 11:41:02

回答

1

正如@Andrew湯普森說我使用的ASP文件運行我的JNLP和下面的代碼:

<% 
dim PARAM 
PARAM = "docId" 
response.ContentType="application/x-java-jnlp-file" 
dim paramDocId 
paramDocId = request.querystring("docId") 
dim ipAddress 
ipAddress = Request.ServerVariables("server_name") 
%> 


<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://<%=ipAddress+"/Java/"%>" href="webdocprinter.asp?<%=PARAM + "=" + paramDocId%>"> 

    <information> 
      <title>Web Doc Printer</title> 
      <vendor>Ambisig</vendor> 
      <description>Web Doc Printer</description> 
    </information> 

    <security> 
      <all-permissions/> 
    </security> 

    <resources> 
      <j2se version="1.6+" /> 
      <jar href="webdocprinter.jar" /> 
    </resources> 

    <application-desc main-class="main.gui.Main"> 
     <argument><%=paramDocId%></argument> 
    </application-desc> 
</jnlp> 

有了這個解決方案,我可以在IIS服務器中運行的接收參數的Java Web Start應用程序!

謝謝

+0

很高興你把它分類。 :) – 2014-12-02 12:45:00

+0

這是一個有趣的解決方案。該網址是否可以公開發布,以便我可以在行動中查看它? – 2014-12-04 20:50:01

+0

@SaeidNourian很抱歉,該網址尚未公佈。 – DiogoPinheiro 2014-12-05 11:09:28