use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class FreemarkerMvcFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(FreemarkerViewProcessor.class)) {
// Template Processor.
Configuration configuration = injectionManager.getInstance(Configuration.class);
ServletContext servletContext = injectionManager.getInstance(ServletContext.class);
context.register(new FreemarkerViewProcessor(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 DeclarativeLinkingFeature method configure.
@Override
public boolean configure(FeatureContext context) {
Configuration config = context.getConfiguration();
if (!config.isRegistered(ResponseLinkFilter.class)) {
context.register(new AbstractBinder() {
@Override
protected void configure() {
bindAsContract(NaiveResourceMappingContext.class).to(ResourceMappingContext.class).in(Singleton.class);
}
});
context.register(ResponseLinkFilter.class);
// context.register(RequestLinkFilter.class);
return true;
}
return false;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class EntityFilteringFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(EntityFilteringProcessor.class)) {
// Binder (FilteringObjectProvider/FilteringGraphTransformer).
if (!config.isRegistered(EntityFilteringBinder.class)) {
context.register(new EntityFilteringBinder());
}
// Entity Processors.
context.register(EntityFilteringProcessor.class);
if (!config.isRegistered(DefaultEntityProcessor.class)) {
context.register(DefaultEntityProcessor.class);
}
// Scope Providers.
context.register(EntityFilteringScopeResolver.class);
// Scope Resolver.
if (RuntimeType.SERVER == config.getRuntimeType()) {
context.register(ServerScopeProvider.class);
} else {
context.register(CommonScopeProvider.class);
}
return true;
}
return false;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class Jackson1Feature method configure.
@Override
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);
// add the default Jackson exception mappers
context.register(JsonParseExceptionMapper.class);
context.register(JsonMappingExceptionMapper.class);
context.register(JacksonJaxbJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
return true;
}
use of javax.ws.rs.core.Configuration in project jersey by jersey.
the class JettisonFeature method configure.
@Override
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);
for (final Class<?> provider : PROVIDERS) {
context.register(provider, MessageBodyReader.class, MessageBodyWriter.class);
}
return true;
}
Aggregations