Java Code Examples for javax.ws.rs.core.Configuration#isRegistered()
The following examples show how to use
javax.ws.rs.core.Configuration#isRegistered() .
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: ServiceTalkJacksonSerializerFeature.java From servicetalk with Apache License 2.0 | 6 votes |
@Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); final String jsonFeature = getValue(config.getProperties(), config.getRuntimeType(), JSON_FEATURE, ST_JSON_FEATURE, String.class); // Do not register our JSON feature if another one is already registered if (!ST_JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { LOGGER.warn("Skipping registration of: {} as JSON support is already provided by: {}", ST_JSON_FEATURE, jsonFeature); return false; } // Prevent other not yet registered JSON features to register themselves context.property(getPropertyNameForRuntime(JSON_FEATURE, config.getRuntimeType()), ST_JSON_FEATURE); if (!config.isRegistered(JacksonSerializerMessageBodyReaderWriter.class)) { context.register(SerializationExceptionMapper.class); context.register(JacksonSerializerMessageBodyReaderWriter.class); } return true; }
Example 2
Source File: DACAuthFilterFeature.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public boolean configure(FeatureContext context) { final Configuration configuration = context.getConfiguration(); Boolean disabled = PropertyHelper.getProperty(configuration, RestServerV2.DAC_AUTH_FILTER_DISABLE); // Default is not disabled if (disabled != null && disabled) { return false; } context.register(DACAuthFilter.class); if (!configuration.isRegistered(RolesAllowedDynamicFeature.class)) { context.register(RolesAllowedDynamicFeature.class); } return true; }
Example 3
Source File: ParsecValidationAutoDiscoverable.java From parsec-libraries with Apache License 2.0 | 6 votes |
@Override public void configure(FeatureContext context) { final int priorityInc = 3000; // Jersey MOXY provider have higher priority(7000), so we need set higher than it int priority = Priorities.USER + priorityInc; Configuration config = context.getConfiguration(); if (!config.isRegistered(ParsecValidationExceptionMapper.class)) { context.register(ParsecValidationExceptionMapper.class, priority); } if (!config.isRegistered(ValidationConfigurationContextResolver.class)) { context.register(ValidationConfigurationContextResolver.class, priority); } if (!config.isRegistered(ParsecMoxyFeature.class)) { context.register(ParsecMoxyFeature.class, priority); } if (!config.isRegistered(JaxbExceptionMapper.class)) { context.register(JaxbExceptionMapper.class, priority); } }
Example 4
Source File: SysFilteringFeature.java From ameba with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean configure(FeatureContext context) { Configuration configuration = context.getConfiguration(); if (!configuration.isRegistered(UriConnegFilter.class)) { context.register(UriConnegFilter.class, Priorities.AUTHENTICATION - 100); } if (!context.getConfiguration().isRegistered(DownloadEntityFilter.class)) { context.register(DownloadEntityFilter.class); } if (!configuration.isRegistered(LoadBalancerRequestFilter.class)) { context.register(LoadBalancerRequestFilter.class); } return true; }
Example 5
Source File: EntityFieldsFilteringFeature.java From ameba with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); if (!config.isRegistered(EntityFieldsProcessor.class)) { // register EntityFilteringFeature if (!config.isRegistered(EntityFilteringFeature.class)) { context.register(EntityFilteringFeature.class); } // Entity Processors. context.register(EntityFieldsProcessor.class); // Scope Resolver. context.register(EntityFieldsScopeResolver.class); return true; } return false; }
Example 6
Source File: FastJsonFeature.java From fastjson-jaxrs-json-provider with Apache License 2.0 | 6 votes |
public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class); // Other JSON providers registered. if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { return false; } // Disable other JSON providers. context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE); // Register FastJson. if (!config.isRegistered(FastJsonProvider.class)) { context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class); } return true; }
Example 7
Source File: FastJsonAutoDiscoverable.java From uavstack with Apache License 2.0 | 5 votes |
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); // Register FastJson. if (!config.isRegistered(FastJsonFeature.class) && autoDiscover) { context.register(FastJsonFeature.class); } }
Example 8
Source File: FastJsonFeature.java From uavstack with Apache License 2.0 | 5 votes |
@Override public boolean configure(final FeatureContext context) { try { final Configuration config = context.getConfiguration(); final String jsonFeature = CommonProperties.getValue( config.getProperties() , config.getRuntimeType() , InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class ); // Other JSON providers registered. if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) { return false; } // Disable other JSON providers. context.property( PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()) , JSON_FEATURE); // Register FastJson. if (!config.isRegistered(FastJsonProvider.class)) { context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class); } } catch (NoSuchMethodError e) { // skip } return true; }
Example 9
Source File: JacksonFilteringFeature.java From ameba with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); if (!config.isRegistered(JacksonFilteringFeature.Binder.class)) { context.register(new Binder()); return true; } return false; }
Example 10
Source File: QueryDslFeature.java From ameba with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean configure(FeatureContext context) { Configuration cfg = context.getConfiguration(); if (!cfg.isRegistered(CommonExprTransformer.class)) context.register(CommonExprTransformer.class); if (!cfg.isRegistered(CommonExprArgTransformer.class)) context.register(CommonExprArgTransformer.class); if (!cfg.isRegistered(QuerySyntaxExceptionMapper.class)) context.register(QuerySyntaxExceptionMapper.class); return true; }
Example 11
Source File: CxfTypeSafeClientBuilder.java From cxf with Apache License 2.0 | 5 votes |
@Override public <T> T build(Class<T> aClass) { if (baseUri == null) { throw new IllegalStateException("baseUrl not set"); } Validator.checkValid(aClass); RegisterProvider[] providers = aClass.getAnnotationsByType(RegisterProvider.class); Configuration config = configImpl.getConfiguration(); if (providers != null) { for (RegisterProvider provider : providers) { if (!config.isRegistered(provider.value())) { if (provider.priority() == -1) { register(provider.value()); } else { register(provider.value(), provider.priority()); } } } } register(SseMessageBodyReader.class); listeners().forEach(l -> l.onNewClient(aClass, this)); MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configImpl, baseUri, aClass, executorService, secConfig); return bean.create(aClass); }
Example 12
Source File: Initializer.java From krazo with Apache License 2.0 | 4 votes |
private static boolean isAlreadyInitialized(Configuration config) { return config.isRegistered(ViewResponseFilter.class); }
Example 13
Source File: OzarkInitializer.java From ozark with Apache License 2.0 | 4 votes |
private static boolean isAlreadyInitialized(Configuration config) { return config.isRegistered(ViewResponseFilter.class); }