1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.acme;
20
21 import java.io.IOException;
22
23 import javax.servlet.ServletConfig;
24 import javax.servlet.ServletException;
25 import javax.servlet.ServletOutputStream;
26 import javax.servlet.http.HttpServlet;
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpServletResponse;
29
30
31
32
33
34
35
36 public class FragmentServlet extends HttpServlet
37 {
38 private ServletConfig config;
39
40
41 public void init(ServletConfig config) throws ServletException
42 {
43 super.init(config);
44 this.config = config;
45 }
46
47
48
49
50 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
51 {
52 doGet(request, response);
53 }
54
55
56 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
57 {
58 try
59 {
60 response.setContentType("text/html");
61 ServletOutputStream out = response.getOutputStream();
62 out.println("<html>");
63 out.println("<h1>Jetty Fragment Servlet</h1>");
64 out.println("<body>");
65 out.println("</body>");
66 out.println("</html>");
67 out.flush();
68 }
69 catch (Exception e)
70 {
71 throw new ServletException(e);
72 }
73 }
74
75
76
77
78 }