1 7 package org.jboss.webservice.handler; 8 9 11 import org.jboss.axis.providers.java.RPCInvocation; 12 import org.jboss.axis.providers.java.RPCProvider; 13 import org.jboss.logging.Logger; 14 15 import javax.xml.rpc.handler.MessageContext ; 16 import java.util.List ; 17 import java.util.Set ; 18 19 28 public class ServerHandlerChain extends HandlerChainBaseImpl 29 { 30 private static Logger log = Logger.getLogger(ServerHandlerChain.class); 31 32 public ServerHandlerChain(List infos, Set roles) 33 { 34 super(infos, roles); 35 } 36 37 42 public boolean handleRequest(MessageContext msgContext) 43 { 44 RPCInvocation invBefore = (RPCInvocation)msgContext.getProperty(RPCProvider.RPC_INVOCATION); 45 if (invBefore == null) 46 throw new IllegalStateException ("Cannot obtain RPCInvocation from message context"); 47 48 String xmlBefore = invBefore.getRequestEnvelope().getAsStringFromInternal(); 49 if (log.isTraceEnabled()) 50 log.trace("RequestEnvelope before request handlers: " + xmlBefore); 51 52 boolean doNext = super.handleRequest(msgContext); 53 54 checkMustUnderstand(msgContext); 55 56 RPCInvocation invAfter = new RPCInvocation(invBefore); 57 invAfter.prepareFromRequestEnvelope(); 58 59 String xmlAfter = invAfter.getRequestEnvelope().getAsStringFromInternal(); 60 if (xmlBefore.equals(xmlAfter) == false) 61 { 62 if (log.isTraceEnabled()) 63 log.trace("RequestEnvelope after request handlers: " + xmlAfter); 64 65 msgContext.setProperty(RPCProvider.RPC_INVOCATION, invAfter); 66 } 67 68 return doNext; 69 } 70 71 81 public boolean handleResponse(MessageContext msgContext) 82 { 83 boolean status = super.handleResponse(msgContext); 84 85 checkMustUnderstand(msgContext); 86 87 return status; 88 } 89 } 90 | Popular Tags |