org.apache.cxf.jaxrs.model.ProviderInfo Java Examples

The following examples show how to use org.apache.cxf.jaxrs.model.ProviderInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CxfCdiAutoSetup.java    From openwebbeans-meecrowave with Apache License 2.0 6 votes vote down vote up
private void dump(final LogFacade log, final ServerProviderFactory spf, final String description, final String fieldName) {
    final Field field = ReflectionUtil.getDeclaredField(ProviderFactory.class, fieldName);
    if (!field.isAccessible()) {
        field.setAccessible(true);
    }
    try {
        final Collection<ProviderInfo<?>> providers = Collection.class.cast(field.get(spf));
        log.info("     " + description);
        providers.stream().map(ProviderInfo::getProvider).forEach(o -> {
            try {
                log.info("       - " + o);
            } catch (final RuntimeException re) {
                // no-op: maybe cdi context is not active
            }
        });
    } catch (IllegalAccessException e) {
        // ignore, not that a big deal
    }
}
 
Example #2
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
public int compare(ProviderInfo<?> p1, ProviderInfo<?> p2) {
    if (makeDefaultWaeLeastSpecific) {
        if (p1.getProvider() instanceof WebApplicationExceptionMapper
            && !p1.isCustom()) {
            return 1;
        } else if (p2.getProvider() instanceof WebApplicationExceptionMapper
            && !p2.isCustom()) {
            return -1;
        }
    }
    int result = super.compare(p1, p2);
    if (result == 0) {
        result = comparePriorityStatus(p1.getProvider().getClass(), p2.getProvider().getClass());
    }
    return result;
}
 
Example #3
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends Throwable> ExceptionMapper<T> createExceptionMapper(Class<?> exceptionType,
                                                                      Message m) {
    
    boolean makeDefaultWaeLeastSpecific =
        MessageUtils.getContextualBoolean(m, MAKE_DEFAULT_WAE_LEAST_SPECIFIC, false);
    
    return (ExceptionMapper<T>)exceptionMappers.stream()
            .filter(em -> handleMapper(em, exceptionType, m, ExceptionMapper.class, Throwable.class, true))
            .sorted(new ExceptionProviderInfoComparator(exceptionType,
                                                        makeDefaultWaeLeastSpecific))
            .map(ProviderInfo::getProvider)
            .findFirst()
            .orElse(null);
    
}
 
Example #4
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
private List<ProviderInfo<ContainerRequestFilter>> getContainerRequestFilters(
    List<ProviderInfo<ContainerRequestFilter>> filters, boolean syncNeeded) {

    if (wadlGenerator == null) {
        return filters;
    }
    if (filters.isEmpty()) {
        return Collections.singletonList(wadlGenerator);
    } else if (!syncNeeded) {
        filters.add(0, wadlGenerator);
        return filters;
    } else {
        synchronized (filters) {
            if (filters.get(0) != wadlGenerator) {
                filters.add(0, wadlGenerator);
            }
        }
        return filters;
    }
}
 
Example #5
Source File: MicroProfileClientFactoryBean.java    From cxf with Apache License 2.0 6 votes vote down vote up
public MicroProfileClientFactoryBean(MicroProfileClientConfigurableImpl<RestClientBuilder> configuration,
                                     String baseUri, Class<?> aClass, ExecutorService executorService,
                                     TLSConfiguration secConfig) {
    super(new MicroProfileServiceFactoryBean());
    this.configuration = configuration.getConfiguration();
    this.comparator = MicroProfileClientProviderFactory.createComparator(this);
    this.executorService = executorService;
    this.secConfig = secConfig;
    super.setAddress(baseUri);
    super.setServiceClass(aClass);
    super.setProviderComparator(comparator);
    super.setProperties(this.configuration.getProperties());
    registeredProviders = new ArrayList<>();
    registeredProviders.addAll(processProviders());
    if (!configuration.isDefaultExceptionMapperDisabled()) {
        registeredProviders.add(new ProviderInfo<>(new DefaultResponseExceptionMapper(), getBus(), false));
    }
    registeredProviders.add(new ProviderInfo<>(new JsrJsonpProvider(), getBus(), false));
    super.setProviders(registeredProviders);
}
 
