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 import java.lang.reflect.Method;
23 import java.util.List;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26
27 import javax.servlet.ServletConfig;
28 import javax.servlet.ServletException;
29 import javax.servlet.ServletOutputStream;
30 import javax.servlet.http.HttpServlet;
31 import javax.servlet.http.HttpServletRequest;
32 import javax.servlet.http.HttpServletResponse;
33
34
35
36
37
38
39
40 public class FragmentServlet extends HttpServlet
41 {
42 private ServletConfig config;
43
44
45 public void init(ServletConfig config) throws ServletException
46 {
47 super.init(config);
48 this.config = config;
49 }
50
51
52
53
54 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
55 {
56 doGet(request, response);
57 }
58
59
60 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
61 {
62 try
63 {
64 response.setContentType("text/html");
65 ServletOutputStream out = response.getOutputStream();
66 out.println("<html>");
67 out.println("<h1>Jetty Fragment Servlet</h1>");
68 out.println("<body>");
69 out.println("</body>");
70 out.println("</html>");
71 out.flush();
72 }
73 catch (Exception e)
74 {
75 throw new ServletException(e);
76 }
77 }
78
79
80
81
82 }