# Class ContextHandler

java.lang.Object
org.apache.tomcat.util.descriptor.web.ResourceBase
org.apache.tomcat.util.descriptor.web.ContextHandler

All Implemented Interfaces:
  `Serializable, Injectable`

public class ContextHandler extends ResourceBase
Representation of a handler reference for a web service, as represented in a `<handler>` element in the deployment descriptor.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContextHandler()`
  Default constructor for ContextHandler.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addPortName(String portName)`
  Adds a port name.
  `void`
  `addSoapHeaders(String localpart, String namespaceuri)`
  Adds a SOAP header with the given local part and namespace URI.
  `void`
  `addSoapRole(String soapRole)`
  Adds a SOAP role.
  `boolean`
  `equals(Object obj)`
  `String`
  `getHandlerclass()`
  Returns the Handler reference class.
  `Iterator<String>`
  `getLocalparts()`
  Returns the iterator of local parts for SOAP headers.
  `String`
  `getNamespaceuri(String localpart)`
  Returns the namespace URI for the given local part.
  `String`
  `getPortName(int i)`
  Returns the port name at the given index.
  `int`
  `getPortNamesSize()`
  Returns the number of port names.
  `String`
  `getSoapRole(int i)`
  Returns the SOAP role at the given index.
  `int`
  `getSoapRolesSize()`
  Returns the number of SOAP roles.
  `int`
  `hashCode()`
  `void`
  `setHandlerclass(String handlerclass)`
  Sets the Handler reference class.
  `void`
  `setProperty(String name, String value)`
  Set a configured property.
  `String`
  `toString()`
  Return a String representation of this object.

  ### Methods inherited from class ResourceBase

  `addInjectionTarget, getDescription, getInjectionTargets, getLookupName, getName, getNamingResources, getProperty, getType, listProperties, removeProperty, setDescription, setLookupName, setName, setNamingResources, setProperty, setType`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ContextHandler

    public ContextHandler()
    Default constructor for ContextHandler.

- ## Method Details

  - ### getHandlerclass

    public String getHandlerclass()
    Returns the Handler reference class.
    Returns:
      the handler class name

  - ### setHandlerclass

    public void setHandlerclass(String handlerclass)
    Sets the Handler reference class.
    Parameters:
      `handlerclass` - the handler class name

  - ### getLocalparts

    public Iterator<String> getLocalparts()
    Returns the iterator of local parts for SOAP headers.
    Returns:
      iterator of local part names

  - ### getNamespaceuri

    public String getNamespaceuri(String localpart)
    Returns the namespace URI for the given local part.
    Parameters:
      `localpart` - the local part name
    Returns:
      the namespace URI

  - ### addSoapHeaders

    public void addSoapHeaders(String localpart, String namespaceuri)
    Adds a SOAP header with the given local part and namespace URI.
    Parameters:
      `localpart` - the local part name
      `namespaceuri` - the namespace URI

  - ### setProperty

    public void setProperty(String name, String value)
    Set a configured property.
    Parameters:
      `name` - The property name
      `value` - The property value

  - ### getSoapRole

    public String getSoapRole(int i)
    Returns the SOAP role at the given index.
    Parameters:
      `i` - the index
    Returns:
      the SOAP role

  - ### getSoapRolesSize

    public int getSoapRolesSize()
    Returns the number of SOAP roles.
    Returns:
      the SOAP roles count

  - ### addSoapRole

    public void addSoapRole(String soapRole)
    Adds a SOAP role.
    Parameters:
      `soapRole` - the SOAP role to add

  - ### getPortName

    public String getPortName(int i)
    Returns the port name at the given index.
    Parameters:
      `i` - the index
    Returns:
      the port name

  - ### getPortNamesSize

    public int getPortNamesSize()
    Returns the number of port names.
    Returns:
      the port names count

  - ### addPortName

    public void addPortName(String portName)
    Adds a port name.
    Parameters:
      `portName` - the port name to add

  - ### toString

    public String toString()
    Return a String representation of this object.
    Overrides:
      `toString` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `ResourceBase`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `ResourceBase`