javawebstart問題怎么解決

這篇文章主要介紹“java webstart問題怎么解決”,在日常操作中,相信很多人在java webstart問題怎么解決問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”java webstart問題怎么解決”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!

創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),廣漢企業(yè)網(wǎng)站建設(shè),廣漢品牌網(wǎng)站建設(shè),網(wǎng)站定制,廣漢網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,廣漢網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

當(dāng)時(shí)碰到的幾個(gè)技術(shù)問題是:

1.從web傳遞相關(guān)的參數(shù)給application,

解決辦法:用動(dòng)態(tài)jnlp文件(jsp實(shí)現(xiàn)jnlp),同時(shí)用到如下傳參辦法 

application-desc Element

The application element indicates that the JNLP file is launching an application (as opposed to an applet). The application element has an optional attribute, main-class, which can be used to specify the name of the application's main class, i.e., the class that contains the public static void main(String argv[]) method where execution must begin.

The main-class attribute can be omitted if the first JAR file specified in the JNLP file contains a manifest file containing the main class.

Arguments can be specified to the application by including one or more nested argument elements. For example:

<application-desc main-class="Main">
<argument>arg1argument>
<argument>arg2argument>
application-desc>

2.如何將application處理的結(jié)果傳回給web server

解決辦法,用URLConnection結(jié)合從jnlp中傳來的web url (為一個(gè)后臺(tái)處理的servlet地址),sessionID(用于識(shí)別當(dāng)前用戶,權(quán)限等判斷)去創(chuàng)建一個(gè)新的url對(duì)象,并通過它在application和web server之間傳遞數(shù)據(jù)。在后臺(tái)的servlet中通過sessionid,從session listener中找到當(dāng)前用戶,

private String getStringPostRequest(String command) throws Exception {
DataOutputStream dos=null;
ObjectInputStream dis=null;
try {
URLConnection urlConn = new URL(webServerStr).openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
urlConn.setAllowUserInteraction(false);
urlConn.setUseCaches(false);
urlConn.setRequestProperty(
"Content-Type",
"application/x-www-form-urlencoded");

dos = new DataOutputStream(urlConn.getOutputStream());
dos.writeBytes(command + "&sessionId=" + this.sessionId);
dos.close();
// read input from servlet
dis =
new ObjectInputStream(urlConn.getInputStream());
String ret = dis.readObject().toString();
dis.close();
return ret;
} catch (Exception e) {
throw e;
} finally{
if ( dos!=null) dos.close();
if ( dis!=null) dis.close();
}
}

后臺(tái)sevlet:

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
HttpSession hSession = request.getSession();
System.out.println("Application:" + hSession.getId());
if(MyListener.getSessionById(request.getParameter("sessionId")) != null)
hSession = MyListener.getSessionById(request.getParameter("sessionId"));
System.out.println("OK" + hSession);

..............}

sessionlistener:

import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.*;

public class SessionsListener
implements ServletContextListener, HttpSessionListener
{

static Map map = new HashMap();

public SessionsListener()
{
}

public void contextInitialized(ServletContextEvent servletcontextevent)
{
}

public void contextDestroyed(ServletContextEvent servletcontextevent)
{
}

public void sessionCreated(HttpSessionEvent httpsessionevent)
{
HttpSession httpsession = httpsessionevent.getSession();
map.put(httpsession.getId(), httpsession);
}

public void sessionDestroyed(HttpSessionEvent httpsessionevent)
{
HttpSession httpsession = httpsessionevent.getSession();
map.remove(httpsession.getId());
}

public static HttpSession getSessionById(String s)
{
return (HttpSession)map.get(s);
}

}

3.jar包數(shù)字簽名問題

4.java webstart cache問題即:JNLP file caching

http://forum.java.sun.com/thread.jspa?forumID=38&threadID=556847

(1)

If you remove the href= parameter from the jnlp tag, Java Web Start 1.4.2 will not cache the jnlp file.
1.5.0 still will, but if you also remove the

(2)

It seems the issue is with generated JNLP files.

Try the following:

response.addDateHeader("Date", Calendar.getInstance().getTime().getTime());
response.addDateHeader("Last-Modified", Calendar.getInstance().getTime().getTime());

Seems to have solved the problem for us.

到此,關(guān)于“java webstart問題怎么解決”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

文章名稱:javawebstart問題怎么解決
標(biāo)題網(wǎng)址:http://bm7419.com/article32/iiojsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈品牌網(wǎng)站制作、網(wǎng)站營(yíng)銷、域名注冊(cè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)