Skip to content

Instantly share code, notes, and snippets.

@sammso
Created March 19, 2017 20:14
Show Gist options
  • Save sammso/74969df341ca8ec87c9aa092a32ee197 to your computer and use it in GitHub Desktop.
Save sammso/74969df341ca8ec87c9aa092a32ee197 to your computer and use it in GitHub Desktop.
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@ApplicationPath("/greeting")
@Component(
immediate = true, property = {"jaxrs.application=true"},
service = Application.class
)
public class UsersRestService extends Application {
@Override
public Set<Object> getSingletons() {
return Collections.singleton((Object)this);
}
@GET
@Path("/helloworld")
@Produces("text/plain")
public String getHelloWorld() {
return "{message:\"Hello world\"}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment