View Javadoc

1   package org.codehaus.xfire.handler;
2   
3   import javax.xml.namespace.QName;
4   import javax.xml.stream.XMLStreamReader;
5   import org.codehaus.xfire.MessageContext;
6   
7   /***
8    * <p>
9    * A handler is just something that processes an XML message.
10   * </p>
11   * <p>
12   * There is one handler per service. This can delegate to a bunch of
13   * other handlers if need be.
14   * </p>
15   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
16   * @since Feb 18, 2004
17   */
18  public interface Handler
19  {
20  	String ROLE = Handler.class.getName();
21      
22      /***
23       * @return null or an empty array if there are no headers.
24       */
25      QName[] getUnderstoodHeaders();
26      
27      /***
28       * Invoke a handler. If a fault occurs it will be handled
29       * via the <code>handleFault</code> method.
30       * 
31       * @param message The message context.
32       */
33      void invoke( MessageContext context,
34                   XMLStreamReader reader ) throws Exception;
35  
36      /***
37       * Handles faults that occur in this handler.
38       * 
39       * @param context
40       */
41      void handleFault( Exception e, 
42                        MessageContext context );
43  }