最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
The Servlet life cycle can be defined as the whole process from creation to destruction. The following is the process that Servlet follows:
Called after Servlet initialization
init()method.Servlet call
service()method to process the client’s request.Called before Servlet is destroyed
destroy()method.Finally, Servlet is garbage collected by JVM’s garbage collector.
Now let’s discuss the lifecycle approach in detail. The Servlet is created when the user first invokes the URL corresponding to the Servlet, but you can also specify that the Servlet is loaded the first time the server starts. When a user invokes a Servlet, an instance of Servlet is created, and each user request generates a new thread that is handed over to the doGet or doPost method when appropriate. The `` init () `` method simply creates or loads some data that will be used for the entire life cycle of the Servlet. The init method is defined as follows: Each time the server receives a Servlet request, the server generates a new thread and invokes the service. The The following are the characteristics of this method: The GET request comes from a normal request from a URL, or from an HTML formthat does not specify a METHOD, which is created by the The POST request comes from an HTML form that specifically specifies METHOD as POST, which is created by the The In the call The following figure shows a typical Servlet lifecycle scenario. The first HTTP request to arrive at the server is delegated to the Servlet container. The Servlet container is calling the The Servlet container then processes multiple requests generated by multiplethreads, each of which executes a single instance of Servlet `` service()``method. 2.4.1.
init() method ¶ init method is designed to be called only once. It is called the first time the Servlet is created, and not again each time the user requests it. Therefore, it is used for one-time initialization, just like Applet’s init in the same way.public void init() throws ServletException { // setup code... }
2.4.2.
service() method ¶ service() method is the main way to perform actual tasks. The Servlet container (that is, Web server) calls service() method to process the request from the client (browser) and write the formatted response back to the client. service () method checks the HTTP request type (GET, POST, PUT, DELETE, etc.), and calls doGet, doPost, doPut,doDelete and other methods when appropriate.public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException{ }
service() method is called by the container, and the service method calls doGet, doPost, doPut, doDelete, and so on, when appropriate. So, you don’t have to be right. service() method, you only need to override it based on the type of request from the client doGet() or doPost() that’s it. doGet() and doPost() method is the most commonly used method in each service request. Here are the characteristics of these two methods. doGet() method ¶ doGet() methods to deal with.public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Servlet code }
doPost() method ¶ doPost() methods to deal with.public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Servlet code }
destroy() method ¶ destroy() method is called only once, at the end of the Servlet lifecycle. destroy() method allows your Servlet to close database connections, stop background threads, write Cookie lists or click counters to disk, and perform other similar cleanup activities. destroy() method, the servlet object is marked for garbage collection. The destroy method definition is as follows:public void destroy() { // Terminate Code... }
Architecture diagram ¶
`service() load Servlet before themethod.