java webstart问题怎么解决


这篇文章主要介绍“java webstart问题怎么解决”,在日常操作中,相信很多人在java webstart问题怎么解决问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”java webstart问题怎么解决”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!当时碰到的几个技术问题是:1.从web传递相关的参数给application,  解决办法:用动态jnlp文件(jsp实现jnlp),同时用到如下传参办法   Theapplicationelement 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 thepublic static void main(String argv[])method where execution must begin.Themain-classattribute can be omitted if the first JAR file specified in the JNLP file contains a manifest file containing themainclass.Arguments can be specified to the application by including one or more nestedargumentelements. For example:application-desc main-class="Main">
argument>arg1argument>
argument>arg2argument>
application-desc>2.如何将application处理的结果传回给web server解决办法,用URLConnection结合从jnlp中传来的web url (为一个后台处理的servlet地址),sessionID(用于识别当前用户,权限等判断)去创建一个新的url对象,并通过它在application和web server之间传递数据。在后台的servlet中通过sessionid,从session listener中找到当前用户,  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();
}
}后台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包数字签名问题4.java webstart cache问题即:JNLP file cachinghttp://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.到此,关于“java webstart问题怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注开发云网站,小编会继续努力为大家带来更多实用的文章!

相关推荐: js中的除法运算符怎么使用

这篇“js中的除法运算符怎么使用”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“js中的除法运算符怎么使用”文章吧。1、js中的除法运算符除法运算…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

Like (0)
Donate 微信扫一扫 微信扫一扫
Previous 07/03 21:20
Next 07/03 21:20

相关推荐