Search in sources :

Example 1 with CORSFilter

use of org.openremote.container.security.CORSFilter 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)

Aggregations

ResteasyDeployment (org.jboss.resteasy.spi.ResteasyDeployment)1 JacksonConfig (org.openremote.container.json.JacksonConfig)1 CORSFilter (org.openremote.container.security.CORSFilter)1