Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2018 15:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public class App2 {
private Auth auth;
public Response helloWorld(String token) {
if (!auth.isLogged(token)) {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
return Response.ok("Hello World. Welcome to App2!").build();
public Response helloWorld(@FormParam("login") String login, @FormParam("password") String password) {
if (Objects.isNull(login) || Objects.isNull(password)) {
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
String token = auth.login(login, password);
return Response
.ok("Hello World. Welcome to App2!")
.header("token", token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment