View Javadoc

    1   package org.codehaus.xfire.addressing;
    2
    3   import org.apache.commons.logging.Log;
    4   import org.apache.commons.logging.LogFactory;
    5   import org.codehaus.xfire.MessageContext;
    6   import org.codehaus.xfire.exchange.OutMessage;
    7   import org.codehaus.xfire.handler.AbstractHandler;
    8   import org.codehaus.xfire.handler.Phase;
    9
    10  public class AddressingOutHandler
    11      extends AbstractHandler
    12  {
    13      private final static Log logger = LogFactory.getLog(AddressingOutHandler.class);
    14
    15      public AddressingOutHandler()
    16      {
    17      }
    18
    19      public String getPhase()
    20      {
    21          return Phase.TRANSPORT;
    22      }
    23
    24      public void invoke(MessageContext context)
    25          throws Exception
    26      {
    27          OutMessage msg = context.getOutMessage();
    28          AddressingHeaders headers = (AddressingHeaders) msg.getProperty(AddressingInHandler.ADRESSING_HEADERS);
    29          AddressingHeadersFactory factory = (AddressingHeadersFactory) msg.getProperty(AddressingInHandler.ADRESSING_FACTORY);
    30
    31          if (headers == null)
    32          {
    33              logger.debug("Couldn't find adressing headers.");
    34              return;
    35          }
    36
    37          if (msg == null)
    38          {
    39              logger.warn("There was no out message!");
    40              return;
    41          }
    42
    43          factory.writeHeaders(msg.getHeader(), headers);
    44      }
    45  }