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


Java Content类代码示例

本文整理汇总了Java中org.jboss.resteasy.plugins.providers.atom.Content的典型用法代码示例。如果您正苦于以下问题:Java Content类的具体用法?Java Content怎么用?Java Content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Content类属于org.jboss.resteasy.plugins.providers.atom包,在下文中一共展示了Content类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: wrapStoredQuery

import org.jboss.resteasy.plugins.providers.atom.Content; //导入依赖的package包/类
public static Entry wrapStoredQuery(StoredQuery storedQuery) throws Exception {
    Entry entry = new Entry();
    entry.setId(new URI("urn:uuid:" + storedQuery.getQueryName())); //$NON-NLS-1$
    entry.setTitle("Stored Query: " + storedQuery.getQueryName()); //$NON-NLS-1$
    
    // TODO: This is really stupid.  Going to push back on this w/ the TC.  The Atom binding spec should simply
    // reuse the core model's StoredQuery.
    StoredQueryData data = new StoredQueryData();
    data.setQueryName(storedQuery.getQueryName());
    data.setQueryString(storedQuery.getQueryExpression());
    data.getPropertyName().addAll(storedQuery.getPropertyName());
    entry.setAnyOtherJAXBObject(data);
    
    Content content = new Content();
    content.setText("Stored Query Entry"); //$NON-NLS-1$
    entry.setContent(content);
    
    Category category = new Category();
    category.setTerm("query"); //$NON-NLS-1$
    category.setLabel("Stored Query Entry"); //$NON-NLS-1$
    category.setScheme(SrampAtomConstants.X_S_RAMP_TYPE_URN);
    entry.getCategories().add(category);
    
    return entry;
}
 
开发者ID:ArtificerRepo,项目名称:s-ramp-tck,代码行数:26,代码来源:SrampAtomUtils.java

示例2: getFeed

import org.jboss.resteasy.plugins.providers.atom.Content; //导入依赖的package包/类
@GET
@Produces("application/atom+xml")
public Feed getFeed() throws URISyntaxException {
    Feed feed = new Feed();
    feed.setId(new URI("http://test.com/1"));
    feed.setTitle("WildFly Camel Test Feed");
    feed.setUpdated(new Date());

    Link link = new Link();
    link.setHref(new URI("http://localhost"));
    link.setRel("edit");
    feed.getLinks().add(link);
    feed.getAuthors().add(new Person("WildFly Camel"));

    Entry entry = new Entry();
    entry.setTitle("Hello Kermit");

    Content content = new Content();
    content.setType(MediaType.TEXT_HTML_TYPE);
    content.setText("Greeting Kermit");
    entry.setContent(content);

    feed.getEntries().add(entry);
    return feed;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:26,代码来源:AtomFeed.java

示例3: wrapInEntry

import org.jboss.resteasy.plugins.providers.atom.Content; //导入依赖的package包/类
private Entry wrapInEntry(E element) {
	try {
		Entry entry = new Entry();
		entry.setTitle(getEntryTitle(element));
		entry.setId(getEntryId(element));
		entry.setUpdated(getEntryUpdated(element));
		Content content = new Content();
		content.setJAXBObject(element);
		entry.setContent(content);
		return entry;
	} catch (URISyntaxException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:nordinh,项目名称:atom-feed,代码行数:15,代码来源:AtomFeedProducer.java

示例4: add

import org.jboss.resteasy.plugins.providers.atom.Content; //导入依赖的package包/类
@Override
public void add(Entry entry) {
	try {
		Content content = entry.getContent();
		Notification notificatie;
		notificatie = content.getJAXBObject(Notification.class);
		notificatie.setUpdated(new Date());
		notificaties.add(notificatie);
	} catch (JAXBException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:nordinh,项目名称:atom-feed,代码行数:13,代码来源:NotificationFeedProducer.java

示例5: getFeed

import org.jboss.resteasy.plugins.providers.atom.Content; //导入依赖的package包/类
@GET
@Path("/feed")
@Produces("application/atom+xml")
public Feed getFeed() throws URISyntaxException
{
    Feed feed = new Feed();
    feed.setId(new URI("http://example.com/42"));
    feed.setTitle("Veterinarians");
    feed.setUpdated(new Date());
    Link link = new Link();
    link.setHref(new URI("http://localhost"));
    link.setRel("edit");
    feed.getLinks().add(link);
    feed.getAuthors().add(new Person("Thomas Woehlke"));
    for(Vet vet:vetDao.getAll()){
        Entry entry = new Entry();
        entry.setTitle("Vet: "+vet.getFirstName()+" "+vet.getLastName());
        Content content = new Content();
        content.setType(MediaType.TEXT_HTML_TYPE);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[");
        Iterator<Specialty> i = vet.getSpecialties().iterator();
        while(i.hasNext() ){
            stringBuilder.append(i.next().getName());
            if(i.hasNext()){
                stringBuilder.append(", ");
            }
        }
        stringBuilder.append("]");
        content.setText(stringBuilder.toString());
        entry.setContent(content);
        feed.getEntries().add(entry);
    }
    return feed;
}
 
开发者ID:phasenraum2010,项目名称:javaee7-petclinic,代码行数:36,代码来源:VetWebservice.java


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