Bonjour,
je viens de créer la servlet suivante:
avec le web.xml suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Applications extends HttpServlet { private int i=0; public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException{ System.out.println("appel"); try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("end"); } }
Ensuite je lance 2 pages en sumultanées (2 fois http://localhost:8080/Serv/App/a) et à ma grande surprise, il faut attendre que la servlet ait fini sa 1ere requete pour commencer la suivante . Est-ce normal ??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <servlet> <servlet-name>Applications</servlet-name> <servlet-class>servlets.Applications</servlet-class> </servlet> <servlet-mapping> <servlet-name>Applications</servlet-name> <url-pattern>/App/*</url-pattern> </servlet-mapping> </web-app>
Merci
Partager