Search in sources :

Example 1 with JaxRSProviderTracker

use of com.adeptj.modules.jaxrs.resteasy.internal.JaxRSProviderTracker in project adeptj-modules by AdeptJ.

the class JaxRSWhiteboardManager method start.

/**
 * Bootstrap the RESTEasy Framework, open ServiceTracker for JAX-RS providers and resources.
 *
 * @param servletConfig the {@link ServletConfig} provided by OSGi HttpService.
 * @param vf            the Java Bean Validation's {@link ValidatorFactory}
 */
public void start(ServletConfig servletConfig, ValidatorFactory vf) {
    try {
        final long startTime = System.nanoTime();
        LOGGER.info("Bootstrapping JAX-RS Runtime!!");
        this.resteasyDispatcher = new HttpServlet30Dispatcher();
        this.resteasyDispatcher.init(servletConfig);
        Dispatcher dispatcher = this.resteasyDispatcher.getDispatcher();
        ResteasyProviderFactory providerFactory = dispatcher.getProviderFactory();
        ResteasyUtil.removeInternalValidators(providerFactory);
        ResteasyUtil.registerInternalProviders(providerFactory, this.config, vf);
        this.serviceTrackers.add(new JaxRSProviderTracker(this.context, providerFactory));
        this.serviceTrackers.add(new JaxRSResourceTracker(this.context, dispatcher.getRegistry()));
        LOGGER.info(JAXRS_RT_BOOTSTRAP_MSG, NANOSECONDS.toMillis(System.nanoTime() - startTime));
    } catch (Exception ex) {
        // NOSONAR
        LOGGER.error("Exception while bootstrapping JAX-RS Runtime!!", ex);
        throw new JaxRSBootstrapException(ex.getMessage(), ex);
    }
}
Also used : JaxRSResourceTracker(com.adeptj.modules.jaxrs.resteasy.internal.JaxRSResourceTracker) JaxRSProviderTracker(com.adeptj.modules.jaxrs.resteasy.internal.JaxRSProviderTracker) HttpServlet30Dispatcher(org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher) Dispatcher(org.jboss.resteasy.core.Dispatcher) HttpServlet30Dispatcher(org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory) JaxRSBootstrapException(com.adeptj.modules.jaxrs.resteasy.JaxRSBootstrapException) JaxRSBootstrapException(com.adeptj.modules.jaxrs.resteasy.JaxRSBootstrapException)

Aggregations

JaxRSBootstrapException (com.adeptj.modules.jaxrs.resteasy.JaxRSBootstrapException)1 JaxRSProviderTracker (com.adeptj.modules.jaxrs.resteasy.internal.JaxRSProviderTracker)1 JaxRSResourceTracker (com.adeptj.modules.jaxrs.resteasy.internal.JaxRSResourceTracker)1 Dispatcher (org.jboss.resteasy.core.Dispatcher)1 HttpServlet30Dispatcher (org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher)1 ResteasyProviderFactory (org.jboss.resteasy.spi.ResteasyProviderFactory)1