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

The following examples show how to use org.apache.cxf.Bus#getProperty() . 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: AbstractResourceInfo.java    From cxf with 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 File: SseProvidersExtension.java    From cxf with 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 File: AtmosphereUtils.java    From cxf with 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 File: ClassHelper.java    From cxf with 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 5
Source File: ProviderFactory.java    From cxf with 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 6
Source File: UndertowHTTPServerEngine.java    From cxf with 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 7
Source File: UndertowHTTPServerEngine.java    From cxf with 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 File: InstrumentationManagerImpl.java    From cxf with 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 9
Source File: JettyHTTPServerEngine.java    From cxf with 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 10
Source File: CachedWriter.java    From cxf with 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 11
Source File: UsernameTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 12
Source File: CachedOutputStream.java    From cxf with 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 13
Source File: InstrumentationManagerImpl.java    From cxf with 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 14
Source File: UsernameTokenInterceptorProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 15
Source File: UsernameTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 16
Source File: UsernameTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}
 
Example 17
Source File: UsernameTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public UsernameTokenInterceptorProvider(Bus bus) {
    this((UsernameTokenInterceptor)
         bus.getProperty("org.apache.cxf.ws.security.usernametoken.interceptor"));
}