Created
August 18, 2021 07:42
-
-
Save fercomunello/814b447136ec2622539abd5b40354d84 to your computer and use it in GitHub Desktop.
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
package me.fernando.jakarta.demo; | |
import jakarta.enterprise.context.RequestScoped; | |
import jakarta.inject.Inject; | |
import jakarta.mvc.Controller; | |
import jakarta.mvc.Models; | |
import jakarta.ws.rs.GET; | |
import jakarta.ws.rs.Path; | |
import jakarta.ws.rs.QueryParam; | |
import jakarta.ws.rs.core.Response; | |
import java.time.LocalDate; | |
@Controller | |
@RequestScoped | |
@Path("welcome") | |
public class WelcomeController { | |
@Inject | |
private Models models; | |
@GET | |
public Response welcome(@QueryParam("user") String user) { | |
var currentDate = LocalDate.now(); | |
this.models.put("currentDate", currentDate); | |
this.models.put("user", user != null && !user.isBlank() ? user : "Guest"); | |
return Response.ok().entity("welcome.jsp").build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment