Created
October 20, 2016 09:40
-
-
Save mkuehle/e4494a393c386375a3172c993d3832b5 to your computer and use it in GitHub Desktop.
Java EE 7 - JAX-RS Response mit Cookie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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