Search in sources :

Example 26 with ResourceConfig

use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.

the class EventListenerTest method configure.

@Override
protected Application configure() {
    applicationEventListener = new AppEventListener();
    final ResourceConfig resourceConfig = new ResourceConfig(MyResource.class);
    resourceConfig.register(applicationEventListener);
    resourceConfig.register(RequestFilter.class);
    resourceConfig.register(PreMatchingRequestFilter.class);
    resourceConfig.register(ResponseFilter.class);
    resourceConfig.register(MyExceptionMapper.class);
    resourceConfig.setApplicationName(APPLICATION_NAME);
    return resourceConfig;
}
Also used : ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 27 with ResourceConfig

use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.

the class MBeansTest method configure.

@Override
protected Application configure() {
    final ResourceConfig resourceConfig = new ResourceConfig(TestResource.class, MyExceptionMapper.class);
    resourceConfig.setApplicationName("myApplication");
    resourceConfig.property("very-important", "yes");
    resourceConfig.property("another-property", 48);
    resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
    resourceConfig.register(StatisticsListener.class);
    return resourceConfig;
}
Also used : ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 28 with ResourceConfig

use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.

the class MonitoringStatisticsLocatorTest method configure.

@Override
protected Application configure() {
    final ResourceConfig resourceConfig = new ResourceConfig(StatisticsResource.class, AnotherResource.class);
    resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
    resourceConfig.property(ServerProperties.APPLICATION_NAME, "testApp");
    return resourceConfig;
}
Also used : ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 29 with ResourceConfig

use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.

the class ExplicitProduceTemplateTest method configure.

@Override
protected Application configure() {
    enable(TestProperties.DUMP_ENTITY);
    enable(TestProperties.LOG_TRAFFIC);
    return new ResourceConfig(ExplicitTwoGetProducesTemplate.class, ExplicitNoProducesTemplate.class, ExplicitWildcardProducesTemplate.class, ExplicitTemplateProducesClass.class).register(MvcFeature.class).register(AbcViewProcessor.class).register(DefViewProcessor.class);
}
Also used : AbcViewProcessor(org.glassfish.jersey.tests.e2e.server.mvc.provider.AbcViewProcessor) ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 30 with ResourceConfig

use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.

the class UriConnegMappingFromProperty method configure.

@Override
protected Application configure() {
    ResourceConfig rc = new ResourceConfig(UriConnegLanguageMediaTypeTest.LanguageVariantResource.class);
    rc.property(ServerProperties.MEDIA_TYPE_MAPPINGS, "foo : application/foo, bar : application/bar");
    rc.property(ServerProperties.LANGUAGE_MAPPINGS, "english : en, french : fr");
    return rc;
}
Also used : ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Aggregations

ResourceConfig (org.glassfish.jersey.server.ResourceConfig)358 Test (org.junit.Test)135 ApplicationHandler (org.glassfish.jersey.server.ApplicationHandler)105 ContainerResponse (org.glassfish.jersey.server.ContainerResponse)62 LoggingFeature (org.glassfish.jersey.logging.LoggingFeature)33 ServletContainer (org.glassfish.jersey.servlet.ServletContainer)29 Response (javax.ws.rs.core.Response)28 HttpServer (org.glassfish.grizzly.http.server.HttpServer)28 URI (java.net.URI)24 Resource (org.glassfish.jersey.server.model.Resource)24 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)23 IOException (java.io.IOException)22 ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)22 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)18 Server (org.eclipse.jetty.server.Server)17 ApplicationInfoListener (org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener)17 MonitoringEventListener (org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener)17 MBeanExposer (org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer)17 MetricRegistry (com.codahale.metrics.MetricRegistry)15 ContainerRequest (org.glassfish.jersey.server.ContainerRequest)15