Java Code Examples for org.apache.cxf.Bus#getProperty()

The following examples show how to use org.apache.cxf.Bus#getProperty() . These examples are extracted from open source projects. 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 Project: cxf   File: AbstractResourceInfo.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public static void clearAllMaps() {
    Bus bus = BusFactory.getThreadDefaultBus(false);
    if (bus != null) {
        Object property = bus.getProperty(FIELD_PROXY_MAP);
        if (property != null) {
            ((Map)property).clear();
        }
        property = bus.getProperty(SETTER_PROXY_MAP);
        if (property != null) {
            ((Map)property).clear();
        }
        property = bus.getProperty(CONSTRUCTOR_PROXY_MAP);
        if (property != null) {
            ((Map)property).clear();
        }
    }
}
 
Example 2
Source Project: cxf   File: SseProvidersExtension.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void busCreated(Bus bus) {
    Object providers = bus.getProperty(BUS_PROVIDERS);
    
    final List<?> sseProviders = 
        Arrays.asList(
            new SseContextProvider(), 
            new SseEventSinkContextProvider()
        );
    
    if (providers instanceof List) {
        final List<?> existing = new ArrayList<>((List<?>)providers);
        existing.addAll(CastUtils.cast(sseProviders));
        bus.setProperty(BUS_PROVIDERS, existing);
    } else {
        bus.setProperty(BUS_PROVIDERS, sseProviders);
    }
    
    bus.getInInterceptors().add(new SseInterceptor());
}
 
Example 3
Source Project: cxf   File: AtmosphereUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static void addInterceptors(AtmosphereFramework framework, Bus bus) {
    Object ais = bus.getProperty("atmosphere.interceptors");
    // pre-install those atmosphere default interceptors before the custom interceptors.
    framework.interceptor(new CacheHeadersInterceptor()).interceptor(new HeartbeatInterceptor())
    .interceptor(new SSEAtmosphereInterceptor()).interceptor(new JavaScriptProtocol());

    if (ais == null || ais instanceof AtmosphereInterceptor) {
        framework.interceptor(ais == null
            ? new DefaultProtocolInterceptor() : (AtmosphereInterceptor)ais);
        return;
    }
    if (ais instanceof List<?>) {
        List<AtmosphereInterceptor> icps = CastUtils.cast((List<?>)ais);
        // add the custom interceptors
        for (AtmosphereInterceptor icp : icps) {
            framework.interceptor(icp);
        }
    }
}
 
Example 4
Source Project: cxf   File: ProviderFactory.java    License: Apache License 2.0 5 votes vote down vote up
protected static ProviderCache initCache(Bus theBus) {
    Object allowProp = theBus.getProperty(PROVIDER_CACHE_ALLOWED);
    boolean allowed = allowProp == null || PropertyUtils.isTrue(allowProp);
    if (!allowed) {
        return null;
    }
    boolean checkAll = PropertyUtils.isTrue(theBus.getProperty(PROVIDER_CACHE_CHECK_ALL));
    return new ProviderCache(checkAll);
}
 
Example 5
Source Project: cxf   File: InstrumentationManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
private static boolean getBusProperty(Bus b, String key, boolean dflt) {
    Object v = b.getProperty(key);
    if (v instanceof Boolean) {
        return (Boolean)v;
    }
    return v != null ? Boolean.valueOf(v.toString()) : dflt;
}
 
Example 6
Source Project: cxf   File: JettyHTTPServerEngine.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldCheckUrl(Bus bus) {

        Object prop = null;
        if (bus != null) {
            prop = bus.getProperty(DO_NOT_CHECK_URL_PROP);
        }
        if (prop == null) {
            prop = SystemPropertyAction.getPropertyOrNull(DO_NOT_CHECK_URL_PROP);
        }
        return !PropertyUtils.isTrue(prop);
    }
 
Example 7
Source Project: cxf   File: UndertowHTTPServerEngine.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldCheckUrl(Bus bus) {

        Object prop = null;
        if (bus != null) {
            prop = bus.getProperty(DO_NOT_CHECK_URL_PROP);
        }
        if (prop == null) {
            prop = SystemPropertyAction.getPropertyOrNull(DO_NOT_CHECK_URL_PROP);
        }
        return !PropertyUtils.isTrue(prop);
    }
 
Example 8
Source Project: cxf   File: UndertowHTTPServerEngine.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldEnableHttp2(Bus bus) {

        Object prop = null;
        if (bus != null) {
            prop = bus.getProperty(ENABLE_HTTP2_PROP);
        }
        if (prop == null) {
            prop = SystemPropertyAction.getPropertyOrNull(ENABLE_HTTP2_PROP);
        }
        return PropertyUtils.isTrue(prop);
    }
 
Example 9
Source Project: cxf   File: ClassHelper.java    License: Apache License 2.0 5 votes vote down vote up
private static ClassUnwrapper getContextClassUnwrapper(Bus bus) {
    if (bus != null && bus.getProperty(ClassUnwrapper.class.getName()) != null) {
        ClassUnwrapper unwrapper = (ClassUnwrapper) bus.getProperty(ClassUnwrapper.class.getName());
        return unwrapper;
    }

    return (DEFAULT_UNWRAPPER == UNWRAPPER || checkUseDefaultClassHelper(bus)) ? DEFAULT_UNWRAPPER : UNWRAPPER;
}
 
Example 10
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 11
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 12
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 13
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 14
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 15
Source Project: cxf   File: InstrumentationManagerImpl.java    License: Apache License 2.0 4 votes vote down vote up
private static String getBusProperty(Bus b, String key, String dflt) {
    String v = (String)b.getProperty(key);
    return v != null ? v : dflt;
}
 
Example 16
Source Project: cxf   File: CachedOutputStream.java    License: Apache License 2.0 4 votes vote down vote up
private static String getBusProperty(Bus b, String key, String dflt) {
    String v = (String)b.getProperty(key);
    return v != null ? v : dflt;
}
 
Example 17
Source Project: cxf   File: CachedWriter.java    License: Apache License 2.0 4 votes vote down vote up
private static String getBusProperty(Bus b, String key, String dflt) {
    String v = (String)b.getProperty(key);
    return v != null ? v : dflt;
}