Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
* 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