org.apache.cxf.common.util.ClassUnwrapper Java Examples

The following examples show how to use org.apache.cxf.common.util.ClassUnwrapper. 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: MeecrowaveBus.java    From openwebbeans-meecrowave with Apache License 2.0 6 votes vote down vote up
@Inject
public MeecrowaveBus(final ServletContext context) {
    final ClassLoader appLoader = context.getClassLoader();

    final Meecrowave meecrowave = Meecrowave.class.cast(context.getAttribute("meecrowave.instance"));
    final Configuration builder = Configuration.class.cast(context.getAttribute("meecrowave.configuration"));
    if (meecrowave.getClientBus() == null) {
        delegate = new ConfigurableBus();
        if (builder != null && builder.isJaxrsProviderSetup()) {
            delegate.initProviders(builder, appLoader);
        }
    } else {
        delegate = meecrowave.getClientBus();
        if (builder != null && !builder.isInitializeClientBus() && builder.isJaxrsProviderSetup()) {
            delegate.initProviders(builder, appLoader);
        }
    }

    setProperty(ClassUnwrapper.class.getName(), this);
    setExtension(appLoader, ClassLoader.class); // ServletController locks on the classloader otherwise
}
 
Example #2
Source File: CdiBusBean.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public ExtensionManagerBus create(final CreationalContext< ExtensionManagerBus > ctx) {
    final ExtensionManagerBus instance = injectionTarget.produce(ctx);
    if ("true".equals(SystemPropertyAction.getProperty("org.apache.cxf.cdi.unwrap.proxies", "true"))) {
        instance.setProperty(ClassUnwrapper.class.getName(), new CdiClassUnwrapper());
    }
    BusFactory.possiblySetDefaultBus(instance);
    instance.initialize();

    injectionTarget.inject(instance, ctx);
    injectionTarget.postConstruct(instance);
    return instance;
}
 
Example #3
Source File: ClassUnwrapperTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testProxyClassIsProperlyUnwrapped() {
    final BookStorePreMatchingRequestFilter filter = getBeanReference(BookStorePreMatchingRequestFilter.class);
    final ClassUnwrapper unwrapper = (ClassUnwrapper)bus.getProperty(ClassUnwrapper.class.getName());
    
    assertThat(unwrapper, notNullValue());
    assertThat(filter.getClass(), not(equalTo(BookStorePreMatchingRequestFilter.class)));
    assertThat(unwrapper.getRealClass(filter), equalTo(BookStorePreMatchingRequestFilter.class));
}
 
Example #4
Source File: ClassUnwrapperTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRealClassIsProperlyUnwrapped() {
    final BookStoreRequestFilter filter = getBeanReference(BookStoreRequestFilter.class);
    final ClassUnwrapper unwrapper = (ClassUnwrapper)bus.getProperty(ClassUnwrapper.class.getName());
    
    assertThat(unwrapper, notNullValue());
    assertThat(filter.getClass(), equalTo(BookStoreRequestFilter.class));
    assertThat(unwrapper.getRealClass(filter), equalTo(BookStoreRequestFilter.class));
}
 
Example #5
Source File: ClassUnwrapperTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testProxyClassIsProperlyUnwrapped() {
    final BookStorePreMatchingRequestFilter filter = getBeanReference(BookStorePreMatchingRequestFilter.class);
    final ClassUnwrapper unwrapper = (ClassUnwrapper)bus.getProperty(ClassUnwrapper.class.getName());
    
    assertThat(unwrapper, notNullValue());
    assertThat(filter.getClass(), not(equalTo(BookStorePreMatchingRequestFilter.class)));
    assertThat(unwrapper.getRealClass(filter), equalTo(BookStorePreMatchingRequestFilter.class));
}
 
Example #6
Source File: ClassUnwrapperTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRealClassIsProperlyUnwrapped() {
    final BookStoreRequestFilter filter = getBeanReference(BookStoreRequestFilter.class);
    final ClassUnwrapper unwrapper = (ClassUnwrapper)bus.getProperty(ClassUnwrapper.class.getName());
    
    assertThat(unwrapper, notNullValue());
    assertThat(filter.getClass(), equalTo(BookStoreRequestFilter.class));
    assertThat(unwrapper.getRealClass(filter), equalTo(BookStoreRequestFilter.class));
}