org.jibx.ws.context
Class InContext

java.lang.Object
  extended by org.jibx.ws.context.Context
      extended by org.jibx.ws.context.MessageContext
          extended by org.jibx.ws.context.InContext

public final class InContext
extends MessageContext

The context for the processing of an inbound message. The context provides access to the handler objects for each phase of processing. It can also be used to store and retrieve state using the Context.setAttribute(String, Object) and Context.getAttribute(String) methods.


Constructor Summary
InContext()
           
 
Method Summary
 void addHandler(org.jibx.ws.context.Phase phase, InHandler handler)
          Adds a handler to the specified phase of the inbound message handling.
 boolean hasHandlers(org.jibx.ws.context.Phase phase)
          Returns whether the specified phase has any handlers.
 void invokeBodyReader(IXMLReader xmlReader)
          Invokes the reader for the body of the message and stores the body for subsequent retrieval with MessageContext.getBody().
 Object invokeInHandlers(org.jibx.ws.context.Phase phase, IXMLReader xmlReader)
          Sequentially invoke the processing of the inbound handlers for a phase, until one of the handlers is successful.
 boolean isOutbound()
          Returns whether the message context is for an outbound or inbound message.
 void reset()
          Resets the state of this context and all associated commands and handlers for subsequent re-use of this context.
 void setBodyReader(org.jibx.ws.io.PayloadReader bodyReader)
          Sets the reader for the body of the message.
 
Methods inherited from class org.jibx.ws.context.MessageContext
getBody, getExchangeContext, setBody
 
Methods inherited from class org.jibx.ws.context.Context
getAttribute, getAttributeNames, removeAttribute, setAttribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InContext

public InContext()
Method Detail

setBodyReader

public void setBodyReader(org.jibx.ws.io.PayloadReader bodyReader)
Sets the reader for the body of the message.

Parameters:
bodyReader - the reader for the message body

invokeBodyReader

public void invokeBodyReader(IXMLReader xmlReader)
                      throws IOException,
                             WsException
Invokes the reader for the body of the message and stores the body for subsequent retrieval with MessageContext.getBody().

Parameters:
xmlReader - the reader to read XML content from
Throws:
IOException - on any I/O error
WsException - on errors other than I/O, for example invalid XML format

addHandler

public void addHandler(org.jibx.ws.context.Phase phase,
                       InHandler handler)
Adds a handler to the specified phase of the inbound message handling.

Parameters:
phase - the phase to add the handler to
handler - the handler to add

hasHandlers

public boolean hasHandlers(org.jibx.ws.context.Phase phase)
Returns whether the specified phase has any handlers.

Parameters:
phase - the phase
Returns:
true if the specified phase has 1 or more handlers, false otherwise

invokeInHandlers

public Object invokeInHandlers(org.jibx.ws.context.Phase phase,
                               IXMLReader xmlReader)
                        throws IOException,
                               WsException
Sequentially invoke the processing of the inbound handlers for a phase, until one of the handlers is successful.

Parameters:
phase - the phase to invoke the handlers for
xmlReader - the reader to read XML content from
Returns:
true if a handler was successful handler, false otherwise
Throws:
IOException - on any I/O error
WsException - on errors other than I/O, for example invalid XML format

isOutbound

public boolean isOutbound()
Returns whether the message context is for an outbound or inbound message.

Specified by:
isOutbound in class MessageContext
Returns:
true if the context is for an outbound message, false for inbound.

reset

public void reset()
Resets the state of this context and all associated commands and handlers for subsequent re-use of this context.

Overrides:
reset in class MessageContext


Project Web Site