问题
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.
回答1:
[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.
来源:https://stackoverflow.com/questions/21058916/worklight-init-servlet