当前位置: 首页>>代码示例>>Java>>正文


Java MediaTypes类代码示例

本文整理汇总了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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:WadlTest.java

示例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);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:WadlTest.java

示例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);
}
 
开发者ID:ansafari,项目名称:melon,代码行数:11,代码来源:MainTest.java

示例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);
}
 
开发者ID:PaulBoon,项目名称:ehri-indexer-service,代码行数:14,代码来源:IndexerServiceRestTest.java

示例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);
}
 
开发者ID:prodigeni,项目名称:zookeeper.dsc,代码行数:9,代码来源:WadlTest.java

示例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();
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:39,代码来源:WSUriServer.java


注:本文中的com.sun.jersey.core.header.MediaTypes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。