use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class UriConnegMediaTypeTest 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"));
mediaTypes.put("foot", MediaType.valueOf("application/foot"));
Set<Class<?>> classes = new HashSet<>();
for (Class<?> c : UriConnegMediaTypeTest.class.getClasses()) {
if (c.getAnnotation(Path.class) != null) {
classes.add(c);
}
}
ResourceConfig rc = new ResourceConfig(classes);
rc.property(ServerProperties.MEDIA_TYPE_MAPPINGS, mediaTypes);
return rc;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class ImplicitProducesViewProcessorTest method configure.
@Override
protected Application configure() {
enable(TestProperties.DUMP_ENTITY);
enable(TestProperties.LOG_TRAFFIC);
return new ResourceConfig(ImplicitTemplate.class, ImplicitWithGetTemplate.class, ImplicitWithSubResourceGetTemplate.class).register(MvcFeature.class).register(TestViewProcessor.class).property("jersey.config.server.tracing", "ALL");
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class CustomConfigValidationTest method configure.
@Override
protected Application configure() {
enable(TestProperties.DUMP_ENTITY);
enable(TestProperties.LOG_TRAFFIC);
final ResourceConfig resourceConfig = new ResourceConfig(CustomConfigResource.class);
// Turn off BV in MOXy otherwise the entities on server would be validated at incorrect times.
resourceConfig.register(moxyXmlFeature());
resourceConfig.register(ValidationConfigurationContextResolver.class);
resourceConfig.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
return resourceConfig;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class BasicValidationTest method configure.
@Override
protected Application configure() {
enable(TestProperties.DUMP_ENTITY);
enable(TestProperties.LOG_TRAFFIC);
final ResourceConfig resourceConfig = new ResourceConfig(BasicResource.class);
resourceConfig.register(ContactBeanProvider.class);
resourceConfig.register(MoxyXmlFeature.class);
resourceConfig.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
return resourceConfig;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class JsonProcessingTest method testJsonObject.
@Test
public void testJsonObject() throws Exception {
final ResourceConfig resourceConfig = new ResourceConfig(Resource.class);
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);
final JsonObject jsonObject = Json.createObjectBuilder().add("foo", "bar").build();
final Client client = ClientBuilder.newClient();
final JsonObject entity = client.target(baseUri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(jsonObject), JsonObject.class);
System.out.println("RESULT = " + entity);
assertEquals(jsonObject, entity);
server.shutdownNow();
}
Aggregations