Skip to content

Instantly share code, notes, and snippets.

@mkuehle
Created October 20, 2016 09:40
Show Gist options
  • Save mkuehle/e4494a393c386375a3172c993d3832b5 to your computer and use it in GitHub Desktop.
Save mkuehle/e4494a393c386375a3172c993d3832b5 to your computer and use it in GitHub Desktop.
Java EE 7 - JAX-RS Response mit Cookie
@Path("/auth")
@RequestScoped
@Produces(MediaType.APPLICATION_JSON)
public class AuthResource {
@GET
@Path("/login")
public Response login() {
// Do the login stuff and generate the token
NewCookie tokenCookie = new NewCookie("token", "theGeneratedToken");
return Response.ok("Erfolgreich angemeldet!").cookie(tokenCookie).build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment