Search in sources :

Example 16 with InvocationManager

use of org.glassfish.api.invocation.InvocationManager in project Payara by payara.

the class ServletPostHandler method handleRequest.

@Override
public boolean handleRequest(MessageContext context) {
    WebComponentInvocation inv = null;
    try {
        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        InvocationManager invManager = wscImpl.getInvocationManager();
        inv = WebComponentInvocation.class.cast(invManager.getCurrentInvocation());
        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((com.sun.xml.rpc.spi.runtime.Tie) inv.getWebServiceTie(), context);
            if (!webServiceMethodInPreHandler.equals(postHandlerMethod)) {
                throw new UnmarshalException("Original method " + webServiceMethodInPreHandler + " does not match post-handler method ");
            }
        }
    } catch (Exception e) {
        logger.log(Level.WARNING, LogUtils.POST_WEBHANDLER_ERROR, e.toString());
        wsUtil.throwSOAPFaultException(e.getMessage(), context);
    }
    return true;
}
Also used : WebComponentInvocation(com.sun.enterprise.web.WebComponentInvocation) UnmarshalException(java.rmi.UnmarshalException) InvocationManager(org.glassfish.api.invocation.InvocationManager) Method(java.lang.reflect.Method) UnmarshalException(java.rmi.UnmarshalException)

Example 17 with InvocationManager

use of org.glassfish.api.invocation.InvocationManager in project Payara by payara.

the class ServletPreHandler method handleRequest.

@Override
public boolean handleRequest(MessageContext context) {
    WebComponentInvocation inv = null;
    try {
        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        InvocationManager invManager = wscImpl.getInvocationManager();
        inv = WebComponentInvocation.class.cast(invManager.getCurrentInvocation());
        com.sun.xml.rpc.spi.runtime.Tie tie = (com.sun.xml.rpc.spi.runtime.Tie) inv.getWebServiceTie();
        if (tie == null) {
            Implementor implementor = (Implementor) context.getProperty(MessageContextProperties.IMPLEMENTOR);
            tie = implementor.getTie();
            inv.setWebServiceTie(tie);
        }
        inv.setWebServiceMethod(wsUtil.getInvMethod(tie, context));
    } catch (Exception e) {
        logger.log(Level.WARNING, LogUtils.PRE_WEBHANDLER_ERROR, e.toString());
        wsUtil.throwSOAPFaultException(e.getMessage(), context);
    }
    return true;
}
Also used : Implementor(com.sun.xml.rpc.server.http.Implementor) InvocationManager(org.glassfish.api.invocation.InvocationManager) WebComponentInvocation(com.sun.enterprise.web.WebComponentInvocation)

Example 18 with InvocationManager

use of org.glassfish.api.invocation.InvocationManager in project Payara by payara.

the class Web109Adapter method postHandle.

@Override
protected void postHandle() {
    final InvocationManager invocationMgr = V3Module.getInvocationManager();
    invocationMgr.postInvoke(invocation);
}
Also used : InvocationManager(org.glassfish.api.invocation.InvocationManager)

Example 19 with InvocationManager

use of org.glassfish.api.invocation.InvocationManager in project Payara by payara.

the class EjbContainerPostHandler method handleRequest.

@Override
public boolean handleRequest(MessageContext context) {
    EJBInvocation inv = null;
    try {
        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        InvocationManager invManager = wscImpl.getInvocationManager();
        inv = EJBInvocation.class.cast(invManager.getCurrentInvocation());
        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((com.sun.xml.rpc.spi.runtime.Tie) inv.getWebServiceTie(), context);
            if (!webServiceMethodInPreHandler.equals(postHandlerMethod)) {
                throw new UnmarshalException("Original method " + webServiceMethodInPreHandler + " does not match post-handler method ");
            }
        }
    } catch (Exception e) {
        wsUtil.throwSOAPFaultException(e.getMessage(), context);
    }
    return true;
}
Also used : UnmarshalException(java.rmi.UnmarshalException) InvocationManager(org.glassfish.api.invocation.InvocationManager) EJBInvocation(org.glassfish.ejb.api.EJBInvocation) Method(java.lang.reflect.Method) UnmarshalException(java.rmi.UnmarshalException)

Example 20 with InvocationManager

use of org.glassfish.api.invocation.InvocationManager in project Payara by payara.

the class EjbContainerPreHandler method handleRequest.

@Override
public boolean handleRequest(MessageContext context) {
    EJBInvocation inv = null;
    try {
        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        InvocationManager invManager = wscImpl.getInvocationManager();
        inv = EJBInvocation.class.cast(invManager.getCurrentInvocation());
        Method method = wsUtil.getInvMethod((com.sun.xml.rpc.spi.runtime.Tie) inv.getWebServiceTie(), context);
        inv.setWebServiceMethod(method);
        if (!inv.authorizeWebService(method)) {
            throw new Exception(format(logger.getResourceBundle().getString(LogUtils.CLIENT_UNAUTHORIZED), method.toString()));
        }
    } catch (Exception e) {
        wsUtil.throwSOAPFaultException(e.getMessage(), context);
    }
    return true;
}
Also used : InvocationManager(org.glassfish.api.invocation.InvocationManager) EJBInvocation(org.glassfish.ejb.api.EJBInvocation) Method(java.lang.reflect.Method)

Aggregations

InvocationManager (org.glassfish.api.invocation.InvocationManager)40 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)13 FaultToleranceService (fish.payara.microprofile.faulttolerance.FaultToleranceService)9 NamingException (javax.naming.NamingException)9 Config (org.eclipse.microprofile.config.Config)8 InvocationException (org.glassfish.api.invocation.InvocationException)7 FallbackPolicy (fish.payara.microprofile.faulttolerance.interceptors.fallback.FallbackPolicy)5 AroundInvoke (javax.interceptor.AroundInvoke)5 Fallback (org.eclipse.microprofile.faulttolerance.Fallback)5 Retry (org.eclipse.microprofile.faulttolerance.Retry)5 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)5 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)4 ArrayList (java.util.ArrayList)4 NoSuchElementException (java.util.NoSuchElementException)4 EJBInvocation (org.glassfish.ejb.api.EJBInvocation)4 JavaEETransactionManager (com.sun.enterprise.transaction.api.JavaEETransactionManager)3 RequestTraceSpan (fish.payara.notification.requesttracing.RequestTraceSpan)3 Method (java.lang.reflect.Method)3 Context (javax.naming.Context)3 InitialContext (javax.naming.InitialContext)3