org.jboss.resteasy.plugins.providers.RegisterBuiltin Java Examples

The following examples show how to use org.jboss.resteasy.plugins.providers.RegisterBuiltin. 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: AbstractStoresTest.java    From alfresco-simple-content-stores with Apache License 2.0 6 votes vote down vote up
/**
 * Configures and constructs a Resteasy client to use for calling the Alfresco Public ReST API in the dockerised deployment.
 *
 * @return the configured client
 */
protected static ResteasyClient setupResteasyClient()
{
    final SimpleModule module = new SimpleModule();
    module.setDeserializerModifier(new RestAPIBeanDeserializerModifier());

    final ResteasyJackson2Provider resteasyJacksonProvider = new ResteasyJackson2Provider();
    final ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(Include.NON_EMPTY);
    mapper.registerModule(module);
    resteasyJacksonProvider.setMapper(mapper);

    final LocalResteasyProviderFactory resteasyProviderFactory = new LocalResteasyProviderFactory(new ResteasyProviderFactoryImpl());
    resteasyProviderFactory.register(resteasyJacksonProvider);
    // will cause a warning regarding Jackson provider which is already registered
    RegisterBuiltin.register(resteasyProviderFactory);
    resteasyProviderFactory.register(new MultiValuedParamConverterProvider());

    final ResteasyClient client = new ResteasyClientBuilderImpl().providerFactory(resteasyProviderFactory).build();
    return client;
}
 
Example #2
Source File: ServerRuntime.java    From EDDI with Apache License 2.0 6 votes vote down vote up
public ServerRuntime(Options options,
                     GuiceResteasyBootstrapServletContextListener resteasyContextListener,
                     SwaggerServletContextListener swaggerContextListener,
                     HttpServletDispatcher httpServletDispatcher,
                     SecurityHandler securityHandler,
                     ThreadPoolExecutor threadPoolExecutor,
                     MongoLoginService mongoLoginService,
                     AdapterConfig keycloakAdapterConfig,
                     MeterRegistry meterRegistry,
                     @Named("system.environment") String environment,
                     @Named("systemRuntime.resourceDir") String resourceDir) {
    this.options = options;
    this.resteasyContextListener = resteasyContextListener;
    this.swaggerContextListener = swaggerContextListener;
    this.httpServletDispatcher = httpServletDispatcher;
    this.securityHandler = securityHandler;
    this.threadPoolExecutor = threadPoolExecutor;
    this.mongoLoginService = mongoLoginService;
    this.keycloakAdapterConfig = keycloakAdapterConfig;
    this.meterRegistry = meterRegistry;
    this.environment = environment;
    this.resourceDir = resourceDir;
    RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
}
 
Example #3
Source File: RestClientRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public void initializeResteasyProviderFactory(RuntimeValue<InjectorFactory> ifc, boolean useBuiltIn,
        Set<String> providersToRegister,
        Set<String> contributedProviders) {
    ResteasyProviderFactory clientProviderFactory = new ResteasyProviderFactoryImpl(RuntimeType.CLIENT,
            new ResteasyProviderFactoryImpl()) {
        @Override
        public RuntimeType getRuntimeType() {
            return RuntimeType.CLIENT;
        }

        @Override
        public InjectorFactory getInjectorFactory() {
            return ifc.getValue();
        }
    };

    if (useBuiltIn) {
        RegisterBuiltin.register(clientProviderFactory);
        registerProviders(clientProviderFactory, contributedProviders, false);
    } else {
        providersToRegister.removeAll(contributedProviders);
        registerProviders(clientProviderFactory, providersToRegister, true);
        registerProviders(clientProviderFactory, contributedProviders, false);
    }

    RestClientBuilderImpl.setProviderFactory(clientProviderFactory);
    providerFactory = clientProviderFactory;
}
 
Example #4
Source File: NexusITSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * The jax-rs clients require ObjectMapper customizations to work with ComponentXO.
 */
private Customizer getObjectMapperCustomizer(final TestSuiteObjectMapperResolver testSuiteObjectMapperResolver) {
  return builder -> {
    ResteasyProviderFactory providerFactory = new LocalResteasyProviderFactory(
        ResteasyProviderFactory.newInstance());
    providerFactory.registerProviderInstance(testSuiteObjectMapperResolver, null, 1000, false);

    ResteasyClientBuilder resteasyClientBuilder = (ResteasyClientBuilder) builder;
    resteasyClientBuilder.providerFactory(providerFactory);
    RegisterBuiltin.register(providerFactory);
  };
}
 
Example #5
Source File: NexusITSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * The jax-rs clients require ObjectMapper customizations to work with ComponentXO.
 */
private Customizer getObjectMapperCustomizer(final TestSuiteObjectMapperResolver testSuiteObjectMapperResolver) {
  return builder -> {
    ResteasyProviderFactory providerFactory = new LocalResteasyProviderFactory(
        ResteasyProviderFactory.newInstance());
    providerFactory.registerProviderInstance(testSuiteObjectMapperResolver, null, 1000, false);

    ResteasyClientBuilder resteasyClientBuilder = (ResteasyClientBuilder) builder;
    resteasyClientBuilder.providerFactory(providerFactory);
    RegisterBuiltin.register(providerFactory);
  };
}