Example #6
Source File: ProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected static boolean filterContractSupported(ProviderInfo<?> provider,
                                                 Class<?> providerCls,
                                                 Class<?> contract) {
    boolean result = false;
    if (contract.isAssignableFrom(providerCls)) {
        Set<Class<?>> actualContracts = null;
        if (provider instanceof FilterProviderInfo) {
            actualContracts = ((FilterProviderInfo<?>)provider).getSupportedContracts();
        }
        if (actualContracts != null) {
            result = actualContracts.contains(contract);
        } else {
            result = true;
        }
    }
    return result;
}
 
Example #7
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testSortEntityProviders() throws Exception {
    ProviderFactory pf = ServerProviderFactory.getInstance();
    pf.registerUserProvider(new TestStringProvider());
    pf.registerUserProvider(new PrimitiveTextProvider<Object>());

    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();

    assertTrue(indexOf(readers, TestStringProvider.class)
               < indexOf(readers, PrimitiveTextProvider.class));

    List<ProviderInfo<MessageBodyWriter<?>>> writers = pf.getMessageWriters();

    assertTrue(indexOf(writers, TestStringProvider.class)
               < indexOf(writers, PrimitiveTextProvider.class));

}
 
Example #8
Source File: ProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
public <T> ParamConverter<T> createParameterHandler(Class<T> paramType,
                                                    Type genericType,
                                                    Annotation[] anns,
                                                    Message m) {

    anns = anns != null ? anns : new Annotation[]{};
    for (ProviderInfo<ParamConverterProvider> pi : paramConverters) {
        injectContextValues(pi, m);
        ParamConverter<T> converter = pi.getProvider().getConverter(paramType, genericType, anns);
        if (converter != null) {
            return converter;
        }
        pi.clearThreadLocalProxies();
    }
    return null;
}
 
Example #9
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateMessageBodyReaderInterceptorWithReaderInterceptor() throws Exception {
    ReaderInterceptor ri = readerInterceptorContext -> readerInterceptorContext.proceed();
    ProviderInfo<ReaderInterceptor> pi = new ProviderInfo<>(ri, null, true);

    ServerProviderFactory spf = ServerProviderFactory.getInstance();
    spf.readerInterceptors.put(new ProviderFactory.NameKey("org.apache.cxf.filter.binding", 1, ri.getClass()), pi);

    final Message message = prepareMessage(MediaType.APPLICATION_XML, MediaType.APPLICATION_XML);

    List<ReaderInterceptor> interceptors =
        spf.createMessageBodyReaderInterceptor(Book.class, Book.class,
                                               new Annotation[0], MediaType.APPLICATION_XML_TYPE,
                                               message, true, null);
    assertSame(2, interceptors.size());
}
 
Example #10
Source File: ProviderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> ContextProvider<T> createContextProvider(Type contextType,
                                                    Message m) {
    Class<?> contextCls = InjectionUtils.getActualType(contextType);
    if (contextCls == null) {
        return null;
    }
    for (ProviderInfo<ContextProvider<?>> cr : contextProviders) {
        Type[] types = cr.getProvider().getClass().getGenericInterfaces();
        for (Type t : types) {
            if (t instanceof ParameterizedType) {
                ParameterizedType pt = (ParameterizedType)t;
                Type[] args = pt.getActualTypeArguments();
                if (args.length > 0) {
                    Class<?> argCls = InjectionUtils.getActualType(args[0]);

                    if (argCls != null && argCls.isAssignableFrom(contextCls)) {
                        return (ContextProvider<T>)cr.getProvider();
                    }
                }
            }
        }
    }
    return null;
}
 
