public interface SampleService {
@GET
@Path("/resource/{id}")
Response getResource(@PathParam("id") int id);
@POST
@Path("/resource")
Response createResource(Resource resource);
@PUT
@Path("/resource/{id}")
Response updateResource(@PathParam("id") int id, Resource resource);
@DELETE
@Path("/resource/{id}")
Response deleteResource(@PathParam("id") int id);
}
public class SampleServiceImpl implements SampleService {
public Response getResource(int id) {
}
public Response createResource(Resource resource) {
}
public Response updateResource(int id, Resource resource) {
}
public Response deleteResource(int id) {
}
}
public class Activator implements BundleActivator {
public void start(BundleContext context) {
SampleService service = new SampleServiceImpl();
context.registerService(SampleService.class.getName(), service, null);
}
public void stop(BundleContext context) {
}
}
org.osgi.service.http.enabled=true
org.osgi.service.http.port=8080