Worklight Init Servlet [英] Worklight Init Servlet

查看:128
本文介绍了Worklight Init Servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发适用于iOS和Android的worklight混合应用程序。在服务器端实现中,我计划为所有业务逻辑重用我现有的java代码,因此我的服务器适配器只会调用我的java代码。



这工作正常,我实际上发现了一些样本,但是我现有的java代码需要在启动期间进行一些初始化,它是使用在web.xml中配置的init servlet完成的,但据我所知,worklight不会有一种简单的方法可以创建任何类型的servlet。



我知道我可以在第一次调用时总是放置一些静态块来初始化服务器,但它会产生一些明显的第一次调用的延迟,这不是很好。



如果可能,我还想创建一些onDestroy监听器来正确关闭所有池,计时器等。 / p>

提前感谢。

解决方案

[没试过,只是大声思考]
WL项目可部署是一个.war文件,可以是f在{project} \ bin中。它基本上包含所有与服务器相关的东西,包括构建的java代码。在其中有一个标准的web.xml文件,它定义了所有WL servlet等。如果你手动添加你的servlet定义,它应该可以工作。


I am working on a worklight hybrid apps for iOS and Android. In the server side implementation, I plan to reuse my existing java code for all the business logic, therefore my server adapter would just making a call to my java code.

This is working fine and I actually found some sample to do so, but however my existing java code required some initializing during the startup, it was done using an init servlet configured in web.xml, but as far as I know, worklight doesn't have a easy way to create any kind of servlets.

I understand that I could always put some static block to initialize the server during the first call, but it create some noticeable delay for the first call, which is not very preferable.

If possible, I would also like to create some onDestroy listener to properly close all pools, timer and etc.

Thank in advance.

解决方案

[didn't try it, just thinking out loud] WL project deployable is a .war file that can be found in {project}\bin. It basically contains all of your server related stuff including built java code. Inside of it you have a standard web.xml file that defines all WL servlets etc. In case you add your servlet definition there manually it should work.

这篇关于Worklight Init Servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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