Example #11
Source File: JAXRSUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static void runContainerResponseFilters(ServerProviderFactory pf,
                                               ResponseImpl r,
                                               Message m,
                                               OperationResourceInfo ori,
                                               Method invoked) throws IOException, Throwable {
    List<ProviderInfo<ContainerResponseFilter>> containerFilters =
        pf.getContainerResponseFilters(ori == null ? null : ori.getNameBindings());
    if (!containerFilters.isEmpty()) {
        ContainerRequestContext requestContext =
            new ContainerRequestContextImpl(m.getExchange().getInMessage(),
                                           false,
                                           true);
        ContainerResponseContext responseContext =
            new ContainerResponseContextImpl(r, m,
                ori == null ? null : ori.getClassResourceInfo().getServiceClass(), invoked);
        for (ProviderInfo<ContainerResponseFilter> filter : containerFilters) {
            InjectionUtils.injectContexts(filter.getProvider(), filter, m);
            filter.getProvider().filter(requestContext, responseContext);
        }
    }
}
 
Example #12
Source File: JAXRSUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static boolean runContainerRequestFilters(ServerProviderFactory pf,
                                                 Message m,
                                                 boolean preMatch,
                                                 Set<String> names) throws IOException {
    List<ProviderInfo<ContainerRequestFilter>> containerFilters = preMatch
        ? pf.getPreMatchContainerRequestFilters() : pf.getPostMatchContainerRequestFilters(names);
    if (!containerFilters.isEmpty()) {
        ContainerRequestContext context = new ContainerRequestContextImpl(m, preMatch, false);
        for (ProviderInfo<ContainerRequestFilter> filter : containerFilters) {
            InjectionUtils.injectContexts(filter.getProvider(), filter, m);
            filter.getProvider().filter(context);
            Response response = m.getExchange().get(Response.class);
            if (response != null) {
                setMessageContentType(m, response);
                return true;
            }
        }
    }
    return false;
}
 
Example #13
Source File: ServiceReferenceProviderInfoComparator.java    From aries-jax-rs-whiteboard with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public int compare(ProviderInfo<?> pi1, ProviderInfo<?> pi2) {
    if (pi1 instanceof ServiceReferenceFilterProviderInfo<?>) {
        if (pi2 instanceof ServiceReferenceFilterProviderInfo<?>) {
            CachingServiceReference serviceReference1 =
                ((ServiceReferenceFilterProviderInfo) pi1).
                    getServiceReference();
            CachingServiceReference serviceReference2 =
                ((ServiceReferenceFilterProviderInfo) pi2).
                    getServiceReference();

            return serviceReference2.compareTo(serviceReference1);
        }
        else {
            return -1;
        }
    }
    else {
        if (pi2 instanceof ServiceReferenceFilterProviderInfo<?>) {
            return 1;
        }
    }

    return _providerInfoClassComparator.compare(pi1, pi2);
}
 
Example #14
Source File: ClientProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected void setProviders(boolean custom, boolean busGlobal, Object... providers) {
    List<ProviderInfo<? extends Object>> theProviders =
        prepareProviders(custom, busGlobal, providers, null);
    super.setCommonProviders(theProviders);
    for (ProviderInfo<? extends Object> provider : theProviders) {
        Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider.getProvider());
        if (providerCls == Object.class) {
            // If the provider is a lambda, ClassHelper.getRealClass returns Object.class
            providerCls = provider.getProvider().getClass();
        }
        if (filterContractSupported(provider, providerCls, ClientRequestFilter.class)) {
            addProviderToList(clientRequestFilters, provider);
        }

        if (filterContractSupported(provider, providerCls, ClientResponseFilter.class)) {
            addProviderToList(clientResponseFilters, provider);
        }

        if (ResponseExceptionMapper.class.isAssignableFrom(providerCls)) {
            addProviderToList(responseExceptionMappers, provider);
        }

        if (RxInvokerProvider.class.isAssignableFrom(providerCls)) {
            this.rxInvokerProvider = RxInvokerProvider.class.cast(provider.getProvider());
        }
    }
    Collections.sort(clientRequestFilters,
                     new BindingPriorityComparator(ClientRequestFilter.class, true));
    Collections.sort(clientResponseFilters,
                     new BindingPriorityComparator(ClientResponseFilter.class, false));

    injectContextProxies(responseExceptionMappers, clientRequestFilters, clientResponseFilters);
}
 
