简体   繁体   English

webapplication配置不会将.jad文件视为.jad文件

[英]webapplication configuration do not treats .jad file as .jad file

I am working on a webapplication + j2me application. 我正在开发一个webapplication + j2me应用程序。 .jad/.jar file are already created now i want to download it from my live url(my deployed application) in a nokia-phone. .jad / .jar文件现在已经创建了我想从诺基亚手机中的我的实时网址(我已部署的应用程序)下载它。 But accessing the .jad file gives me "File format unknown" ERROR !!! 但访问.jad文件给我“文件格式未知”错误! .

surprise is that if i download jar file directly it works fine. 令人惊讶的是,如果我直接下载jar文件,它工作正常。 but i need to download .jad file not the .jar file. 但我需要下载.jad文件而不是.jar文件。

my .jad file works totally fine in simulator. 我的.jad文件在模拟器中工作得很好。 one more surprise is that if i deploy another webapplication and the same jad file i am able to download it successfully from the same mobile. 另一个惊喜是,如果我部署另一个webapplication和相同的jad文件,我可以从同一个移动设备成功下载它。

I think the problem is the configuration of my webapplication. 我认为问题是我的webapplication的配置。 I have created a text file in mywebapplication and tried to access it from phone it given me the same ERROR !! 我在mywebapplication中创建了一个文本文件并尝试从手机访问它,它给了我相同的错误! that means configuration treats my .jad file as text file. 这意味着配置将我的.jad文件视为文本文件。

can anyone say what could be the problem if you need to see web.xml file i will show the code. 任何人都可以说如果你需要看web.xml文件我会显示代码可能是什么问题。

.jad and .jar file works very fine as i have tried it by deploying this in another application and downloaded it properly. .jad和.jar文件工作得很好,因为我已经通过在另一个应用程序中部署它并正确下载它来尝试它。 I think some filters and listeners or servlete causes problem. 我认为一些过滤器和监听器或servlete会导致问题。

You need your server to set the MIME-type for these files as 您需要服务器将这些文件的MIME类型设置为

JAD: text/vnd.sun.j2me.app-descriptor
JAR: application/java-archive

If you are running java based web server then you could set it in web.xml 如果您运行的是基于Java的Web服务器,则可以在web.xml设置

<mime-mapping>
 <extension>jad</extension>
 <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
</mime-mapping>

<!--JAR file -->
<mime-mapping>
 <extension>jar</extension>
 <mime-type>application/java-archive</mime-type>
</mime-mapping>

or configure proper filter to do the same 或配置适当的过滤器来做同样的事情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM