In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how Android applications are embedded in independent ijetty servlet containers. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
1. Download the source package of ijetty, which is divided into two parts: server and UI. The server part is the core package, which needs to be independently packaged and compiled into jar for use in the UI part. Even if the UI package is modified, the original interface is removed, and only the part that starts the service needs to be retained.
2. Server part compiles: i-jetty-server-3.1.jar
3. A total of externally dependent packages need to be as follows:
Among them, xmlParserAPIs-2.6.2.jar and xpp3-1.1.4.jar can cause errors for some reasons, so they can be eliminated without affecting the operation of ijetty. For brief purposes, these classes can be unzipped and repackaged together, at least for parts of jetty.
4. The web project needs to be compiled into a dex format zip package that can be parsed by android. It should be noted that the third-party lib needs to eliminate unwanted ones, especially servlet-api-2.5.jar, because one is already included in the container.
Examples of packaging commands:
Dx.bat-- dex-- output=E:\ demo\ classes.zip E:\ demo\ WEB-INF\ classes E:\ demo\ WEB-INF\ lib
5. Put the classes.zip package under lib, delete the original jar package, retain the classes under class, and then type it into a war package:
Jar cvf ppweb.war *. *
6. Just put ppweb under webapps in the jetty directory, and restart the program to access it.
7. Ijetty-based web needs to be noted that references to external context need to be in the android system and cannot be obtained in the same way as the original web project.
8. The most important thing to integrate ijetty is to use the class IJettyservice, as well as some environment constants defined in Ijetty, which can run well with default values. Notice the following code in Ijetty:
Static {_ _ JETTY_DIR = new File (Environment.getExternalStorageDirectory (), "jetty"); / / Ensure parsing is not validating-does not work with android System.setProperty ("org.eclipse.jetty.xml.XmlParser.Validating", "false") / Bridge Jetty logging to Android logging System.setProperty ("org.eclipse.jetty.util.log.class", "org.mortbay.ijetty.AndroidLog"); org.eclipse.jetty.util.log.Log.setLog (new AndroidLog ());}
Skipped the verification of the xml, otherwise it will not run.
This is how the Android application shared by Xiaobian embeds the servlet container of independent ijetty. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 265
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.