Example #15
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomProviderSortingWithBus2() {
    WildcardReader wc1 = new WildcardReader();
    WildcardReader2 wc2 = new WildcardReader2();
    Bus bus = BusFactory.newInstance().createBus();
    bus.setProperty(MessageBodyReader.class.getName(), wc2);
    ProviderFactory pf = ServerProviderFactory.createInstance(bus);
    pf.registerUserProvider(wc1);
    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
    assertEquals(11, readers.size());
    assertSame(wc1, readers.get(7).getProvider());
    assertSame(wc2, readers.get(8).getProvider());
}
 
Example #16
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomProviderSorting2() {
    ProviderFactory pf = ServerProviderFactory.getInstance();
    Comparator<Object> comp = new Comparator<Object>() {

        @Override
        public int compare(Object provider1, Object provider2) {
            if (provider1 instanceof StringTextProvider) {
                return 1;
            } else if (provider2 instanceof StringTextProvider) {
                return -1;
            } else {
                return 0;
            }
        }

    };
    pf.setProviderComparator(comp);

    // writers
    List<ProviderInfo<MessageBodyWriter<?>>> writers = pf.getMessageWriters();
    assertEquals(10, writers.size());
    Object lastWriter = writers.get(9).getProvider();
    assertTrue(lastWriter instanceof StringTextProvider);
    //readers
    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
    assertEquals(9, readers.size());
    Object lastReader = readers.get(8).getProvider();
    assertTrue(lastReader instanceof StringTextProvider);
}
 
Example #17
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomProviderSortingWIOnly() {
    ProviderFactory pf = ServerProviderFactory.getInstance();

    pf.setUserProviders(
        Arrays.asList(
            new DWriterInterceptor(), new CWriterInterceptor(),
            new AWriterInterceptor(), new BWriterInterceptor()));

    Comparator<ProviderInfo<WriterInterceptor>> comp =
        new Comparator<ProviderInfo<WriterInterceptor>>() {

            @Override
            public int compare(
                ProviderInfo<WriterInterceptor> o1,
                ProviderInfo<WriterInterceptor> o2) {

                WriterInterceptor provider1 = o1.getProvider();
                WriterInterceptor provider2 = o2.getProvider();

                return provider1.getClass().getName().compareTo(
                    provider2.getClass().getName());
            }

        };

    pf.setProviderComparator(comp);

    Collection<ProviderInfo<WriterInterceptor>> values =
        pf.writerInterceptors.values();

    assertEquals(4, values.size());

    Iterator<ProviderInfo<WriterInterceptor>> iterator = values.iterator();

    assertEquals(AWriterInterceptor.class, iterator.next().getProvider().getClass());
    assertEquals(BWriterInterceptor.class, iterator.next().getProvider().getClass());
    assertEquals(CWriterInterceptor.class, iterator.next().getProvider().getClass());
    assertEquals(DWriterInterceptor.class, iterator.next().getProvider().getClass());
}
 
