Refine search
@Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { final Class<?> resourceClass = resourceInfo.getResourceClass(); final Method resourceMethod = resourceInfo.getResourceMethod(); if (serverStatus.hasCapability(ServerStatus.Capability.MASTER)) return; if (resourceMethod.isAnnotationPresent(RestrictToMaster.class) || resourceClass.isAnnotationPresent(RestrictToMaster.class)) { context.register(restrictToMasterFilter); } } }
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); // Register FastJson. if (!config.isRegistered(FastJsonFeature.class) && autoDiscover) { context.register(FastJsonFeature.class); } } }
@Override public boolean configure(final FeatureContext context) { try { final Configuration config = context.getConfiguration(); config.getProperties() , config.getRuntimeType() , InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class context.property( PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()) , JSON_FEATURE); if (!config.isRegistered(FastJsonProvider.class)) { context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
@Override public boolean configure(final FeatureContext context) { context.register(OAuth1SignatureFeature.class); context.register(OAuth1ClientFilter.class); context.property(OAuth1ClientSupport.OAUTH_PROPERTY_OAUTH_PARAMETERS, parameters); context.property(OAuth1ClientSupport.OAUTH_PROPERTY_OAUTH_SECRETS, secrets); return true; } }
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); if (context.getConfiguration().isRegistered(SseFeature.class)) { return; } if (!PropertiesHelper.getValue( config.getProperties(), config.getRuntimeType(), SseFeature.DISABLE_SSE, Boolean.FALSE, Boolean.class, null)) { context.register(SseFeature.class); } } }
@Override public boolean configure(FeatureContext context) { final boolean disabled = PropertiesHelper.isProperty(context.getConfiguration().getProperty(ServerProperties .WADL_FEATURE_DISABLE)); if (disabled) { return false; } context.register(WadlModelProcessor.class); context.register(new AbstractBinder() { @Override protected void configure() { bind(WadlApplicationContextImpl.class).to(WadlApplicationContext.class).in(Singleton.class); } }); return true; } }
@Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { if (resourceInfo.getResourceMethod().getAnnotation(DateRequired.class) != null) { context.register(DateNotSpecifiedFilter.class); } } }
@Override public void configure(ResourceInfo resourceInfo, FeatureContext configurable) { @SuppressWarnings("rawtypes") final Class declaring = resourceInfo.getResourceClass(); final Method method = resourceInfo.getResourceMethod(); if (declaring == null || method == null) return; Set<String> encodings = getEncodings(method.getAnnotations()); if (encodings.size() <= 0) { encodings = getEncodings(declaring.getAnnotations()); if (encodings.size() <= 0) return; } // check if GZIP encoder has been registered if (!isGZipRegistered(configurable.getConfiguration())) { encodings.remove("gzip"); } configurable.register(createFilter(encodings)); }
@Override public boolean configure(final FeatureContext context) { final RuntimeType runtime = context.getConfiguration().getRuntimeType(); if (RuntimeType.SERVER.equals(runtime)) { context.register(FormDataParamInjectionFeature.class); context.register(MultiPartReaderServerSide.class); } else { context.register(MultiPartReaderClientSide.class); } context.register(MultiPartWriter.class); return true; } }
@Override public boolean configure(FeatureContext context) { if (useEncoding != null) { // properties take precedence over the constructor value if (!context.getConfiguration().getProperties().containsKey(ClientProperties.USE_ENCODING)) { context.property(ClientProperties.USE_ENCODING, useEncoding); } } for (Class<?> provider : encodingProviders) { context.register(provider); } boolean enable = useEncoding != null || encodingProviders.length > 0; if (enable) { context.register(EncodingFilter.class); } return enable; } }
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); // UriConnegFilter. final Object languageMappings = config.getProperty(ServerProperties.LANGUAGE_MAPPINGS); final Object mediaTypesMappings = config.getProperty(ServerProperties.MEDIA_TYPE_MAPPINGS); if (!config.isRegistered(UriConnegFilter.class) && (languageMappings != null || mediaTypesMappings != null)) { context.register(UriConnegFilter.class); } } }
public boolean configure(FeatureContext context) { context.register(JsonParseExceptionMapper.class); context.register(JsonMappingExceptionMapper.class); context.register(JacksonJsonProviderAtRest.class, MessageBodyReader.class, MessageBodyWriter.class); final Configuration config = context.getConfiguration(); context.property( PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE);
@Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { if (DynamicallyBoundInterceptorResource.class == resourceInfo.getResourceClass()) { context.register(DynamicallyBoundInterceptor.class); } } }
@Override public boolean configure(FeatureContext context) { context.register(new HttpAuthenticationFilter(mode, basicCredentials, digestCredentials, context.getConfiguration())); return true; } }
@Override public Configuration getConfiguration() { return context.getConfiguration(); }
@Override public FeatureContext property(String name, Object value) { return context.property(name, value); }
@Override public boolean configure(final FeatureContext context) { if (CommonProperties.getValue(context.getConfiguration().getProperties(), context.getConfiguration().getRuntimeType(), CommonProperties.JSON_PROCESSING_FEATURE_DISABLE, Boolean.FALSE, Boolean.class)) { return false; } // Make sure JSON-P workers have higher priority than other Json providers (in case there is a need to use JSON-P and some // other provider in an application). context.register(JsonValueBodyReader.class, Priorities.USER + 1000); context.register(JsonValueBodyWriter.class, Priorities.USER + 1000); return true; } }
@Override public boolean configure(FeatureContext context) { final boolean disabled = PropertiesHelper.isProperty(context.getConfiguration().getProperty(ServerProperties .WADL_FEATURE_DISABLE)); if (disabled) { return false; } context.register(WadlModelProcessor.class); context.register(new AbstractBinder() { @Override protected void configure() { bind(WadlApplicationContextImpl.class).to(WadlApplicationContext.class).in(Singleton.class); } }); return true; } }