org.systinet.wasp.webservice
Interface HeaderProcessors


Deprecated. use Handlers

public interface HeaderProcessors

HeaderProcessors interface represents the chain of the header processors either for the service endpoint or for the client.

A payload of a SOAP message can be divided into two basic blocks: headers and body. The body carries the actual data; headers transfer meta-information. Some example of headers could be header containing username/password for authentication, header containing routing information or it can contain digital signature of the message body.

In WSO2 SOA Enablement Server, all header processors must implement the HeaderProcessor interface. Header processors usually read data from the SOAP header and store it in a CallContext (which can be obtained via Current.getCallContext()). When serializing the SOAP message, a header processor reads from the CallContext and creates an appropriate SOAP header.

The following code snippet shows how to insert a header processor at the client-side:

  ServiceClient serviceClient = ServiceClient.create("http://localhost:6060/MyService", MyService.class);
  serviceClient.getHeaderProcessors().insert(new ClientHeaderProcessor(), HeaderProcessors.DIRECTION_OUT, null, false);
 

And the following code snippet shows how to insert a header processor at the server-side:

  ServiceEndpoint endpoint = ServiceEndpoint.create("/MyService", new MyService());
  QName[] understoodHeaders = new QName[]{new QName(HEADER_NAMESPACE, HEADER_LOCAL_PART)};
  endpoint.getHeaderProcessors().insert(new ServerHeaderProcessor(), HeaderProcessors.DIRECTION_IN, understoodHeaders, false);
 

Since:
4.5
Component:
Core

Field Summary
static int DIRECTION_IN
          Deprecated. Constant value representing header processor is used for incoming message
static int DIRECTION_IN_FAULT
          Deprecated. Constant value representing header processor is used for incoming fault message
static int DIRECTION_INOUT
          Deprecated. Constant value representing header processor is used both for incoming and outgoing message.
static int DIRECTION_OUT
          Deprecated. Constant value representing header processor is used for outgoing message
static int DIRECTION_OUT_FAULT
          Deprecated. Constant value representing header processor is used for outgoing fault message
static int POSITION_FIRST
          Deprecated. Constant value representing the first position in the chain.
static int POSITION_LAST
          Deprecated. Constant value representing the last position in the chain.
 
Method Summary
 HeaderProcessor get(int position)
          Deprecated. Returns header processor instance on given position in the chain.
 int getDirection(int position)
          Deprecated. Returns direction of the header processor instance on given position in the chain.
 void insert(HeaderProcessor instance, int directions, boolean needsBody, Header[] headers, Schema[] schemata)
          Deprecated. Inserts the header processor to the end of the chain with list of understood headers and schemata in use.
 void insert(HeaderProcessor instance, int directions, QName[] understoodHeaders, boolean needsBody)
          Deprecated. Inserts the header processor to the end of the chain.
 void insert(int position, HeaderProcessor instance, int directions, boolean needsBody, Header[] headers, Schema[] schemata)
          Deprecated. Inserts the header processor at the specified position to the chain with list of understood headers and schemata in use (moving everything on and beyond this position one place further).
 void insert(int position, HeaderProcessor instance, int directions, QName[] understoodHeaders, boolean needsBody)
          Deprecated. Inserts the header processor at the specified position to the chain (moving everything on and beyond this position one place further).
 boolean needsBody(int position)
          Deprecated. Returns true if the header processors in the chain is configured to need the body of the message.
 boolean remove(HeaderProcessor instance)
          Deprecated. Removes all occurrences of the given header processor's instance from chain.
 void remove(int position)
          Deprecated. Removes a header processor at the specified position.
 void setDirection(int position, int newDirection)
          Deprecated. Sets a new direction for the header processor instance at the given position in the chain.
 int size()
          Deprecated. Returns the size (number of header processors) of the chain.
 

Field Detail

DIRECTION_IN

public static final int DIRECTION_IN
Deprecated. 
Constant value representing header processor is used for incoming message

See Also:
Constant Field Values

DIRECTION_OUT

public static final int DIRECTION_OUT
Deprecated. 
Constant value representing header processor is used for outgoing message

See Also:
Constant Field Values

DIRECTION_INOUT

public static final int DIRECTION_INOUT
Deprecated. 
Constant value representing header processor is used both for incoming and outgoing message. It is declared as DIRECTION_INOUT = DIRECTION_IN | DIRECTION_OUT.

See Also:
Constant Field Values

DIRECTION_IN_FAULT

public static final int DIRECTION_IN_FAULT
Deprecated. 
Constant value representing header processor is used for incoming fault message

See Also:
Constant Field Values

DIRECTION_OUT_FAULT

public static final int DIRECTION_OUT_FAULT
Deprecated. 
Constant value representing header processor is used for outgoing fault message

See Also:
Constant Field Values

POSITION_FIRST

public static final int POSITION_FIRST
Deprecated. 
Constant value representing the first position in the chain.

See Also:
Constant Field Values

POSITION_LAST

public static final int POSITION_LAST
Deprecated. 
Constant value representing the last position in the chain.

