本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}