title: How to create Restful service and deploy it OSGi container?
body: <p>My goal is to create a Restful service Maven project with Eclipse. Then package it as a bundle  and deploy it to Fuse ESB karaf OSGi container. So far what I know is how to use the JAX-RS API annotations, @Path @GET:</p>
  
  <pre><code>package com.restfultest;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  
  @Path("/example")
  public class ExampleService {
  
  @GET
  public String sayHello() {
      return "Hello Restful service";
   }
  }
  </code></pre>
  
  <p>My question is that:
  1. what maven archetype should I use? maven-archetype-webapp or quickstart?</p>
  
  <p>2.How to implement Activator? Like this?</p>
  
  <pre><code>public class Activator implements BundleActivator {
  
  private ServiceRegistration&lt;?&gt; registration;
  
  public void start(BundleContext context) throws Exception {
      // TODO Auto-generated method stub
      ExampleService exampleService = new ExampleService();
      registration = context.registerService( ExampleService.class.getName(), exampleService, null );
  }
  
  public void stop(BundleContext context) throws Exception {
      // TODO Auto-generated method stub
      registration.unregister();
  }
  
  }
  </code></pre>
  
  <p>3. How to register and publish the service (like how to configure the Endpoint address and port)?</p>
  
  <p>I am new to osgi. Does anyone can provide me some resources or a detailed tutorial?</p>