See Also:
Constant Field Values
Method Detail

get

public HeaderProcessor get(int position)
                    throws java.lang.IndexOutOfBoundsException
Deprecated. 
Returns header processor instance on given position in the chain.

Parameters:
position - index of the header processor
Returns:
header processor instance
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position => size())

getDirection

public int getDirection(int position)
                 throws java.lang.IndexOutOfBoundsException
Deprecated. 

Returns direction of the header processor instance on given position in the chain. The returned direction is bitwise combination of directions: DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_FAULT, DIRECTION_OUT_FAULT).

These directions depend on which end of the service they are viewed from: a header processor that is "in" according to ServiceEndpoint is "out" according to ServiceClient, and vice-versa. The "fault" directions are used for an outgoing message in a service endpoint (the incoming message in a stub) that is a SOAP fault message.

Parameters:
position - index of the header processor
Returns:
direction direction (bitwise combination of directions: DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_FAULT, DIRECTION_OUT_FAULT)
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position => size())

setDirection

public void setDirection(int position,
                         int newDirection)
                  throws java.lang.IndexOutOfBoundsException
Deprecated. 
Sets a new direction for the header processor instance at the given position in the chain.

Parameters:
position - index of the header processor
newDirection - direction (bitwise combination of directions: DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_FAULT, DIRECTION_OUT_FAULT
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position => size())

needsBody

public boolean needsBody(int position)
                  throws java.lang.IndexOutOfBoundsException
Deprecated. 
Returns true if the header processors in the chain is configured to need the body of the message. Please note, that marking header processor with needsBody flag has performance penalty because the underlying message has to convert the TokenWriter calls to the cached Tokenizer events.

Parameters:
position - position in the header processors chain
Returns:
true if the header processors in the chain is configured to need the body of the message during processing
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position => size())

insert

public void insert(int position,
                   HeaderProcessor instance,
                   int directions,
                   QName[] understoodHeaders,
                   boolean needsBody)
            throws java.lang.IndexOutOfBoundsException
Deprecated. 
Inserts the header processor at the specified position to the chain (moving everything on and beyond this position one place further).

Parameters:
directions - directions could be one of DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_FAULT, DIRECTION_OUT_FAULT or their bitwise combination
position - position in the header processors chain
instance - header processor to be added
understoodHeaders - understood headers of this header processor (used when the header contains attribute mustUnderstands="1" to determine whether the header processor can handle this header)
needsBody - true if the header processors with specified position in the chain needs access to the message body during processing.
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position > size())

insert

public void insert(HeaderProcessor instance,
                   int directions,
                   QName[] understoodHeaders,
                   boolean needsBody)
Deprecated. 
Inserts the header processor to the end of the chain.

Parameters:
instance - header processor to be added
directions - directions could be one of DIRECTION_IN, DIRECTION_OUT, DIRECTION_IN_FAULT, DIRECTION_OUT_FAULT or their bitwise combination
understoodHeaders - understood headers of this header processor (used when the header contains attribute mustUnderstands="1" to determine whether the header processor can handle this header)

insert

public void insert(HeaderProcessor instance,
                   int directions,
                   boolean needsBody,
                   Header[] headers,
                   Schema[] schemata)
Deprecated. 
Inserts the header processor to the end of the chain with list of understood headers and schemata in use.

Parameters:
instance - header processor to be added
directions - bitwise combination of DIRECTION_IN and DIRECTION_OUT
needsBody - true if the header processors with specified position in the chain needs access to the message body during processing.
headers - array of understood headers Header
schemata - array of schemata it use Schema. If you don't want to specify any schema, you can supply null for this parameter.

insert

public void insert(int position,
                   HeaderProcessor instance,
                   int directions,
                   boolean needsBody,
                   Header[] headers,
                   Schema[] schemata)
            throws java.lang.IndexOutOfBoundsException
Deprecated. 
Inserts the header processor at the specified position to the chain with list of understood headers and schemata in use (moving everything on and beyond this position one place further).

Parameters:
position - position in the header processors chain, constants POSITION_FIRST, POSITION_LAST can be used
instance - header processor to be added
directions - bitwise combination of DIRECTION_IN and DIRECTION_OUT
needsBody - true if the header processors with specified position in the chain needs access to the message body during processing.
headers - array of understood headers Header
schemata - array of schemata it use Schema. If you don't want to specify any schema, you can supply null for this parameter.
Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position > size())

remove

public void remove(int position)
            throws java.lang.IndexOutOfBoundsException
Deprecated. 
Removes a header processor at the specified position.

Throws:
java.lang.IndexOutOfBoundsException - if position is if out of range (position < 0 || position => size())

size

public int size()
Deprecated. 
Returns the size (number of header processors) of the chain.

Returns:
number of header processors within the chain

remove

public boolean remove(HeaderProcessor instance)
Deprecated. 
Removes all occurrences of the given header processor's instance from chain.

Parameters:
instance - instance of the header processor to be removed
Returns:
true if the chain contained the specified element