Integrating JAX-RS 2.0 with Atom

About this task

JAX-RS 2.0 can use Apache Abdera to add Atom support to WebSphere® Application Server 傳統版. Because GitHub does not support any sample for WebSphere Application Server 傳統版 now, use the Liberty samples on GitHub instead. You can also use the Liberty sample build results for WebSphere Application Server 傳統版 directly. To add JAX-RS 2.0 with Atom and run the application, proceed with the following steps:

Procedure

  1. To add Atom support to WebSphere Application Server 傳統版, register the Feed and Entry providers that are based on Apache Abdera with a jaxrs endpoint in the Application subclasses. Use the following example as reference:
    package net.wasdev.wlp.sample.abdera.jaxrs.atom;
    
    import java.util.HashSet;
    import java.util.Set;
    
    import javax.ws.rs.core.Application;
    
    import net.wasdev.wlp.sample.abdera.jaxrs.atom.resource.BlogService;
    
    public class AtomApplication extends Application {
    
    	@Override
    	public Set<Class<?>> getClasses(){
    		Set<Class<?>> list = new HashSet<Class<?>>();
    		
    		list.add(BlogService.class);		
    
    		return list;
    		
    	}
    	
    	@Override
    	public Set<Object> getSingletons(){
    		Set<Object> list = new HashSet<Object>();
    		
    		list.add(new AtomEntryProvider());
    		list.add(new AtomFeedProvider());		
    		
    		return list;
    	}
    	
    
    	
    	
    	
    
    }
    For more information about processing Atom data, see AtomEntryProvider source code example and AtomFeedProvider source code example.
  2. Build the Liberty samples on GitHub with Gradle or Apache Maven. For more information about Gradle and Apache Maven, see http://gradle.org/ and http://maven.apache.org/.

    You can use two ways of building samples on GitHub. For instructions, see the following websites:

    For example, when you use Maven to build, you must add the two abdera dependencies to the pom.xml file as follows. This action ensures the application to call them.

    <dependency>
    	<groupId>org.apache.abdera</groupId>
    	<artifactId>abdera-core</artifactId>
    	<version>1.1.3</version>
    </dependency>
    <dependency>
    	<groupId>org.apache.abdera</groupId
    	<artifactId>abdera-parser</artifactId>
    	<version>1.1.3</version>
    </dependency>
  3. Run the application.
    1. Deploy the build result (WAR file) on the WebSphere Application Server 傳統版 adminConsole: Applications->Application types->WebSphere enterprise applications->Install.
    2. Start the application on the WebSphere Application Server 傳統版 adminConsole: Applications->Application types->WebSphere enterprise applications->Start.

指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:18
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twbs_jaxrs2
檔名:twbs_jaxrs2.0_atom.html