Search in sources :

Example 1 with JacksonConfig

use of org.openremote.container.json.JacksonConfig in project openremote by openremote.

the class WebTargetBuilder method initClient.

protected static void initClient() {
    if (client != null) {
        return;
    }
    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder().connectionPoolSize(CONNECTION_POOL_SIZE).connectionCheckoutTimeout(CONNECTION_CHECKOUT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS).socketTimeout(CONNECTION_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS).establishConnectionTimeout(CONNECTION_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS).register(new JacksonConfig());
    if (asyncExecutorService != null) {
        clientBuilder.asyncExecutor(asyncExecutorService);
    }
    client = clientBuilder.build();
}
Also used : JacksonConfig(org.openremote.container.json.JacksonConfig) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)

Example 2 with JacksonConfig

use of org.openremote.container.json.JacksonConfig in project openremote by openremote.

the class WebService method createResteasyDeployment.

protected ResteasyDeployment createResteasyDeployment(Container container) {
    if (getApiClasses() == null && getApiSingletons() == null)
        return null;
    WebApplication webApplication = new WebApplication(container, getApiClasses(), getApiSingletons());
    ResteasyDeployment resteasyDeployment = new ResteasyDeployment();
    resteasyDeployment.setApplication(webApplication);
    // Custom providers (these only apply to server applications, not client calls)
    resteasyDeployment.getProviders().add(new WebServiceExceptions.DefaultResteasyExceptionMapper(devMode));
    resteasyDeployment.getProviders().add(new WebServiceExceptions.ForbiddenResteasyExceptionMapper(devMode));
    resteasyDeployment.getProviders().add(new JacksonConfig());
    resteasyDeployment.getProviders().add(new CORSFilter());
    resteasyDeployment.getProviders().add(new GZIPEncodingInterceptor(!container.isDevMode()));
    resteasyDeployment.getActualProviderClasses().add(ModelValueMessageBodyConverter.class);
    resteasyDeployment.getActualProviderClasses().add(AlreadyGzippedWriterInterceptor.class);
    resteasyDeployment.getActualProviderClasses().add(ClientErrorExceptionHandler.class);
    return resteasyDeployment;
}
Also used : JacksonConfig(org.openremote.container.json.JacksonConfig) ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) CORSFilter(org.openremote.container.security.CORSFilter)

Example 3 with JacksonConfig

use of org.openremote.container.json.JacksonConfig in project openremote by openremote.

the class AbstractHttpServerProtocol method init.

@Override
public void init(Container container) throws Exception {
    super.init(container);
    this.container = container;
    this.devMode = container.isDevMode();
    identityService = container.hasService(IdentityService.class) ? container.getService(IdentityService.class) : null;
    webService = container.getService(WebService.class);
    if (defaultResteasyExceptionMapper == null) {
        defaultResteasyExceptionMapper = new WebServiceExceptions.DefaultResteasyExceptionMapper(devMode);
        forbiddenResteasyExceptionMapper = new WebServiceExceptions.ForbiddenResteasyExceptionMapper(devMode);
        undertowExceptionHandler = new WebServiceExceptions.ServletUndertowExceptionHandler(devMode);
        jacksonConfig = new JacksonConfig();
        modelValueMessageBodyConverter = new ModelValueMessageBodyConverter();
        alreadtGzippedWriterInterceptor = new AlreadyGzippedWriterInterceptor();
        clientErrorExceptionHandler = new ClientErrorExceptionHandler();
    }
}
Also used : JacksonConfig(org.openremote.container.json.JacksonConfig) ModelValueMessageBodyConverter(org.openremote.container.json.ModelValueMessageBodyConverter)

Aggregations

JacksonConfig (org.openremote.container.json.JacksonConfig)3 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)1 ResteasyDeployment (org.jboss.resteasy.spi.ResteasyDeployment)1 ModelValueMessageBodyConverter (org.openremote.container.json.ModelValueMessageBodyConverter)1 CORSFilter (org.openremote.container.security.CORSFilter)1