Skip to content

Instantly share code, notes, and snippets.

View fercomunello's full-sized avatar

Fernando Comunello fercomunello

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.fernando.jakarta.demo</groupId>
<artifactId>jakarta-wildfly-demo</artifactId>
<version>1.0-SNAPSHOT</version>
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
@ApplicationPath("/")
public class JAXRSConfiguration extends Application {
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<display-name>jakarta-wildfly-demo</display-name>
<default-context-path>/</default-context-path>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<display-name>jakarta-wildfly-demo</display-name>
<default-context-path>/</default-context-path>
</web-app>
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;
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.format.FormatStyle" %>
<jsp:useBean id="currentDate" type="java.time.LocalDate" scope="request" />
<jsp:useBean id="user" type="java.lang.String" scope="request" />
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
// Exemplo alternativo da implementação
import org.eclipse.krazo.engine.Viewable;
@GET
public Viewable 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 new Viewable("welcome.jsp");
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.format.FormatStyle" %>
<jsp:useBean id="currentDate" type="java.time.LocalDate" scope="request" />
<jsp:useBean id="user" type="java.lang.String" scope="request" />
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
SHOW TIMEZONE;
SELECT name FROM pg_timezone_names WHERE name LIKE '%America%';
SET TIMEZONE = 'America/Sao_Paulo';
CREATE TYPE offer_type AS ENUM ('BUY', 'SELL');
CREATE TABLE bitcoin_trade (
id SERIAL UNIQUE NOT NULL,
description TEXT,
value DECIMAL(16, 2),
satoshis BIGINT,
last_price DECIMAL(16, 2),
@fercomunello
fercomunello / commands.cli
Created June 23, 2023 00:58
Create a sandbox dev/test environment for WildFly Application Server
# => Run configuration script via ./jboss-cli.sh
# Start the server in admin-only mode
embed-server --std-out=echo
# Show runtime info
version
batch
# JSP Tuning