Skip to content

Instantly share code, notes, and snippets.

@ljnelson
Last active November 16, 2016 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljnelson/b4058eef43537313e84e0a429c7ea68f to your computer and use it in GitHub Desktop.
Save ljnelson/b4058eef43537313e84e0a429c7ea68f to your computer and use it in GitHub Desktop.
/*
* Copyright 2016 Laird Nelson. Released under the terms of the MIT license: https://opensource.org/licenses/MIT
*/
package developer;
import java.util.Collections;
import java.util.Set;
import javax.ws.rs.core.Application;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class HelloWorldApplication extends Application {
public HelloWorldApplication() {
super();
}
@Override
public Set<Class<?>> getClasses() {
return Collections.singleton(HelloWorldResource.class);
}
}
/*
* Copyright 2016 Laird Nelson. Released under the terms of the MIT license: https://opensource.org/licenses/MIT
*/
package developer;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.core.Application;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("hello")
@RequestScoped
public class HelloWorldResource {
@GET
@Produces("text/plain")
public String hello() {
return "Hello, world!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment