1 23 package com.sun.enterprise.webservice; 24 25 import java.util.Iterator ; 26 27 import java.lang.reflect.Method ; 28 29 import java.rmi.RemoteException ; 30 import java.rmi.UnmarshalException ; 31 32 import javax.xml.namespace.QName ; 33 34 import javax.xml.rpc.JAXRPCException ; 35 import javax.xml.rpc.handler.Handler ; 36 import javax.xml.rpc.handler.GenericHandler ; 37 import javax.xml.rpc.handler.HandlerInfo ; 38 import javax.xml.rpc.handler.MessageContext ; 39 40 import com.sun.enterprise.Switch; 41 import com.sun.enterprise.ComponentInvocation; 42 import com.sun.enterprise.InvocationManager; 43 44 import java.util.logging.Logger ; 45 import java.util.logging.Level ; 46 import com.sun.logging.LogDomains; 47 48 54 public class ServletPostHandler extends GenericHandler { 55 56 private static Logger logger = 57 LogDomains.getLogger(LogDomains.WEB_LOGGER); 58 private WsUtil wsUtil = new WsUtil(); 59 60 public ServletPostHandler() {} 61 62 public QName [] getHeaders() { 63 return new QName [0]; 64 } 65 66 public boolean handleRequest(MessageContext context) { 67 ComponentInvocation inv = null; 68 69 try { 70 Switch theSwitch = Switch.getSwitch(); 71 InvocationManager invManager = theSwitch.getInvocationManager(); 72 inv = invManager.getCurrentInvocation(); 73 74 Method webServiceMethodInPreHandler = inv.getWebServiceMethod(); 75 if( webServiceMethodInPreHandler != null ) { 76 Method postHandlerMethod = 77 wsUtil.getInvMethod(inv.getWebServiceTie(), context); 78 79 if( !webServiceMethodInPreHandler.equals(postHandlerMethod) ) { 80 throw new UnmarshalException 81 ("Original method " + webServiceMethodInPreHandler 82 + " does not match post-handler method " + 83 postHandlerMethod); 84 } 85 } 86 } catch(Exception e) { 87 logger.log(Level.WARNING, "postWebHandlerError", e); 88 wsUtil.throwSOAPFaultException(e.getMessage(), context); 89 } 90 91 return true; 92 } 93 94 } 95 | Popular Tags |