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 traditional. Because GitHub does not support any sample for WebSphere Application Server traditional now, use the Liberty samples on GitHub instead. You can also use the Liberty sample build results for WebSphere Application Server traditional 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 traditional, 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 traditional adminConsole: Applications->Application types->WebSphere enterprise applications->Install.
    2. Start the application on the WebSphere Application Server traditional adminConsole: Applications->Application types->WebSphere enterprise applications->Start.

Icon that indicates the type of topic Task topic



Timestamp icon Last updated: March 5, 2017 17:29
File name: twbs_jaxrs2.0_atom.html