Skip to content

Instantly share code, notes, and snippets.

@jmesnil
Last active March 13, 2025 09:55
Show Gist options
  • Select an option

  • Save jmesnil/5f86e521068f6921f80ebb142c7f4704 to your computer and use it in GitHub Desktop.

Select an option

Save jmesnil/5f86e521068f6921f80ebb142c7f4704 to your computer and use it in GitHub Desktop.
Simple Web application with WildFly & JBang
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.github.lalyos:jfiglet:0.0.8
//DEPS org.wildfly.bom:wildfly-expansion:35.0.1.Final@pom
//DEPS jakarta.ws.rs:jakarta.ws.rs-api
//DEPS jakarta.enterprise:jakarta.enterprise.cdi-api
//DEPS org.wildfly.glow:wildfly-glow:1.3.2.Final
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.*;
import com.github.lalyos.jfiglet.FigletFont;
@ApplicationPath("/")
public class myapp extends Application {
@Path("/hello")
@ApplicationScoped
public static class Hello {
@GET
public String sayHello(@QueryParam("name") @DefaultValue("World") String name) throws Exception {
String hello = String.format("Hello, %s!", name);
return FigletFont.convertOneLine(hello);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment