⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feedrepresentation.java

📁 编写rest实例 rest分布式框架在app中的应用
💻 JAVA
字号:
package com.jeffhanson.atompub.service;

import java.io.File;

import javax.activation.FileDataSource;

import com.jeffhanson.rest.core.Representation;

/*
 * Feed should be structured as follows:
 * 
 * <feed xmlns="http://www.w3.org/2005/Atom"
 *       xml:base="http://localhost:8080/atompub/services/collections/docs">
 *   <id>http://localhost:8080/atompub/services/collections/docs</id>
 *   <title>My Docs</title>
 *   <updated>2007-09-12T10:20:05Z</updated>
 *   <link rel="self" href="/collections/docs" />
 *   <link href="http://localhost:8080/atompub/services" />
 *   <entry>
 *     <id>tag:localhost:8080/atompub/services,2007:/collections/docs/testdoc</id>
 *     <title>Something really witty</title>
 *     <link href="http://localhost:8080/atompub/services"/>
 *     <link rel="edit" href="http://localhost:8080/atompub/services/collections/docs/testdoc" />
 *     <updated>2007-08-12T11:40:11Z</updated>
 *     <author><name>John Doe</name></author>
 *     <summary>Some more witty stuff</summary>
 *   </entry>
 * </feed>
 */
public class FeedRepresentation extends Representation
{
  public static final String MEDIA_TYPE = "application/atom+xml";  
  public static final String CONTENT_TYPE = MEDIA_TYPE + "; charset=utf-8";
  
  public FeedRepresentation(File file)
  {
    super(new FeedDataSource(file, CONTENT_TYPE));
  }
  
  public String getContentType()
  {
    return CONTENT_TYPE;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -