Source code: dispatch/IncludeFileServlet.java
1 /*
2 * $Id: IncludeFileServlet.java,v 1.1.1.1 2000/02/26 01:32:22 shawn Exp $
3 */
4
5 package dispatch;
6
7 import javax.servlet.*;
8 import javax.servlet.http.*;
9 import java.io.*;
10
11 public class IncludeFileServlet extends HttpServlet {
12
13 private ServletContext context;
14
15 public void init() {
16 context = getServletConfig().getServletContext();
17 }
18
19 public void doGet(HttpServletRequest req, HttpServletResponse res)
20 throws ServletException, IOException
21 {
22 res.setContentType("text/foobar");
23 PrintWriter pwo = res.getWriter();
24 pwo.println("LINE1");
25 String s = "/dispatch/foo.html";
26 RequestDispatcher rd = context.getRequestDispatcher(s);
27 rd.include(req, res);
28 pwo.println("LINE2");
29 }
30 }
31