@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) { boolean enabled = false; if (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) { ClientLoggingFilter clientLoggingFilter = (ClientLoggingFilter) createLoggingFilter(context, RuntimeType.CLIENT); context.register(clientLoggingFilter); enabled = true; } if (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER) { ServerLoggingFilter serverClientFilter = (ServerLoggingFilter) createLoggingFilter(context, RuntimeType.SERVER); context.register(serverClientFilter); enabled = true; } return enabled; }
@Override public void configure(final FeatureContext context) { context.register(new JaxbMessagingBinder()); if (RuntimeType.SERVER == context.getConfiguration().getRuntimeType()) { context.register(new JaxbParamConverterBinder()); } } }
@Override public boolean configure(FeatureContext context) { boolean enabled = false; if (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) { ClientLoggingFilter clientLoggingFilter = (ClientLoggingFilter) createLoggingFilter(context, RuntimeType.CLIENT); context.register(clientLoggingFilter); enabled = true; } if (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER) { ServerLoggingFilter serverClientFilter = (ServerLoggingFilter) createLoggingFilter(context, RuntimeType.SERVER); context.register(serverClientFilter); enabled = true; } return enabled; }
@Override public boolean configure(FeatureContext context) { RuntimeType runtimeType = context.getConfiguration().getRuntimeType(); //register client if (runtimeType == RuntimeType.CLIENT) { context.register(new ClientSecurityFilter()); } else { throw new IllegalStateException( "ClientSecurityFeature is only available for client side Jersey. For servers, please use SecurityFeature"); } return true; } }
@Override public boolean configure(FeatureContext context) { if (!GlobalTracer.isRegistered()) { LOGGER.warning(LocalizationMessages.OPENTRACING_TRACER_NOT_REGISTERED()); } switch (context.getConfiguration().getRuntimeType()) { case CLIENT: context.register(OpenTracingClientRequestFilter.class).register(OpenTracingClientResponseFilter.class); break; case SERVER: context.register(new OpenTracingApplicationEventListener(verbosity)); } return true; }
, config.getRuntimeType() , InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()) , JSON_FEATURE);
@Override public boolean configure(final FeatureContext context) { if (context.getConfiguration().isEnabled(this.getClass())) { return false; } switch (context.getConfiguration().getRuntimeType()) { case CLIENT: context.register(EventInputReader.class); context.register(InboundEventReader.class); break; case SERVER: context.register(OutboundEventWriter.class); context.register(new SseBinder()); context.register(SseEventSinkValueParamProvider.class, ValueParamProvider.class); break; } return true; }
@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; } }
@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); context.register(JsonBindingProvider.class); return true; } }
@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; } }
@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 void configure(final FeatureContext context) { final Map<String, Object> properties = context.getConfiguration().getProperties(); final RuntimeType runtimeType = context.getConfiguration().getRuntimeType(); context.register(new AbstractBinder() { @Override protected void configure() { // Message Body providers. install(new ServiceFinderBinder<MessageBodyReader>(MessageBodyReader.class, properties, runtimeType)); install(new ServiceFinderBinder<MessageBodyWriter>(MessageBodyWriter.class, properties, runtimeType)); // Exception Mappers. install(new ServiceFinderBinder<ExceptionMapper>(ExceptionMapper.class, properties, runtimeType)); } }); } }
@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; }
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); context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()), JSON_FEATURE);
@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 void configure(FeatureContext context) { if (!context.getConfiguration().isRegistered(LoggingFeature.class)) { Map properties = context.getConfiguration().getProperties(); if (commonPropertyConfigured(properties) || (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT && clientConfigured(properties)) || (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER && serverConfigured(properties))) { context.register(LoggingFeature.class); } } }
@Override public void configure(FeatureContext context) { if (!context.getConfiguration().isRegistered(LoggingFeature.class)) { Map properties = context.getConfiguration().getProperties(); if (commonPropertyConfigured(properties) || (context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT && clientConfigured(properties)) || (context.getConfiguration().getRuntimeType() == RuntimeType.SERVER && serverConfigured(properties))) { context.register(LoggingFeature.class); } } }
/** * Enable a buffering of serialized entity. The buffering will be configured from configuration. The property * determining the size of the buffer is {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}. * </p> * The buffering functionality is by default disabled and could be enabled by calling this method. In this case * this method must be called before first bytes are written to the {@link #getEntityStream() entity stream}. * * @param configuration runtime configuration. */ public void enableBuffering(Configuration configuration) { final Integer bufferSize = CommonProperties.getValue(configuration.getProperties(), configuration.getRuntimeType(), CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, Integer.class); if (bufferSize != null) { committingOutputStream.enableBuffering(bufferSize); } else { committingOutputStream.enableBuffering(); } }
/** * Enable a buffering of serialized entity. The buffering will be configured from configuration. The property * determining the size of the buffer is {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}. * </p> * The buffering functionality is by default disabled and could be enabled by calling this method. In this case * this method must be called before first bytes are written to the {@link #getEntityStream() entity stream}. * * @param configuration runtime configuration. */ public void enableBuffering(Configuration configuration) { final Integer bufferSize = CommonProperties.getValue(configuration.getProperties(), configuration.getRuntimeType(), CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, Integer.class); if (bufferSize != null) { committingOutputStream.enableBuffering(bufferSize); } else { committingOutputStream.enableBuffering(); } }