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);
}
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();
}
}
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);
}
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;
}
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;
}
Aggregations