使用GAE servlet为JavaWS提供动态JNLP和jar [英] Use GAE servlet to serve dynamic JNLP and jar for JavaWS

查看:130
本文介绍了使用GAE servlet为JavaWS提供动态JNLP和jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试动态分配jar / jnlp时,我遇到了几个问题。我的所有文件都是使用 http://www.mywebsite.com/ServeFile?name=xxx 用于文件xxx。我可以正确地下载文件。



当我在浏览器中下载jnlp的链接并下载时,javaws发现一个错误,显示jar文件未找到。 GAE日志文件显示javaws试图加载 /ServeFile.pack.gz?name=test__V1.0.jar ,所以它不是由ServeFile servlet提供的,而是它是由/(这是另一个servlet)提供的服务。

这是我的jnlp文件的部分内容:

 <资源> 
< j2se version =1.6 +/>
< jar href =ServeFile?name = test.jarmain =trueversion =1.0/>
< property name =jnlp.packEnabledvalue =true/>
< property name =jnlp.versionEnabledvalue =true/>
< /资源>

我的问题是,javaws如何将.pack.gz放入网址的中间,而不是只需在请求中添加AcceptEncoding?动态提供jnlp和jar的正确方法是什么?

更新



使用static 如 http://website.com/path/file.jar 键入链接,而不使用?file = file.jar 。我仍然有一个问题:

新问题



JavaWS有时会把?version-id = 1.0 和我的动态url也使用类似的模式,如?folder = root& user = guest 。所以version-id会变成 1.0?folder = root



如果我将& folder = root& user = guest 放入其中,但javaws有时会请求 myjar __ V1.0.jar&安培; folder = root 所以现在文件名有 myjar _ V1.0& folder = root 这是错误的。这不一致。

暂时我可以解析这个版本号,看它是否包含问号。我希望有更好的解决方案。

解决方案

在GAE上,请考虑将文件放在Blobstore中并使用Blobstore服务他们了。



Blobstore可以提供任何二进制文件

https://developers.google.com/appengine/docs/java/blobstore/overview


I encourtered several problems when I try to distribute jar/jnlp dynamically. All my files are dynamically served using http://www.mywebsite.com/ServeFile?name=xxx for file xxx. I can download files correctly.

When I put the link to jnlp in the browser and download, there is an error from javaws showing that the jar file was not found. The GAE log file shows that the javaws tried to load /ServeFile.pack.gz?name=test__V1.0.jar so it wasn't served by the ServeFile servlet, instead it was served by / (which is another servlet)

Here is my jnlp file partial content:

<resources>
    <j2se version="1.6+"/>
    <jar href="ServeFile?name=test.jar" main="true" version="1.0"/>
    <property name="jnlp.packEnabled" value="true"/>
    <property name="jnlp.versionEnabled" value="true"/>
</resources>

My question is how does the javaws put .pack.gz into the middle of the url, instead of just putting a AcceptEncoding in the request? What is the right way to serve jnlp and jar dynamically?

Update

Problem solved when using a "static" type link such as http://website.com/path/file.jar without using ?file=file.jar. I still have a problem:

New Problem

JavaWS will sometimes put ?version-id=1.0 and my dynamic url is also using similar pattern like ?folder=root&user= guest. So version-id would become 1.0?folder=root.

If I put &folder=root&user=guest it would work, but javaws sometimes request myjar__V1.0.jar& folder=root so now the file name has myjar_ V1.0& folder=root which is wrong. It's not consistent.

Temporarily, I can just parse this version-id to see whether it contains a question mark. I hope there is a better solution.

解决方案

On GAE, consider putting the files in the blobstore and using the blobstore service to serve them up.

The Blobstore can serve any binary file

https://developers.google.com/appengine/docs/java/blobstore/overview

这篇关于使用GAE servlet为JavaWS提供动态JNLP和jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