Package org.glassfish.api.invocation

Examples of org.glassfish.api.invocation.InvocationManager


    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
View Full Code Here


    public boolean handleRequest(MessageContext context) {
        EJBInvocation inv = null;
        try {
            WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
            InvocationManager invManager = wscImpl.getInvocationManager();
            inv = (EJBInvocation) 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
View Full Code Here

    @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),
View Full Code Here

    @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
View Full Code Here

    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);
View Full Code Here

        // This is a servlet endpoint
        p = this.jaxwsContextDelegate.getUserPrincipal();
        //handling for WebService with WS-Security
        if (p == null && secServ != null) {
            WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
            InvocationManager mgr = wscImpl.getInvocationManager();
            boolean isWeb = ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION.
                    equals(mgr.getCurrentInvocation().getInvocationType()) ? true : false;
            p = secServ.getUserPrincipal(isWeb);
        }
        return p;
    }
View Full Code Here

    }

    public boolean isUserInRole(String role) {
        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        ComponentInvocation.ComponentInvocationType EJBInvocationType = ComponentInvocation.ComponentInvocationType.EJB_INVOCATION;
        InvocationManager mgr = wscImpl.getInvocationManager();
        if ((mgr!=null) && (EJBInvocationType.equals(mgr.getCurrentInvocation().getInvocationType()))) {
           EJBInvocation inv = (EJBInvocation)mgr.getCurrentInvocation();
           boolean res = inv.isCallerInRole(role);
           return res;
        }
        // This is a servlet endpoint
        boolean ret = this.jaxwsContextDelegate.isUserInRole(role);
        //handling for webservice with WS-Security
        if (!ret && secServ != null) {

            if (mgr.getCurrentInvocation().getContainer() instanceof WebModule) {
                Principal p = getUserPrincipal();
                ret = secServ.isUserInRole((WebModule)mgr.getCurrentInvocation().getContainer(), p, servletName, role);
            }

        }
        return ret;
    }
View Full Code Here

        currentInvocation.setTransactionOperationsManager(preexistingTransactionOperationsManager);
    }

    ComponentInvocation getCurrentInvocation() {
        ServiceLocator serviceLocator = Globals.getDefaultHabitat();
        InvocationManager invocationManager =
                serviceLocator == null ? null : serviceLocator.getService(InvocationManager.class);
        return invocationManager == null ? null : invocationManager.getCurrentInvocation();
    }
View Full Code Here

        currentInvocation.setTransactionOperationsManager(preexistingTransactionOperationsManager);
    }

    ComponentInvocation getCurrentInvocation() {
        ServiceLocator serviceLocator = Globals.getDefaultHabitat();
        InvocationManager invocationManager =
                serviceLocator == null ? null : serviceLocator.getService(InvocationManager.class);
        return invocationManager == null ? null : invocationManager.getCurrentInvocation();
    }
View Full Code Here


        Class annotatedClass = annotatedType.getJavaClass();
        JndiNameEnvironment jndiNameEnvironment = (JndiNameEnvironment) bundleContext;
        ServiceLocator serviceLocator = Globals.getDefaultHabitat();
        InvocationManager invocationManager = serviceLocator.getService(InvocationManager.class);
        ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
        String componentId = compEnvManager.getComponentEnvId(jndiNameEnvironment);
        String appName = bundleContext.getApplication().getAppName();
        String moduleName = bundleContext.getModuleName();

        ComponentInvocation componentInvocation = null;

        InjectionInfo injectionInfo = jndiNameEnvironment.getInjectionInfoByClass(annotatedClass);
        List<InjectionCapable> injectionResources = injectionInfo.getInjectionResources();
        if ( injectionResources.size() > 0 ) {
        }

        boolean lookupsWillWork = true;
        for (AnnotatedField<? super T> annotatedField : annotatedType.getFields()) {
            if ( lookupsWillWork && annotatedField.isAnnotationPresent( Produces.class ) ) {
                if ( componentInvocation == null ) {
                    componentInvocation = createComponentInvocation( componentId,
                                                                     appName,
                                                                     moduleName);
                    try {
                        invocationManager.preInvoke(componentInvocation);
                    } catch ( Exception preInvokeException ) {
                        lookupsWillWork = false;
                    }
                }

                if ( lookupsWillWork ) {
                    String lookupName = getLookupName( annotatedClass,
                                                       annotatedField,
                                                       injectionResources );
                    Object resource = getResource( lookupName );
                    if ( resource == null ) {
                        // we have to retry using the component environment name because it could be a env entry with a
                        // name specified in the annotation but getLookupName returned that instead of the
                        // field's component env entry name...convoluted but necessary
                        lookupName = getComponentEnvName( annotatedClass,
                                                          annotatedField.getJavaMember().getName(),
                                                          injectionResources );
                        resource = getResource( lookupName );
                    }
                    if ( resource != null ) {
                        validateResource( annotatedField, resource);
                    }
                }
            }
        }

        if ( componentInvocation != null ) {
            try {
                invocationManager.postInvoke(componentInvocation);
            } catch ( Exception ignore ) {
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.api.invocation.InvocationManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.