Search in sources :

Example 1 with ResteasyProviderFactoryImpl

use of org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl in project resteasy by resteasy.

the class JsonSerialization method toByteArray.

public static byte[] toByteArray(Object token, boolean indent) throws Exception {
    ResteasyProviderFactory factory = new ResteasyProviderFactoryImpl();
    factory.register(new JWTContextResolver(indent));
    factory.register(ResteasyJackson2Provider.class);
    return toByteArray(token, factory);
}
Also used : ResteasyProviderFactoryImpl(org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory)

Example 2 with ResteasyProviderFactoryImpl

use of org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl in project resteasy by resteasy.

the class ResteasyDeploymentImpl method startInternal.

private void startInternal() {
    initializeFactory();
    initializeDispatcher();
    pushContext();
    try {
        initializeObjects();
        if (securityEnabled) {
            providerFactory.register(RoleBasedSecurityFeature.class);
        }
        if (registerBuiltin) {
            providerFactory.setRegisterBuiltins(true);
            RegisterBuiltin.register(providerFactory);
            // having problems using form parameters from container for a couple of TCK tests.  I couldn't figure out
            // why, specifically:
            // com/sun/ts/tests/jaxrs/spec/provider/standardhaspriority/JAXRSClient.java#readWriteMapProviderTest_from_standalone                                               Failed. Test case throws exception: [JAXRSCommonClient] null failed!  Check output for cause of failure.
            // com/sun/ts/tests/jaxrs/spec/provider/standardwithjaxrsclient/JAXRSClient.java#mapElementProviderTest_from_standalone                                             Failed. Test case throws exception: returned MultivaluedMap is null
            providerFactory.registerProviderInstance(new ServerFormUrlEncodedProvider(useContainerFormParams), null, null, true);
            providerFactory.registerProviderInstance(new JaxrsServerFormUrlEncodedProvider(useContainerFormParams), null, null, true);
        } else {
            providerFactory.setRegisterBuiltins(false);
        }
        // register all providers
        registration();
        registerMappers();
        ((ResteasyProviderFactoryImpl) providerFactory).lockSnapshots();
    } finally {
        ResteasyContext.removeContextDataLevel();
    }
}
Also used : ResteasyProviderFactoryImpl(org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl) JaxrsServerFormUrlEncodedProvider(org.jboss.resteasy.plugins.providers.JaxrsServerFormUrlEncodedProvider) ServerFormUrlEncodedProvider(org.jboss.resteasy.plugins.providers.ServerFormUrlEncodedProvider) JaxrsServerFormUrlEncodedProvider(org.jboss.resteasy.plugins.providers.JaxrsServerFormUrlEncodedProvider)

Example 3 with ResteasyProviderFactoryImpl

use of org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl in project resteasy by resteasy.

the class HeaderDelegateTest method testProviderObject.

/**
 * @tpTestDetails Register HeaderDelegate object
 * @tpSince RESTEasy 4.0.0
 */
@Test
public void testProviderObject() {
    ResteasyProviderFactory factory = new ResteasyProviderFactoryImpl();
    factory.register(new TestHeaderDelegate());
    HeaderDelegate<?> delegate = factory.getHeaderDelegate(TestHeader.class);
    Assert.assertTrue(delegate instanceof TestHeaderDelegate);
}
Also used : ResteasyProviderFactoryImpl(org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory) Test(org.junit.Test)

Example 4 with ResteasyProviderFactoryImpl

use of org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl in project resteasy by resteasy.

the class RegisterBuiltin method getClientInitializedResteasyProviderFactory.

public static synchronized ResteasyProviderFactory getClientInitializedResteasyProviderFactory(ClassLoader cl) {
    ResteasyProviderFactory rpf = null;
    final boolean gzip = isGZipEnabled();
    if (gzipForCachedFactories == gzip) {
        rpf = configuredClientFactories.get(cl);
    }
    if (rpf == null) {
        rpf = new ResteasyProviderFactoryImpl(RuntimeType.CLIENT) {

            @Override
            public RuntimeType getRuntimeType() {
                return RuntimeType.CLIENT;
            }
        };
        if (!rpf.isBuiltinsRegistered()) {
            register(rpf);
        }
        if (gzipForCachedFactories == gzip) {
            configuredClientFactories.put(cl, rpf);
        }
    }
    return rpf;
}
Also used : RuntimeType(jakarta.ws.rs.RuntimeType) ResteasyProviderFactoryImpl(org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl) ThreadLocalResteasyProviderFactory(org.jboss.resteasy.core.ThreadLocalResteasyProviderFactory) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory)

Example 5 with ResteasyProviderFactoryImpl

use of org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl in project quarkus by quarkusio.

the class RestClientRecorder method initializeResteasyProviderFactory.

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();
        }
    };
    registerProviders(clientProviderFactory, useBuiltIn, providersToRegister, contributedProviders);
    RestClientBuilderImpl.setProviderFactory(clientProviderFactory);
    ResteasyClientBuilderImpl.setProviderFactory(clientProviderFactory);
    providerFactory = clientProviderFactory;
}
Also used : ResteasyProviderFactoryImpl(org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory)

Aggregations

ResteasyProviderFactoryImpl (org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl)12 ResteasyProviderFactory (org.jboss.resteasy.spi.ResteasyProviderFactory)7 Test (org.junit.Test)6 RuntimeType (jakarta.ws.rs.RuntimeType)1 Client (jakarta.ws.rs.client.Client)1 MediaType (jakarta.ws.rs.core.MediaType)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 SynchronousDispatcher (org.jboss.resteasy.core.SynchronousDispatcher)1 ThreadLocalResteasyProviderFactory (org.jboss.resteasy.core.ThreadLocalResteasyProviderFactory)1 JaxrsServerFormUrlEncodedProvider (org.jboss.resteasy.plugins.providers.JaxrsServerFormUrlEncodedProvider)1 ServerFormUrlEncodedProvider (org.jboss.resteasy.plugins.providers.ServerFormUrlEncodedProvider)1 InputPart (org.jboss.resteasy.plugins.providers.multipart.InputPart)1 MultipartInputImpl (org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl)1 Dispatcher (org.jboss.resteasy.spi.Dispatcher)1