Example #18
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomProviderSortingMBWOnly() {
    ProviderFactory pf = ServerProviderFactory.getInstance();
    Comparator<ProviderInfo<MessageBodyWriter<?>>> comp =
        new Comparator<ProviderInfo<MessageBodyWriter<?>>>() {

        @Override
        public int compare(ProviderInfo<MessageBodyWriter<?>> o1, ProviderInfo<MessageBodyWriter<?>> o2) {
            MessageBodyWriter<?> provider1 = o1.getProvider();
            MessageBodyWriter<?> provider2 = o2.getProvider();
            if (provider1 instanceof StringTextProvider) {
                return 1;
            } else if (provider2 instanceof StringTextProvider) {
                return -1;
            } else {
                return 0;
            }
        }

    };
    pf.setProviderComparator(comp);

    // writers
    List<ProviderInfo<MessageBodyWriter<?>>> writers = pf.getMessageWriters();
    assertEquals(10, writers.size());
    Object lastWriter = writers.get(9).getProvider();
    assertTrue(lastWriter instanceof StringTextProvider);
    //readers
    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
    assertEquals(9, readers.size());
    Object lastReader = readers.get(8).getProvider();
    assertFalse(lastReader instanceof StringTextProvider);
}
 
Example #19
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Test
public void testCustomProviderSortingMBROnly() {
    ProviderFactory pf = ServerProviderFactory.getInstance();
    Comparator<ProviderInfo<MessageBodyReader>> comp =
        new Comparator<ProviderInfo<MessageBodyReader>>() {

        @Override
        public int compare(ProviderInfo<MessageBodyReader> o1, ProviderInfo<MessageBodyReader> o2) {
            MessageBodyReader<?> provider1 = o1.getProvider();
            MessageBodyReader<?> provider2 = o2.getProvider();
            if (provider1 instanceof StringTextProvider) {
                return 1;
            } else if (provider2 instanceof StringTextProvider) {
                return -1;
            } else {
                return 0;
            }
        }

    };
    pf.setProviderComparator(comp);

    // writers
    List<ProviderInfo<MessageBodyWriter<?>>> writers = pf.getMessageWriters();
    assertEquals(10, writers.size());
    Object lastWriter = writers.get(8).getProvider();
    assertFalse(lastWriter instanceof StringTextProvider);
    //readers
    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
    assertEquals(9, readers.size());
    Object lastReader = readers.get(8).getProvider();
    assertTrue(lastReader instanceof StringTextProvider);
}
 
Example #20
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCustomProviderSortingWithBus() {
    WildcardReader wc1 = new WildcardReader();
    WildcardReader2 wc2 = new WildcardReader2();
    Bus bus = BusFactory.newInstance().createBus();
    bus.setProperty(MessageBodyReader.class.getName(), wc1);
    ProviderFactory pf = ServerProviderFactory.createInstance(bus);
    pf.registerUserProvider(wc2);
    List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
    assertEquals(11, readers.size());
    assertSame(wc2, readers.get(7).getProvider());
    assertSame(wc1, readers.get(8).getProvider());
}
 
Example #21
Source File: MicroProfileClientProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public List<ResponseExceptionMapper<?>> createResponseExceptionMapper(Message m, Class<?> paramType) {

        if (responseExceptionMappers.isEmpty()) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(responseExceptionMappers
                                            .stream()
                                            .map(ProviderInfo::getProvider)
                                            .sorted(new ResponseExceptionMapperComparator())
                                            .collect(Collectors.toList()));
    }
 
Example #22
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Integer getPriority(Collection<?> list, Class<?> cls, Class<?> filterClass) {
    Collection<ProviderInfo<?>> list2 = CastUtils.cast(list);
    for (ProviderInfo<?> p : list2) {
        if (p instanceof FilterProviderInfo) {
            Class<?> pClass = ClassHelper.getRealClass(p.getBus(), p.getProvider());
            if (cls.isAssignableFrom(pClass)) {
                return ((FilterProviderInfo<?>)p).getPriority(filterClass);
            }
        }
    }
    return Priorities.USER;
}
 
Example #23
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isRegistered(Collection<?> list, Class<?> cls) {
    Collection<ProviderInfo<?>> list2 = CastUtils.cast(list);
    for (ProviderInfo<?> p : list2) {
        Class<?> pClass = ClassHelper.getRealClass(p.getBus(), p.getProvider());
        if (cls.isAssignableFrom(pClass)) {
            return true;
        }
    }
    return false;
}
 
