BasicHandler.javaAPI DocApache Axis 1.45349Sat Apr 22 18:57:28 BST 2006org.apache.axis.handlers


public abstract class BasicHandler extends Object implements org.apache.axis.Handler
BasicHandler is a utility class which implements simple property setting/getting behavior, and stubs out a lot of the Handler methods. Extend this class to make writing your Handlers easier, and then override what you need to.
Glen Daniels (
Doug Davis (

Fields Summary
private static Log
protected boolean
protected Hashtable
protected String
Constructors Summary
Methods Summary
public booleancanHandleBlock(javax.xml.namespace.QName qname)

        return false;
public voidcleanup()

public voidgenerateWSDL(org.apache.axis.MessageContext msgContext)

public org.w3c.dom.ElementgetDeploymentData(org.w3c.dom.Document doc)

        log.debug("Enter: BasicHandler::getDeploymentData");

        Element  root = doc.createElementNS("", "handler");

        root.setAttribute( "class", this.getClass().getName() );
        options = this.getOptions();
        if ( options != null ) {
            Enumeration e = options.keys();
            while ( e.hasMoreElements() ) {
                String k = (String) e.nextElement();
                Object v = options.get(k);
                Element e1 = doc.createElementNS("", "option" );
                e1.setAttribute( "name", k );
                e1.setAttribute( "value", v.toString() );
                root.appendChild( e1 );
        log.debug("Exit: BasicHandler::getDeploymentData");
        return( root );
public java.lang.StringgetName()
Return the name (i.e. registry key) for this Handler

        return name;
public java.lang.ObjectgetOption(java.lang.String name)
Returns the option corresponding to the 'name' given

        if ( options == null ) return( null );
        return( options.get(name) );
public java.util.HashtablegetOptions()
Return the entire list of options

        return( options );
public java.util.ListgetUnderstoodHeaders()
Return a list of QNames which this Handler understands. By returning a particular QName here, we are committing to fulfilling any contracts defined in the specification of the SOAP header with that QName.

        return null;
public voidinit()
Stubbed-out methods. Override in your child class to implement any real behavior. Note that there is NOT a stub for invoke(), since we require any Handler derivative to implement that.

protected voidinitHashtable()

        if (makeLockable) {
            options = new LockableHashtable();
        } else {
            options = new Hashtable();
public voidonFault(org.apache.axis.MessageContext msgContext)

public voidsetName(java.lang.String name)
Set the name (i.e. registry key) of this Handler = name;
public voidsetOption(java.lang.String name, java.lang.Object value)
Set the given option (name/value) in this handler's bag of options

        if ( options == null ) initHashtable();
        options.put( name, value );
public booleansetOptionDefault(java.lang.String name, java.lang.Object value)
Set a default value for the given option: if the option is not already set, then set it. if the option is already set, then do not set it.

If this is called multiple times, the first with a non-null value if 'value' will set the default, remaining calls will be ignored.

Returns true if value set (by this call), otherwise false;

        boolean val = (options == null  || options.get(name) == null) && value != null;
        if (val) {
            setOption(name, value);
        return val;
public voidsetOptions(java.util.Hashtable opts)

        options = opts;
protected voidsetOptionsLockable(boolean makeLockable)
Should this Handler use a LockableHashtable for options? Default is 'false'.

        this.makeLockable = makeLockable;