use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class SelectableEntityFilteringFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(SelectableEntityProcessor.class)) {
// register EntityFilteringFeature
if (!config.isRegistered(EntityFilteringFeature.class)) {
context.register(EntityFilteringFeature.class);
}
// Entity Processors.
context.register(SelectableEntityProcessor.class);
// Scope Resolver.
context.register(SelectableScopeResolver.class);
return true;
}
return true;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class ValidationFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
// Validation disabled?
if (PropertiesHelper.isProperty(config.getProperty(ServerProperties.BV_FEATURE_DISABLE))) {
return false;
}
context.register(new ValidationBinder());
// when ServerProperties.BV_SEND_ERROR_IN_RESPONSE is enabled.
if (PropertiesHelper.isProperty(config.getProperty(ServerProperties.BV_SEND_ERROR_IN_RESPONSE)) && config.getProperty(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR) == null) {
context.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, true);
}
return true;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class MvcFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(ErrorTemplateExceptionMapper.class)) {
context.register(ErrorTemplateExceptionMapper.class);
context.register(new MvcBinder());
return true;
}
return false;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class MustacheMvcFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(MustacheTemplateProcessor.class)) {
// Template Processor.
Configuration configuration = injectionManager.getInstance(Configuration.class);
ServletContext servletContext = injectionManager.getInstance(ServletContext.class);
context.register(new MustacheTemplateProcessor(configuration, servletContext, injectionManager::createAndInitialize));
// MvcFeature.
if (!config.isRegistered(MvcFeature.class)) {
context.register(MvcFeature.class);
}
return true;
}
return false;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class MoxyJsonFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (CommonProperties.getValue(config.getProperties(), config.getRuntimeType(), CommonProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.FALSE, Boolean.class)) {
return false;
}
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);
// Set a slightly lower priority of workers than JSON-P so MOXy is not pick-ed up for JsonStructures (if both are used).
final int workerPriority = Priorities.USER + 2000;
if (EntityFilteringFeature.enabled(config)) {
context.register(MoxyFilteringFeature.class);
context.register(FilteringMoxyJsonProvider.class, workerPriority);
} else {
context.register(ConfigurableMoxyJsonProvider.class, workerPriority);
}
return true;
}
Aggregations