本文整理汇总了Java中com.sun.jersey.core.header.MediaTypes类的典型用法代码示例。如果您正苦于以下问题:Java MediaTypes类的具体用法?Java MediaTypes怎么用?Java MediaTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaTypes类属于com.sun.jersey.core.header包,在下文中一共展示了MediaTypes类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testApplicationWadl
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
@Test
public void testApplicationWadl() {
WebResource r = client.resource(BASEURI);
String serviceWadl = r.path("application.wadl").
accept(MediaTypes.WADL).get(String.class);
assertTrue("Something wrong. Returned wadl length not > 0.",
serviceWadl.length() > 0);
}
示例2: testApplicationWadl
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
@Test
public void testApplicationWadl() {
WebResource r = client.resource(BASEURI);
String serviceWadl = r.path("application.wadl").
accept(MediaTypes.WADL).get(String.class);
Assert.assertTrue("Something wrong. Returned wadl length not > 0.",
serviceWadl.length() > 0);
}
示例3: testApplicationWadl
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
/**
* Test if a WADL document is available at the relative path
* "application.wadl".
*/
public void testApplicationWadl() {
String serviceWadl = r.path("application.wadl").
accept(MediaTypes.WADL).get(String.class);
assertTrue(serviceWadl.length() > 0);
}
示例4: testApplicationWadl
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
/**
* Test if a WADL document is available at the relative path
* "application.wadl".
*
* This should work if the rest api is deployed correctly
*/
@Test
public void testApplicationWadl() {
String serviceWadl = resource().path("application.wadl").
accept(MediaTypes.WADL).get(String.class);
assertTrue(serviceWadl.length() > 0);
}
示例5: testApplicationWadl
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
@Test
public void testApplicationWadl() {
WebResource r = c.resource(BASEURI);
String serviceWadl = r.path("application.wadl").
accept(MediaTypes.WADL).get(String.class);
assertTrue("Something wrong. Returned wadl length not > 0.",
serviceWadl.length() > 0);
}
示例6: getMappingSetRdfText
import com.sun.jersey.core.header.MediaTypes; //导入依赖的package包/类
@GET
@Path("/" + WsUriConstants.MAPPING_SET + WsUriConstants.RDF)
@Produces({MediaType.TEXT_PLAIN,
"text/turtle",
"application/rdf+xml",
"application/n-triples",
"application/ld+json",
"application/trig"
})
public Response getMappingSetRdfText(@QueryParam(WsConstants.ID) String idString,
@QueryParam(WsUriConstants.BASE_URI) String baseUri,
@QueryParam(WsUriConstants.RDF_FORMAT) String formatName,
@Context Request request,
@Context HttpServletRequest httpServletRequest)
throws BridgeDBException{
baseUri = checkBaseUri(baseUri, httpServletRequest);
String context = checkContext(baseUri, httpServletRequest);
Set<Statement> statements = getMappingSetStatements(idString, baseUri, context);
if (noContentOnEmpty & statements.isEmpty()){
return Response.noContent().build();
}
List<MediaType> types = new ArrayList<MediaType>();
for (RDFFormat f :RDFFormat.values() ) {
types.add(MediaType.valueOf(f.getDefaultMIMEType()));
types.addAll(MediaTypes.createMediaTypes(f.getMIMETypes().toArray(new String[]{})));
}
List<Variant> variants = VariantListBuilder.newInstance().mediaTypes(types.toArray(new MediaType[]{})).build();
Variant variant = request.selectVariant(variants);
if (formatName == null || formatName.isEmpty()) {
RDFFormat format = RDFFormat.forMIMEType(variant.getMediaType().toString(), RDFFormat.NTRIPLES);
formatName = format.getName();
}
String rdfInfo = BridgeDbRdfTools.writeRDF(statements, formatName);
return Response.ok(rdfInfo, MediaType.TEXT_PLAIN_TYPE).build();
}