KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > deploy > Test


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
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
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 in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  *
21  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package org.apache.catalina.deploy;
25
26 public final class Test {
27
28     public static void main(String JavaDoc args[]) {
29
30         String JavaDoc list[] = null;
31
32         System.out.println("Creating new collection");
33         SecurityCollection collection = new SecurityCollection();
34
35         System.out.println("Adding GET and POST methods");
36         collection.addMethod("GET");
37         collection.addMethod("POST");
38
39         System.out.println("Currently defined methods:");
40         list = collection.findMethods();
41         for (int i = 0; i < list.length; i++)
42             System.out.println(" " + list[i]);
43         System.out.println("Is DELETE included? " +
44                            collection.findMethod("DELETE"));
45         System.out.println("Is POST included? " +
46                            collection.findMethod("POST"));
47
48         System.out.println("Removing POST method");
49         collection.removeMethod("POST");
50
51         System.out.println("Currently defined methods:");
52         list = collection.findMethods();
53         for (int i = 0; i < list.length; i++)
54             System.out.println(" " + list[i]);
55         System.out.println("Is DELETE included? " +
56                            collection.findMethod("DELETE"));
57         System.out.println("Is POST included? " +
58                            collection.findMethod("POST"));
59
60     }
61
62 }
63
Popular Tags