Example #24
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isRegistered(Collection<?> list, Object o) {
    Collection<ProviderInfo<?>> list2 = CastUtils.cast(list);
    for (ProviderInfo<?> pi : list2) {
        if (pi.getProvider() == o) {
            return true;
        }
    }
    return false;
}
 
Example #25
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addContainerRequestFilter(
    List<ProviderInfo<ContainerRequestFilter>> postMatchFilters,
    ProviderInfo<ContainerRequestFilter> p) {
    ContainerRequestFilter filter = p.getProvider();
    if (isWadlGenerator(filter.getClass())) {
        wadlGenerator = p;
    } else {
        if (isPrematching(filter.getClass())) {
            addProviderToList(preMatchContainerRequestFilters, p);
        } else {
            postMatchFilters.add(p);
        }
    }

}
 
Example #26
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected void injectContextValues(ProviderInfo<?> pi, Message m) {
    if (m != null) {
        InjectionUtils.injectContexts(pi.getProvider(), pi, m);
        if (application != null && application.contextsAvailable()) {
            InjectionUtils.injectContexts(application.getProvider(), application, m);
        }
    }
}
 
Example #27
Source File: ProviderFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private int indexOf(List<? extends Object> providerInfos, Class<?> providerType) {
    int index = 0;
    for (Object pi : providerInfos) {
        Object p = ((ProviderInfo<?>)pi).getProvider();
        if (p.getClass().isAssignableFrom(providerType)) {
            break;
        }
        index++;
    }
    return index;
}
 
Example #28
Source File: ProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected List<ProviderInfo<? extends Object>> prepareProviders(boolean custom,
                                                                boolean busGlobal,
                                                                Object[] providers,
                                                                ProviderInfo<Application> application) {
    List<ProviderInfo<? extends Object>> theProviders =
        new ArrayList<>(providers.length);
    for (Object o : providers) {
        if (o == null) {
            continue;
        }
        Object provider = o;
        if (provider.getClass() == Class.class) {
            provider = ResourceUtils.createProviderInstance((Class<?>)provider);
        }
        if (provider instanceof Constructor) {
            Map<Class<?>, Object> values = CastUtils.cast(application == null ? null
                : Collections.singletonMap(Application.class, application.getProvider()));
            theProviders.add(
                createProviderFromConstructor((Constructor<?>)provider, values, getBus(), true, custom));
        } else if (provider instanceof ProviderInfo) {
            theProviders.add((ProviderInfo<?>)provider);
        } else {
            ProviderInfo<Object> theProvider = new ProviderInfo<>(provider, getBus(), custom);
            theProvider.setBusGlobal(busGlobal);
            theProviders.add(theProvider);
        }
    }
    return theProviders;
}
 
Example #29
Source File: MPAsyncInvocationInterceptorImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
MPAsyncInvocationInterceptorImpl(Message message) {
    super(Phase.POST_MARSHAL);

    MicroProfileClientProviderFactory factory = MicroProfileClientProviderFactory.getInstance(message);
    List<ProviderInfo<Object>> aiiProviderList = 
        factory.getAsyncInvocationInterceptorFactories();

    for (ProviderInfo<Object> providerInfo: aiiProviderList) {
        AsyncInvocationInterceptor aiInterceptor = 
            ((AsyncInvocationInterceptorFactory) providerInfo.getProvider()).newInterceptor();
        interceptors.add(0, aiInterceptor); // sort in reverse order
    }
}
 
Example #30
Source File: ProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected static Set<String> getFilterNameBindings(ProviderInfo<?> p) {
    if (p instanceof FilterProviderInfo) {
        return ((FilterProviderInfo<?>)p).getNameBindings();
    } else {
        return getFilterNameBindings(p.getBus(), p.getProvider());
    }

}