use of javax.ws.rs.core.MediaType 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 javax.ws.rs.core.MediaType in project jersey by jersey.
the class LoopBackConnectorTest method testEntityMediaType.
@Test
public void testEntityMediaType() throws Exception {
final Response response = client.target("baz").request().post(Entity.entity("foo", "foo/bar"));
assertThat("Invalid entity received", response.readEntity(String.class), is("foo"));
assertThat("Invalid content-type received", response.getMediaType(), is(new MediaType("foo", "bar")));
}
use of javax.ws.rs.core.MediaType in project jersey by jersey.
the class ConsumeProduceTest method testProducesStrings.
@Test
public void testProducesStrings() {
final Produces p = ProducesStringsClass.class.getAnnotation(Produces.class);
final List<MediaType> l = MediaTypes.createFrom(p);
checkMediaTypes(l);
}
use of javax.ws.rs.core.MediaType in project jersey by jersey.
the class ConsumeProduceTest method testConsumesString.
@Test
public void testConsumesString() {
final Consumes c = ConsumesStringClass.class.getAnnotation(Consumes.class);
final List<MediaType> l = MediaTypes.createFrom(c);
checkMediaTypes(l);
}
use of javax.ws.rs.core.MediaType in project jersey by jersey.
the class ConsumeProduceTest method testProduces.
@Test
public void testProduces() {
final Produces p = ProducesClass.class.getAnnotation(Produces.class);
final List<MediaType> l = MediaTypes.createFrom(p);
checkMediaTypes(l);
}
Aggregations