KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > rpc > handler > GenericHandler


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.xml.rpc.handler;
17
18 import javax.xml.namespace.QName JavaDoc;
19
20 /**
21  * The <code>javax.xml.rpc.handler.GenericHandler</code> class
22  * implements the <code>Handler</code> interface. SOAP Message
23  * Handler developers should typically subclass
24  * <code>GenericHandler</code> class unless the Handler class
25  * needs another class as a superclass.
26  *
27  * <p>
28  * The <code>GenericHandler</code> class is a convenience abstract
29  * class that makes writing Handlers easy. This class provides
30  * default implementations of the lifecycle methods <code>init</code>
31  * and <code>destroy</code> and also different handle methods.
32  * A Handler developer should only override methods that it needs
33  * to specialize as part of the derived <code>Handler</code>
34  * implementation class.
35  *
36  * @version 1.0
37  */

38 public abstract class GenericHandler implements Handler JavaDoc {
39
40     /**
41      * Default constructor.
42      */

43     protected GenericHandler() {}
44
45     /**
46      * The <code>handleRequest</code> method processes the request
47      * SOAP message. The default implementation of this method returns
48      * <code>true</code>. This indicates that the handler chain
49      * should continue processing of the request SOAP message.
50      * This method should be overridden if the derived Handler class
51      * needs to specialize implementation of this method.
52      *
53      * @param context the message context
54      * @return true/false
55      */

56     public boolean handleRequest(MessageContext JavaDoc context) {
57         return true;
58     }
59
60     /**
61      * The <code>handleResponse</code> method processes the response
62      * message. The default implementation of this method returns
63      * <code>true</code>. This indicates that the handler chain
64      * should continue processing of the response SOAP message.
65      * This method should be overridden if the derived Handler class
66      * needs to specialize implementation of this method.
67      *
68      * @param context the message context
69      * @return true/false
70      */

71     public boolean handleResponse(MessageContext JavaDoc context) {
72         return true;
73     }
74
75     /**
76      * The <code>handleFault</code> method processes the SOAP faults
77      * based on the SOAP message processing model. The default
78      * implementation of this method returns <code>true</code>. This
79      * indicates that the handler chain should continue processing
80      * of the SOAP fault. This method should be overridden if
81      * the derived Handler class needs to specialize implementation
82      * of this method.
83      *
84      * @param context the message context
85      * @return true/false
86      */

87     public boolean handleFault(MessageContext JavaDoc context) {
88         return true;
89     }
90
91     /**
92      * The <code>init</code> method to enable the Handler instance to
93      * initialize itself. This method should be overridden if
94      * the derived Handler class needs to specialize implementation
95      * of this method.
96      *
97      * @param config handler configuration
98      */

99     public void init(HandlerInfo JavaDoc config) {}
100
101     /**
102      * The <code>destroy</code> method indicates the end of lifecycle
103      * for a Handler instance. This method should be overridden if
104      * the derived Handler class needs to specialize implementation
105      * of this method.
106      */

107     public void destroy() {}
108
109     /**
110      * Gets the header blocks processed by this Handler instance.
111      *
112      * @return Array of QNames of header blocks processed by this handler instance.
113      * <code>QName</code> is the qualified name of the outermost element of the Header block.
114      */

115     public abstract QName JavaDoc[] getHeaders();
116 }
117
118
Popular Tags