Yurttas/PL/OOL/Java/F/08/03/00/02/Message02.java
Jump to navigation
Jump to search
1/**
2 * Copyright(C) 2000
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : June 1, 2000.
11 * @author : Salih Yurttas.
12 */
13
14
15import javax.servlet.*;
16import javax.servlet.http.*;
17
18import java.net.*;
19
20import java.io.*;
21
22public class Message02 extends HttpServlet {
23
24 public void doGet(HttpServletRequest request,
25 HttpServletResponse response)
26 throws ServletException, IOException
27 {
28 URL url = new URL("http://zcubes.com/faculty/yurttas/M/m02.txt");
29 URLConnection urlC = url.openConnection();
30
31 InputStream iS = urlC.getInputStream();
32 InputStreamReader iSR = new InputStreamReader(iS);
33 BufferedReader bR = new BufferedReader(iSR);
34
35 String message = bR.readLine();
36
37 response.setContentType("text/html");
38
39 PrintWriter out = response.getWriter();
40
41 out.println("<html>");
42
43 out.println("<head>");
44
45 out.println("<title>Message02</title>");
46
47 out.println("</head>");
48
49 out.println("<body>");
50
51 out.println("<h2>"+message+"</h2>");
52
53 out.println("</body>");
54
55 out.println("</html>");
56
57 out.close();
58 }
59
60}