Blackberry OTA downloader using Servlets

三世轮回 提交于 2019-12-23 03:44:09

问题


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 content 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?


回答1:


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.



来源:https://stackoverflow.com/questions/4074827/blackberry-ota-downloader-using-servlets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!