use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class InjectionManagerServerProviderTest method configure.
@Override
protected Application configure() {
final ResourceConfig resourceConfig = new ResourceConfig(TestResource.class);
resourceConfig.register(new AbstractBinder() {
@Override
protected void configure() {
bind(new MyInjectedService("hello")).to(MyInjectedService.class);
}
});
resourceConfig.register(new MyFeature());
resourceConfig.register(new MyReaderInterceptor());
resourceConfig.register(new MyWriterInterceptor());
return resourceConfig;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class ServerDestroyTest method testApplicationResource.
@Test
public void testApplicationResource() throws Exception {
final Response response = target().request().get();
assertThat(response.readEntity(String.class), is("writer-resource"));
assertThat(response.getStringHeaders().getFirst("foo"), is("bar"));
checkDestroyed(false);
reloader.reload(new ResourceConfig(Resource.class));
checkDestroyed(true);
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class ReloadTest method _createRC.
private ResourceConfig _createRC(Reloader r) {
final ResourceConfig result = new ResourceConfig(One.class);
result.registerInstances(r);
return result;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class UriConnegLanguageMediaTypeTest method configure.
@Override
protected Application configure() {
Map<String, MediaType> mediaTypes = new HashMap<>();
mediaTypes.put("foo", MediaType.valueOf("application/foo"));
mediaTypes.put("bar", MediaType.valueOf("application/bar"));
Map<String, String> languages = new HashMap<>();
languages.put("english", "en");
languages.put("french", "fr");
ResourceConfig rc = new ResourceConfig(LanguageVariantResource.class);
rc.property(ServerProperties.LANGUAGE_MAPPINGS, languages);
rc.property(ServerProperties.MEDIA_TYPE_MAPPINGS, mediaTypes);
return rc;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class UriConnegLanguageTest method configure.
@Override
protected Application configure() {
Map<String, String> languages = new HashMap<>();
languages.put("english", "en");
languages.put("french", "fr");
ResourceConfig rc = new ResourceConfig(LanguageVariantResource.class);
rc.property(ServerProperties.LANGUAGE_MAPPINGS, languages);
return rc;
}
Aggregations