开发者

Blackberry OTA downloader using Servlets

开发者 https://www.devze.com 2023-01-22 19:51 出处:网络
I want to setup a Blackberry OTA downloader using Servlets. How do I set the URL for .jad and .cod files? I have set the conten开发者_如何学Got type for both files. How do I send both files to the cli

I want to setup a Blackberry OTA downloader using Servlets. How do I set the URL for .jad and .cod files? I have set the conten开发者_如何学Got type for both files. How do I send both files to the client when I receive a request from the client? Do I need to create two servlets or is one enough?


You don't necessarily need a servlet for this. A servlet is only useful if those files are dynamically generated or are not directly public accessible (i.e. those files are not in public webcontent).

The simplest way would be to put those files in the public webcontent (there where you would usually place the JSP/HTML files) and configure the appropriate mime mapping in your servletcontainer's or webapp's web.xml file.

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

Then the servletcontainer will automatically set the correct content type when the client requests the files directly by e.g. http://example.com/file.jad and http://example.com/file.cod.

0

精彩评论

暂无评论...
验证码 换一张
取 消