Package org.apache.cxf.jaxrs.lifecycle

Examples of org.apache.cxf.jaxrs.lifecycle.ResourceProvider


        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.getResourceProvider() != null) {
                continue;
            }
           
            ResourceProvider rp = resourceProviders.get(cri.getResourceClass());
            if (rp != null) {
                cri.setResourceProvider(rp);
            } else {
                //default lifecycle is per-request
                rp = new PerRequestResourceProvider(cri.getResourceClass());
View Full Code Here


            //      or should we rather ignore content list and have
            //      Response set here for all cases and extract it
            //      in the out interceptor instead of dealing with the contents list ?
            return new MessageContentsList(response);
        }
        ResourceProvider provider = getResourceProvider(exchange);
        Object rootInstance = getServiceObject(exchange);
        Object serviceObject = getActualServiceObject(exchange, rootInstance);
       
        try {
            return invoke(exchange, request, serviceObject);
        } finally {
            boolean suspended = exchange.getInMessage().getInterceptorChain().getState() == State.SUSPENDED;
            if (!suspended) {
                if (exchange.isOneWay()) {
                    ProviderFactory.getInstance(exchange.getInMessage()).clearThreadLocalProxies();
                }
                if (!isServiceObjectRequestScope(exchange.getInMessage())) {
                    provider.releaseInstance(exchange.getInMessage(), rootInstance);
                } else {
                    persistRoots(exchange, rootInstance, provider);
                }
            } else {
                persistRoots(exchange, rootInstance, provider);
View Full Code Here

            //      or should we rather ignore content list and have
            //      Response set here for all cases and extract it
            //      in the out interceptor instead of dealing with the contents list ?
            return new MessageContentsList(response);
        }
        ResourceProvider provider = getResourceProvider(exchange);
        Object rootInstance = getServiceObject(exchange);
        Object serviceObject = getActualServiceObject(exchange, rootInstance);
       
        try {
            return invoke(exchange, request, serviceObject);
        } finally {
            boolean suspended = exchange.getInMessage().getInterceptorChain().getState() == State.SUSPENDED;
            if (exchange.isOneWay() || suspended) {
                ProviderFactory.getInstance(exchange.getInMessage()).clearThreadLocalProxies();
            }
            if (!suspended) {
                if (!isServiceObjectRequestScope(exchange.getInMessage())) {
                    provider.releaseInstance(exchange.getInMessage(), rootInstance);
                }
            } else {
                exchange.put(REQUEST_WAS_SUSPENDED, true);
            }
            persistRoots(exchange, rootInstance, provider);
View Full Code Here

        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.getResourceProvider() != null) {
                continue;
            }
           
            ResourceProvider rp = resourceProviders.get(cri.getResourceClass());
            if (rp != null) {
                cri.setResourceProvider(rp);
            } else {
                //default lifecycle is per-request
                rp = new PerRequestResourceProvider(cri.getResourceClass());
View Full Code Here

            asyncImpl.prepareContinuation();
            asyncImpl.handleTimeout();
            return handleAsyncResponse(exchange, asyncImpl.getResponseObject());
        }
       
        ResourceProvider provider = getResourceProvider(exchange);
        Object rootInstance = null;
        try {
            rootInstance = getServiceObject(exchange);
            Object serviceObject = getActualServiceObject(exchange, rootInstance);
           
            return invoke(exchange, request, serviceObject);
        } catch (WebApplicationException ex) {
            responseList = checkExchangeForResponse(exchange);
            if (responseList != null) {
                return responseList;
            }
            return handleFault(ex, exchange.getInMessage());
        } finally {
            boolean suspended = PropertyUtils.isTrue(exchange.get(Message.SUSPENDED_INVOCATION))
                || exchange.getInMessage().getInterceptorChain().getState() == State.SUSPENDED;
            if (exchange.isOneWay() || suspended) {
                ProviderFactory.getInstance(exchange.getInMessage()).clearThreadLocalProxies();
            }
            if (!suspended && !isServiceObjectRequestScope(exchange.getInMessage())) {
                provider.releaseInstance(exchange.getInMessage(), rootInstance);
            } else {
                exchange.put(REQUEST_WAS_SUSPENDED, suspended);
                persistRoots(exchange, rootInstance, provider);
            }
        }
View Full Code Here

        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.getResourceProvider() != null) {
                continue;
            }
           
            ResourceProvider rp = resourceProviders.get(cri.getResourceClass());
            if (rp != null) {
                cri.setResourceProvider(rp);
            } else {
                //default lifecycle is per-request
                rp = new PerRequestResourceProvider(cri.getResourceClass());
View Full Code Here

        for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
            if (cri.getResourceProvider() != null) {
                continue;
            }
           
            ResourceProvider rp = resourceProviders.get(cri.getResourceClass());
            if (rp != null) {
                cri.setResourceProvider(rp);
            } else {
                //default lifecycle is per-request
                rp = new PerRequestResourceProvider(cri.getResourceClass());
View Full Code Here

    public static Object getResourceInstance(Message message) {
        final OperationResourceInfo ori = message.getExchange().get(OperationResourceInfo.class);
        if (ori == null) {
            return null;
        }
        final ResourceProvider resourceProvider = ori.getClassResourceInfo().getResourceProvider();
        if (!resourceProvider.isSingleton()) {
            String error = "Service object is not a singleton, use a custom invoker to validate";
            LOG.warning(error);
            return null;
        } else {
            return resourceProvider.getInstance(message);
        }
    }
View Full Code Here

            //      or should we rather ignore content list and have
            //      Response set here for all cases and extract it
            //      in the out interceptor instead of dealing with the contents list ?
            return new MessageContentsList(response);
        }
        ResourceProvider provider = getResourceProvider(exchange);
        Object rootInstance = getServiceObject(exchange);
        Object serviceObject = getActualServiceObject(exchange, rootInstance);
       
        try {
            return invoke(exchange, request, serviceObject);
        } finally {
            boolean suspended = exchange.getInMessage().getInterceptorChain().getState() == State.SUSPENDED;
            if (!suspended) {
                if (exchange.isOneWay()) {
                    ProviderFactory.getInstance(exchange.getInMessage()).clearThreadLocalProxies();
                }
                if (!isServiceObjectRequestScope(exchange.getInMessage())) {
                    provider.releaseInstance(exchange.getInMessage(), rootInstance);
                } else {
                    persistRoots(exchange, rootInstance, provider);
                }
            } else {
                persistRoots(exchange, rootInstance, provider);
View Full Code Here

            return new MessageContentsList(response);
        }
       
       
       
        ResourceProvider provider = getResourceProvider(exchange);
        Object rootInstance = getServiceObject(exchange);
        Object serviceObject = getActualServiceObject(exchange, rootInstance);
       
        try {
            return invoke(exchange, request, serviceObject);
        } finally {
            boolean suspended = exchange.getInMessage().getInterceptorChain().getState() == State.SUSPENDED;
            if (!suspended) {
                if (exchange.isOneWay()) {
                    ProviderFactory.getInstance(exchange.getInMessage()).clearThreadLocalProxies();
                }
                if (!isServiceObjectRequestScope(exchange.getInMessage())) {
                    provider.releaseInstance(exchange.getInMessage(), rootInstance);
                } else {
                    persistRoots(exchange, rootInstance, provider);
                }
            } else {
                persistRoots(exchange, rootInstance, provider);
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.lifecycle.ResourceProvider

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.