KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > util > handler > TcHandlerCtx


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

27 package org.apache.tomcat.util.handler;
28
29 import java.io.IOException JavaDoc;
30 import java.io.UnsupportedEncodingException JavaDoc;
31 import java.io.InputStream JavaDoc;
32 import java.io.OutputStream JavaDoc;
33 import java.net.Socket JavaDoc;
34 import java.util.Enumeration JavaDoc;
35
36
37 /**
38  * Store all context informations for the invocation of a handler chain.
39  *
40  * @author Costin Manolache
41  */

42 public class TcHandlerCtx {
43
44
45     private int type = 0;
46
47     /**
48      * Get the type of the handler context.
49      */

50     public final int getType() {
51         return type;
52     }
53
54     /**
55      * Set the type of the handler context.
56      */

57     public final void setType( int type ) {
58         this.type = type;
59     }
60
61
62     // XXX Make it configurable ( at startup, since runtime change will require sync )
63
private Object JavaDoc notes[] = new Object JavaDoc[32];
64
65     /**
66      * Get a note associated with this hanlder context.
67      */

68     public final Object JavaDoc getNote( int id ) {
69         return notes[id];
70     }
71
72     /**
73      * Associate a note with this hanlder context.
74      */

75     public final void setNote( int id, Object JavaDoc o ) {
76         notes[id]=o;
77     }
78
79
80     /**
81      * Recycle the hanlder context.
82      */

83     public void recycle() {
84         type = 0;
85         for( int i=0; i<notes.length; i++ ) {
86             notes[i]=null;
87         }
88     }
89
90 }
91
Popular Tags