KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > servlet > ConnectServlet


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core.servlet;
25
26 //j2ee imports
27
import javax.servlet.*;
28 import javax.servlet.http.*;
29
30 //jdk imports
31
import java.io.IOException JavaDoc;
32 import java.io.PrintWriter JavaDoc;
33
34
35 /**
36     A simple Servlet to test the connectivity of API layer.
37     @author Kedar Mhaswade
38     @version 1.0
39 */

40
41 public class ConnectServlet extends HttpServlet
42 {
43
44     public void doPost(HttpServletRequest request, HttpServletResponse response)
45         throws ServletException, IOException JavaDoc
46     {
47         doGet(request, response);
48     }
49
50     public void doGet(HttpServletRequest request, HttpServletResponse response)
51         throws ServletException, IOException JavaDoc
52     {
53         PrintWriter JavaDoc out;
54         String JavaDoc title = "Simple Servlet Output";
55
56         // set content type and other response header fields first
57
response.setContentType("text/html");
58
59         // then write the data of the response
60
out = response.getWriter();
61
62         out.println("<HTML><HEAD><TITLE>");
63         out.println(title);
64         out.println("</TITLE></HEAD><BODY>");
65         out.println("<H1>" + title + "</H1>");
66         out.println("<P> This means you are connected to the Admin API Servlet Layer.");
67         out.println("</BODY></HTML>");
68         out.close();
69     }
70 }
Popular Tags