EjbContainerPostHandler.javaAPI DocGlassfish v2 API5081Fri May 04 22:36:10 BST 2007com.sun.enterprise.webservice


public class EjbContainerPostHandler extends javax.xml.rpc.handler.GenericHandler
This handler is inserted last in the handler chain for an ejb web service endpoint. It ensures that the application handlers did not change anything in the soap message that would change the dispatch method.
Kenneth Saks

Fields Summary
private static Logger
private WsUtil
Constructors Summary
public EjbContainerPostHandler()

Methods Summary
public javax.xml.namespace.QName[]getHeaders()

        return new QName[0];
public booleanhandleRequest(javax.xml.rpc.handler.MessageContext context)

        Invocation inv = null;
        boolean continueProcessing = true;

        try {
            Switch theSwitch = Switch.getSwitch();
            InvocationManager invManager = theSwitch.getInvocationManager();
            inv = (Invocation) invManager.getCurrentInvocation();
            Container container = (Container) inv.container;

            Method webServiceMethodInPreHandler = inv.getWebServiceMethod();

            if( webServiceMethodInPreHandler != null ) {
                // Now that application handlers have run, do another method
                // lookup and compare the results with the original one.  This
                // ensures that the application handlers have not changed
                // the message context in any way that would impact which
                // method is invoked.
                Method postHandlerMethod = 
                    wsUtil.getInvMethod(inv.getWebServiceTie(), context);
                if( !webServiceMethodInPreHandler.equals(postHandlerMethod) ) {
                    inv.exception = new UnmarshalException
                        ("Original method " + webServiceMethodInPreHandler + 
                         " does not match post-handler method " + 
        } catch(Exception e) {
            String errorMsg = "Exception while getting method for " +
                ((inv != null ) ?
                 ((Container) inv.container).getEjbDescriptor().getName() : "");
            inv.exception = new UnmarshalException(errorMsg);
        if( inv.exception != null ) {
            logger.log(Level.WARNING, "postEjbHandlerError", inv.exception);

        return true;