jooby set -w ~/Source
+jooby set -w ~/Source
From 31b0496a4cb4b81e789fc803281e85066e8b6f0f Mon Sep 17 00:00:00 2001
From: Edgar Espina Looking for previous version? Download jooby-cli.zip Download jooby-cli.zip Unzip For Maven and Gradle there are two variant Welcome to Jooby!
-3.0.2
+3.0.3
Welcome!!
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
public class App extends Jooby {
@@ -936,15 +936,15 @@
@@ -1304,13 +1304,13 @@ Script with sub-class:
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
public class App extends Jooby {
@@ -1031,9 +1031,9 @@
Script without subclass:
import io.jooby.annotation.*;
+
+}import io.jooby.annotation.*;
public class MyController {
@@ -1116,9 +1116,9 @@
jooby-cli.zip
in your user home directory (or any other directory you prefer to)
+jooby set -w ~/Source
jooby set -w ~/Source
+jooby> create myapp
jooby> create myapp
+jooby> create myapp --kotlin
jooby> create myapp --kotlin
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-kotlin</artifactId>
- <version>3.0.2</version>
-</dependency>
+jooby> create myapp --gradle
jooby> create myapp --gradle
+jooby> create myapp --gradle --kotlin
jooby> create myapp --gradle --kotlin
+jooby> create myapp --mvc
jooby> create myapp --mvc
+jooby> create myapp --server undertow
jooby> create myapp --server undertow
+jooby> create myapp --stork
jooby> create myapp --stork
+jooby> create myapp --docker
jooby> create myapp --docker
+jooby> create myapp -i
jooby> create myapp -i
Snippet
{
+
+}{
get("/", ctx -> "Snippet");
-}
Routes:
{
+
+}{
get("/foo", ctx -> "Foo")
.attribute("foo", "bar");
-}
{
+
+}{
use(next -> ctx -> {
User user = ...;
String role = ctx.getRoute().attribute("Role");
@@ -1513,9 +1513,9 @@
@Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
+
+}@Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Role {
String value();
@@ -1555,9 +1555,9 @@
{
+
+}{
get("/foo", ctx -> "Foo");
-}
Single path variable:
{
+
+}{
(1)
get("/user/{id}", ctx -> {
int id = ctx.path("id").intValue(); (2)
return id;
});
-}
Multiple path variables:
{
+
+}{
(1)
get("/file/{file}.{ext}", ctx -> {
String filename = ctx.path("file").value(); (2)
String ext = ctx.path("ext").value(); (3)
return filename + "." + ext;
});
-}
Optional path variable:
{
+
+}{
(1)
get("/profile/{id}?", ctx -> {
String id = ctx.path("id").value("self"); (2)
return id;
});
-}
Regex path variable:
{
+
+}{
(1)
get("/user/{id:[0-9]+}", ctx -> {
int id = ctx.path("id").intValue(); (2)
return id;
});
-}
catchall
{
+
+}{
(1)
get("/articles/*", ctx -> {
String catchall = ctx.path("*").value(); (2)
@@ -1794,9 +1794,9 @@
(3)
return path;
});
-}
{
+
+}{
get("/user/{id}", ctx -> ctx.path("id").value()); (1)
get("/user/me", ctx -> "my profile"); (2)
@@ -1881,9 +1881,9 @@
(3)
get("/users", ctx -> "new users"); (4)
-}
<
interface Filter {
+
+}interface Filter {
Handler apply(Handler next);
-}
{
+
+}{
use(next -> ctx -> {
long start = System.currentTimeMillis(); (1)
@@ -1958,9 +1958,9 @@
<
get("/", ctx -> {
return "filter";
});
-}
<
interface Before {
+
+}interface Before {
void apply(Context ctx);
-}
{
+
+}{
before(ctx -> {
ctx.setResponseHeader("Server", "Jooby");
});
@@ -2044,9 +2044,9 @@
<
get("/", ctx -> {
return "...";
});
-}
interface After {
+
+}interface After {
void apply(Context ctx, Object result, Throwable failure);
-}
{
+
+}{
after((ctx, result, failure) -> {
System.out.println(result); (1)
ctx.setResponseHeader("foo", "bar"); (2)
@@ -2137,9 +2137,9 @@
{
+
+}{
after((ctx, result, failure) -> {
if (ctx.isResponseStarted()) {
// Don't modify response
@@ -2184,9 +2184,9 @@
{
+
+}{
after((ctx, result, failure) -> {
if (failure == null) {
db.commit(); (1)
@@ -2228,9 +2228,9 @@
(2)
}
});
-}
{
+
+}{
after((ctx, result, failure) -> {
if (failure instanceOf MyBusinessException) {
ctx.send("Recovering from something"); (1)
}
});
-}
{
+
+}{
after((ctx, result, failure) -> {
...
throw new AnotherException();
@@ -2298,9 +2298,9 @@
(1)
Throwable anotherException = failure.getSuppressed()[0]; (2)
});
-}
Example
{
+
+}{
use(next -> ctx -> {
long start = System.currentTimeInMillis();
ctx.onComplete(context -> { (1)
@@ -2353,9 +2353,9 @@
{
+
+}{
// Increment +1
use(next -> ctx -> {
Number n = (Number) next.apply(ctx);
@@ -2408,9 +2408,9 @@
(1)
get("/2", ctx -> 2); (2)
-}
{
+
+}{
use("/*", (req, rsp, chain) -> {
// remote call, db call
});
// ...
-}
<
{
+
+}{
// Increment +1
use(next -> ctx -> {
Number n = (Number) next.apply(ctx);
@@ -2538,9 +2538,9 @@
<
});
get("/2", ctx -> 2); (2)
-}
Scoped filter:
{
+
+}{
// Increment +1
use(next -> ctx -> {
Number n = (Number) next.apply(ctx);
@@ -2606,9 +2606,9 @@
(3)
-}
Route operator
{
+
+}{
routes(() -> {
get("/", ctx -> "Hello");
});
-}
Routes with path prefix:
Composing
public class Foo extends Jooby {
+
+}public class Foo extends Jooby {
{
get("/foo", Context::getRequestPath);
}
@@ -2776,9 +2776,9 @@
(3)
}
-}
Composing with path prefix
public class Foo extends Jooby {
+
+}public class Foo extends Jooby {
{
get("/foo", Context::getRequestPath);
}
@@ -2829,9 +2829,9 @@
(1)
}
-}
Installing
public class Foo extends Jooby {
+
+}public class Foo extends Jooby {
{
get("/foo", ctx -> ...);
}
@@ -2885,9 +2885,9 @@
(2)
}
-}
{
+
+}{
Foo foo = new Foo();
install(() -> foo); // Won't work
-}
{
+
+}{
install(() -> new Foo()); // Works!
-}
Dynamic Routing
public class V1 extends Jooby {
+
+}public class V1 extends Jooby {
{
get("/api", ctx -> "v1");
}
@@ -2979,9 +2979,9 @@
(2)
}
-}
<form method="post" action="/form">
+
+</form><form method="post" action="/form">
<input type="hidden" name="_method" value="put">
-</form>
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
...
{
@@ -3050,9 +3050,9 @@
(2)
});
-}
HTTP Header
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
...
{
setHiddenMethod(ctx -> ctx.header("X-HTTP-Method-Override").toOptional()); (1)
-}
Usage
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
...
{
@@ -3128,9 +3128,9 @@
(5)
...
});
-}
{
+
+}{
get("/", ctx -> { /* do important stuff with variable 'ctx'. */ });
-}
{
+
+}{
setContextAsService(true);
-}
+application.lang = en, en-GB, de
application.lang = en, en-GB, de
{
+
+}{
setLocales(Locale.GERMAN, new Locale("hu", "HU"));
-}
Cookies
Syntax:
{
+
+}{
get("/{id}" ctx -> ctx.path("id").value()); (1)
get("/@{id}" ctx -> ctx.path("id").value()); (2)
@@ -3405,9 +3405,9 @@
(4)
get("/{id:[0-9]+}", ctx -> ctx.path("id)) (5)
-}
{
+
+}{
get("/{name}", ctx -> {
String pathString = ctx.getRequestPath(); (1)
@@ -3460,9 +3460,9 @@
FileUpload pic = ctx.file("pic"); (1)
+
+ List<FileUpload> files = ctx.files(); (3) FileUpload pic = ctx.file("pic"); (1)
List<FileUpload> pic = ctx.files("pic"); (2)
- List<FileUpload> files = ctx.files(); (3)
Session session = ctx.session(); (1)
+
+ String attribute = ctx.session("attribute").value(); (2) Session session = ctx.session(); (1)
- String attribute = ctx.session("attribute").value(); (2)
get("/", ctx -> {
+
+ }); get("/", ctx -> {
return ctx.flash("success").value("Welcome!"); (3)
});
post("/save", ctx -> {
ctx.flash("success", "Item created"); (1)
return ctx.sendRedirect("/"); (2)
- });
{
+
+}{
setFlashCookie(new Cookie("myflash").setHttpOnly(true));
// or if you're fine with the default name
getFlashCookie().setHttpOnly(true);
-}
get("/{foo}", ctx -> {
+
+});get("/{foo}", ctx -> {
String foo = ctx.lookup("foo", ParamSource.QUERY, ParamSource.PATH).value();
return "foo is: " + foo;
});
@@ -4046,9 +4046,9 @@
get("/{foo}", ctx -> {
+
+});get("/{foo}", ctx -> {
List<Certificate> certificates = ctx.getClientCertificates(); (1)
Certificate peerCertificate = certificates.get(0); (2)
-});
{
+
+}{
get("/", ctx -> {
String name = ctx.query("name").value(); (1)
@@ -4145,9 +4145,9 @@
(4)
...
});
-}
{
+
+}{
get("/search", ctx -> {
String q = ctx.query("q").value("*:*"); (1)
return q;
@@ -4264,9 +4264,9 @@
(2)
return q;
});
-}
Traversal
{
+
+}{
get("/", ctx -> {
Value user = ctx.query("user"); (1)
String name = user.get("name").value(); (2)
@@ -4434,9 +4434,9 @@
(4)
...
}}
-}
PO
class Member {
+
+}class Member {
public final String firstname;
public final String lastName;
@@ -4538,11 +4538,11 @@
PO
this.id = id;
this.members = members;
}
-}
PO
{
+
+}{
get("/", ctx -> {
Member member = ctx.query(Member.class);
...
});
-}
PO
{
+
+}{
get("/", ctx -> {
Member member = ctx.query("member").to(Member.class);
...
});
-}
PO
{
+
+}{
get("/", ctx -> {
List<Member> members = ctx.query().toList(Member.class);
...
});
-}
PO
{
+
+}{
get("/", ctx -> {
Group group = ctx.query(Group.class);
...
});
-}
PO
class Member {
+
+}class Member {
public final String firstname;
public final String lastname;
@@ -4692,9 +4692,9 @@
PO
public Member(@Named("first-name") String firstname, @Named("last-name") String lastname) {
....
}
-}
{
+
+}{
post("/string", ctx -> {
String body = ctx.body().value(); (1)
...
@@ -4727,9 +4727,9 @@
(3)
...
});
-}
public interface MessageDecoder {
+
+}public interface MessageDecoder {
<T> T decode(Context ctx, Type type) throws Exception;
-}
JSON example:
{
+
+}{
FavoriteJson lib = new FavoriteJson(); (1)
decoder(MediaType.json, (ctx, type) -> { (2)
@@ -4800,9 +4800,9 @@
(5)
});
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
-</dependency>
<
{
+
+}{
get("/", ctx -> {
ctx.setResponseCode(200); (1)
@@ -4890,9 +4890,9 @@
<
return "Response"; (4)
});
-}
public interface MessageEncoder {
+
+}public interface MessageEncoder {
byte[] encode(@NonNull Context ctx, @NonNull Object value) throws Exception;
-}
JSON example:
{
+
+}{
FavoriteJson lib = new FavoriteJson(); (1)
encoder(MediaType.json, (ctx, result) -> { (2)
@@ -4962,9 +4962,9 @@
(6)
});
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
-</dependency>
build.gradle
tasks.withType(JavaCompile) {
+
+}tasks.withType(JavaCompile) {
options.compilerArgs += [
'-parameters',
'-Ajooby.incremental=true',
'-Ajooby.services=true'
]
-}
MVC API:
import io.jooby.annotation.*;
+
+}import io.jooby.annotation.*;
@Path("/mvc") (1)
public class Controller {
@@ -5122,9 +5122,9 @@
public class App extends Jooby {
+
+}public class App extends Jooby {
{
mvc(new MyController());
}
@@ -5191,15 +5191,15 @@
public class App extends Jooby {
+
+}public class App extends Jooby {
{
mvc(MyController.class);
}
@@ -5218,15 +5218,15 @@
import jakarta.inject.Provider;
+
+}import jakarta.inject.Provider;
public class App extends Jooby {
{
@@ -5263,9 +5263,9 @@
Headers
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@HeaderParam String token) { (1)
...
}
-}
Non valid Java name
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@HeaderParam("Last-Modified-Since") long lastModifiedSince) {
...
}
-}
Cookies
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@CookieParam String token) { (1)
...
}
-}
Non valid Java name
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@CookieParam("token-id") String tokenId) {
...
}
-}
PathParam
public class MyController {
+
+}public class MyController {
@Path("/{id}")
public Object provisioning(@PathParam String id) {
...
}
-}
QueryParam
public class MyController {
+
+}public class MyController {
@Path("/")
public Object provisioning(@QueryParam String q) {
...
}
-}
QueryParam
public class MyController {
+
+}public class MyController {
@Path("/")
@POST
public Object provisioning(@FormParam String username) {
...
}
-}
HTTP Body
public class MyController {
+
+}public class MyController {
@Path("/")
@POST
public Object provisioning(MyObject body) {
...
}
-}
Flash
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@FlashParam String success) { (1)
...
}
-}
Session Attribute
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@SessionParam String userId) { (1)
...
}
-}
Session Attribute
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(Session session) { (1)
...
}
-}
Context Attribute
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@ContextParam String userId) { (1)
...
}
-}
Context Attributes
public class MyController {
+
+}public class MyController {
@GET
public Object provisioning(@ContextParam Map<String, Object> attributes) { (1)
...
}
-}
Multiple Sources
public class FooController {
+
+}public class FooController {
@GET("/{foo}")
public String multipleSources(@Param({ QUERY, PATH }) String foo) {
return "foo is: " + foo;
}
-}
EventLoop MVC route
public class App extends Jooby {
+
+}public class App extends Jooby {
{
mvc(new MyController());
}
@@ -5799,15 +5799,15 @@
(1)
}
-}
Worker mode MVC route
public class App extends Jooby {
+
+}public class App extends Jooby {
{
dispatch(() -> {
mvc(new MyBlockingController()); (1)
@@ -5835,9 +5835,9 @@
Dispatch annotation
public class MyController {
+
+}public class MyController {
@GET("/nonblocking")
public String nonblocking() { (1)
return "I'm nonblocking";
@@ -5875,9 +5875,9 @@
(2)
return "I'm blocking";
}
-}
Dispatch to custom executor
public class MyController {
+
+}public class MyController {
@GET("/blocking")
@Dispatch("single") (1)
public String blocking() {
return "I'm blocking";
}
-}
Custom executor registration
{
+
+}{
executor("single", Executors.newSingleThreadExecutor());
mvc(new MyController());
-}
Resource
import javax.ws.rs.GET;
+
+}import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/jaxrs")
@@ -5984,9 +5984,9 @@
<plugin>
+
+ </plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
@@ -6092,9 +6092,9 @@
Classpath resources:
{
+
+}{
assets("/static/*"); (1)
-}
File system resources:
{
+
+}{
assets("/static/*", Paths.get("www")); (1)
-}
{
+
+}{
assets("/myfile.js", "/static/myfile.js");
-}
Classpath resources:
{
+
+}{
Path docs = Paths.get("docs"); (1)
assets("/docs/?*", docs); (2)
-}
Classpath resources:
{
+
+}{
AssetSource docs = AssetSource.create(Paths.get("docs")); (1)
assets("/docs/?*", new AssetHandler("index.html", docs)); (2)
-}
{
+
+}{
AssetSource www = AssetSource.create(Paths.get("www"));
assets("/static/*", new AssetHandler(www)
.setLastModified(false)
.setEtag(false)
);
-}
{
+
+}{
AssetSource www = AssetSource.create(Paths.get("www"));
assets("/static/*", new AssetHandler(www)
.setMaxAge(Duration.ofDays(365))
);
-}
{
+
+}{
AssetSource www = AssetSource.create(Paths.get("www"));
assets("/static/*", new AssetHandler(www)
.cacheControl(path -> {
@@ -6365,9 +6365,9 @@
{
+
+}{
install(new MyTemplateEngineModule()); (1)
get("/", ctx -> {
Map<String, Object> model = ...; (2)
return new ModelAndView("index.html", model); (3)
});
-}
{
+
+}{
install(new MyTemplateEngineModule());
get("/", ctx -> {
@@ -6445,9 +6445,9 @@
(1)
});
-}
{
+
+}{
install(new HandlebarsModule()); (1)
install(new FreemarkerModule()); (2)
@@ -6517,9 +6517,9 @@
(4)
});
-}
In-Memory Session
{
+
+}{
get("/", ctx -> {
Session session = ctx.session(); (1)
@@ -6626,9 +6626,9 @@
(3)
});
-}
In-Memory Session with Custom Cookie
{
+
+}{
setSessionStore(SessionStore.memory(new Cookie("SESSION"))); (1)
get("/", ctx -> {
@@ -6672,9 +6672,9 @@
In-Memory Session with HTTP Header
{
+
+}{
setSessionStore(SessionStore.memory(SessionToken.header("TOKEN"))); (1)
get("/", ctx -> {
@@ -6712,9 +6712,9 @@
{
+
+}{
setSessionStore(SessionStore.memory(SessionToken.comibe(SessionToken.cookie("SESSION"), SessionToken.header("TOKEN")))); (1)
get("/", ctx -> {
@@ -6752,9 +6752,9 @@
Usage
{
+
+}{
String secret = "super secret key"; (1)
setSessionStore(SessionStore.signed(secret)); (2)
@@ -6810,9 +6810,9 @@
Signed with headers
{
+
+}{
String secret = "super secret key"; (1)
setSessionStore(SessionStore.signed(secret, SessionToken.header("TOKEN"))); (2)
@@ -6858,9 +6858,9 @@
WebSocket
{
+
+}{
ws("/ws", (ctx, configurer) -> { (1)
configurer.onConnect(ws -> {
ws.send("Connected"); (2)
@@ -6925,9 +6925,9 @@
Context
{
+
+}{
ws("/ws/{key}", (ctx, configurer) -> {
String key = ctx.path("key").value(); (1)
String foo = ctx.session().get("foo").value(); (2)
...
});
-}
JSON example
import io.jooby.jackson.JacksonModule;
+
+}import io.jooby.jackson.JacksonModule;
{
install(new JackonModule()); (1)
@@ -7030,9 +7030,9 @@
(3)
})
});
-}
Context
import io.jooby.jackson.JacksonModule;
+
+}import io.jooby.jackson.JacksonModule;
{
install(new JackonModule()); (1)
@@ -7080,9 +7080,9 @@
+websocket.idleTimeout = 1h
websocket.idleTimeout = 1h
+websocket.maxSize = 128K
websocket.maxSize = 128K
Server-Sent Events
{
+
+}{
sse("/sse", sse -> { (1)
sse.send("Welcome"); (2)
});
-}
Server-Sent Events
Connection Lost
{
+
+}{
sse("/sse", sse -> {
sse.onClose(() -> {
// clean up
});
});
-}
Keep Alive
{
+
+}{
sse("/sse", sse -> {
sse.keepAlive(15, TimeUnit.SECONDS)
});
-}
import static io.jooby.ExecutionMode.EVENT_LOOP;
+
+}import static io.jooby.ExecutionMode.EVENT_LOOP;
import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7321,16 +7321,16 @@
import static io.jooby.ExecutionMode.EVENT_LOOP;
+
+}import static io.jooby.ExecutionMode.EVENT_LOOP;
import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7373,9 +7373,9 @@
import static io.jooby.ExecutionMode.EVENT_LOOP;
+
+}import static io.jooby.ExecutionMode.EVENT_LOOP;
import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7434,9 +7434,9 @@
import static io.jooby.ExecutionMode.WORKER;
+
+}import static io.jooby.ExecutionMode.WORKER;
import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7486,9 +7486,9 @@
import static io.jooby.ExecutionMode.WORKER;
+
+}import static io.jooby.ExecutionMode.WORKER;
import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7528,9 +7528,9 @@
import static io.jooby.Jooby.runApp;
+
+}import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -7617,9 +7617,9 @@
{
+
+}{
configureServer(server -> {
server.workerThreads(Number);
});
-}
Generate a JSON String from handler
{
+
+}{
get("/json", ctx -> {
ctx.setContentType(MediaType.json);
return "{\"message\": \"Hello Raw Response\"}";
});
-}
Writer example
{
+
+}{
get("/chunk", ctx -> {
try(Writer writer = ctx.responseWriter()) { (1)
writer.write("chunk1"); (2)
@@ -7839,9 +7839,9 @@
(3)
});
-}
Writer example
{
+
+}{
get("/chunk", ctx -> {
return ctx.responseWriter(writer -> { (1)
writer.write("chunk1"); (2)
@@ -7885,9 +7885,9 @@
File download example
{
+
+}{
get("/download-file", ctx -> {
Path source = Paths.get("logo.png");
return new AttachedFile(source); (1)
@@ -7920,9 +7920,9 @@
(2)
});
-}
File download with builder method
FileDownload.Builder produceDownload(Context ctx) {
+
+}FileDownload.Builder produceDownload(Context ctx) {
return FileDownload.build(...);
}
@@ -7963,9 +7963,9 @@
<
{
+
+}{
mode(EVENT_LOOP); (1)
use(ReactiveSupport.concurrent()); (2)
@@ -8008,9 +8008,9 @@
<
... (4)
});
})
-}
<
{
+
+}{
mode(WORKER); (1)
use(ReactiveSupport.concurrent()); (2)
@@ -8064,9 +8064,9 @@
<
... (4)
});
})
-}
<
{
+
+}{
mode(DEFAULT); (1)
use(ReactiveSupport.concurrent()); (2)
@@ -8120,9 +8120,9 @@
<
... (4)
});
})
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-mutiny</artifactId>
- <version>3.0.2</version>
-</dependency>
Uni
import io.jooby.mutiny;
+
+}import io.jooby.mutiny;
import io.smallrye.mutiny.Uni;
{
@@ -8245,9 +8245,9 @@
Uni
.completionStage(supplyAsync(() -> "Uni"))
.map(it -> "Hello " + it);
})
-}
import io.jooby.mutiny;
+
+}import io.jooby.mutiny;
import io.smallrye.mutiny.Multi;
{
@@ -8280,9 +8280,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-rxjava3</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.rxjava3.Reactivex;
+
+}import io.jooby.rxjava3.Reactivex;
{
use(Reactivex.rx());
@@ -8360,9 +8360,9 @@
import io.jooby.rxjava3.Reactivex;
+
+}import io.jooby.rxjava3.Reactivex;
{
use(Reactivex.rx());
@@ -8391,9 +8391,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-reactor</artifactId>
- <version>3.0.2</version>
-</dependency>
Mo
import io.jooby.Reactor;
+
+}import io.jooby.Reactor;
{
use(Reactor.reactor());
@@ -8472,9 +8472,9 @@
Mo
.fromCallable(() -> "Mono")
.map(it -> "Hello " + it);
})
-}
Fl
import io.jooby.Reactor;
+
+}import io.jooby.Reactor;
{
use(Reactor.reactor())
@@ -8503,9 +8503,9 @@
Fl
return Flux.range(1, 10)
.map(it -> it + ", ");
})
-}
{
+
+}{
coroutine {
get("/") {
delay(100) (1)
"Hello Coroutines!" (2)
}
}
-}
{
+
+}{
coroutine {
get("/") {
ctx.doSomething() (1)
@@ -8588,7 +8588,7 @@
(2)
return "Hello Coroutines!" (3)
-}
{
+
+}{
worker(Executors.newCachedThreadPool())
coroutine {
@@ -8628,7 +8628,7 @@
(3)
}
}
-}
{
+
+}{
coroutine(CoroutineStart.UNDISPATCHED) {
get("/") {
val n = 5 * 5 (1)
@@ -8665,7 +8665,7 @@
(3)
}
}
-}
send text
{
+
+}{
get("/", ctx -> {
return ctx.send("Hello World!");
});
-}
{
+
+}{
errorCode(MyException.class, StatusCode.XXX);
-}
Error Handler
{
+
+}{
error((ctx, cause, statusCode) -> { (1)
Router router = ctx.getRouter();
router.getLog().error("found `{}` error", statusCode.value(), cause); (2)
ctx.setResponseCode(statusCode);
ctx.send("found `" + statusCode.value() + "` error"); (3)
});
-}
Error with content negotiation
import static io.jooby.MediaType.json;
+
+}import static io.jooby.MediaType.json;
import static io.jooby.MediaType.html;
{
@@ -8938,9 +8938,9 @@
(5)
}
});
-}
Status Code Error Handler
import static io.jooby.StatusCode.NOT_FOUND;
+
+}import static io.jooby.StatusCode.NOT_FOUND;
{
error(NOT_FOUND, (ctx, cause, statusCode) -> {
ctx.send(statusCode); (1)
});
-}
Exception Handler
{
+
+}{
error(MyException.class, (ctx, cause, statusCode) -> {
// log and process MyException
});
-}
Usage
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.AccessLogHandler;
...
{
@@ -9089,9 +9089,9 @@
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.CorsHandler;
...
{
@@ -9202,9 +9202,9 @@
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.CorsHandler;
...
{
@@ -9264,9 +9264,9 @@
cors {
+
+}cors {
origin: "*"
credentials: true
methods: [GET, POST],
headers: [Content-Type],
maxAge: 30m
exposedHeaders: [Custom-Header]
-}
<form method="POST" action="...">
+
+</form><form method="POST" action="...">
<input name="csrf" value="{{csrf}}" type="hidden" />
...
-</form>
Example
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.GracefulShutdown;
...
{
@@ -9429,15 +9429,15 @@
(1)
// other routes go here
-}
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.HeadHandler;
...
{
@@ -9497,9 +9497,9 @@
<dependency>
+
+</dependency><dependency>
<groupId>com.github.vladimir-bukhtoyarov</groupId>
<artifactId>bucket4j-core</artifactId>
<version>7.6.0</version>
-</dependency>
{
+
+}{
Bandwidth limit = Bandwidth.simple(10, Duration.ofMinutes(1));
Bucket bucket = Bucket4j.builder().addLimit(limit).build(); (1)
before(new RateLimitHandler(bucket)); (2)
-}
10 requests per minute per ip/remote address
{
+
+}{
before(new RateLimitHandler(remoteAddress -> {
Bandwidth limit = Bandwidth.simple(10, Duration.ofMinutes(1));
return Bucket4j.builder().addLimit(limit).build();
}));
-}
{
+
+}{
before(new RateLimitHandler(key -> {
Bandwidth limit = Bandwidth.simple(10, Duration.ofMinutes(1));
return Bucket4j.builder().addLimit(limit).build();
}, "ApiKey"));
-}
{
+
+}{
Bandwidth limit = Bandwidth.simple(10, Duration.ofMinutes(1));
Bucket bucket = Bucket4j.builder().addLimit(limit).build(); (1)
before(new RateLimitHandler(bucket)); (2)
-}
Rate limit in a cluster
{
+
+}{
ProxyManager<String> buckets = ...;
before(RateLimitHandler.cluster(key -> {
return buckets.getProxy(key, () -> {
return ...;
});
}));
-}
<
import io.jooby.Jooby;
+
+}import io.jooby.Jooby;
import io.jooby.TraceHandler;
...
{
@@ -9813,9 +9813,9 @@
<
get("/", ctx -> {
...
});
-}
Initializing the Environment
{
+
+}{
Environment env = getEnvironment();
-}
└── conf
+
+└── myapp.jar└── conf
└── application.conf
-└── myapp.jar
+ Environment env = getEnvironment();
Environment env = getEnvironment();
+└── myapp.jar
- └── application.conf (file inside jar)
└── myapp.jar
+ └── application.conf (file inside jar)
+foo = foo
foo = foo
{
+
+}{
Environment env = getEnvironment(); (1)
Config conf = env.getConfig(); (2)
System.out.println(conf.getString("foo")); (3)
-}
+java -jar myapp.jar foo=argument
java -jar myapp.jar foo=argument
+java -Dfoo=sysprop -jar myapp.jar
java -Dfoo=sysprop -jar myapp.jar
+foo=envar java -jar myapp.jar
foo=envar java -jar myapp.jar
+└── application.conf
-└── application.prod.conf
└── application.conf
+└── application.prod.conf
+foo = foo
-bar = devbar
foo = foo
+bar = devbar
+bar = prodbar
bar = prodbar
Environment options
{
+
+}{
Environment env = setEnvironmentOptions(new EnvOptions() (1)
.setFilename("myapp.conf")
)
-}
Direct instantiation
{
+
+}{
Config conf = ConfigFatory.load("/path/to/myapp.conf"); (1)
Environment env = new Env(customConfig, "prod"); (2)
setEnvironment(env); (3)
-}
<dependency>
+
+</dependency><dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version></version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version></version>
@@ -10315,17 +10315,17 @@
conf
+
+└── logback.prod.confconf
└── logback.conf
-└── logback.prod.conf
public class App extends Jooby {
+
+}public class App extends Jooby {
private static final Logger log = ...
public static void main(String[] args) {
runApp(args, App::new);
}
-}
<dependency>
+
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-test</artifactId>
<version></version>
-</dependency>
public class App extends Jooby {
+
+}public class App extends Jooby {
{
get("/", ctx -> "Easy unit testing!");
}
-}
import io.jooby.MockRouter;
+
+}import io.jooby.MockRouter;
public class TestApp {
@@ -10550,9 +10550,9 @@
public class App extends Jooby {
+
+}public class App extends Jooby {
{
get("/", ctx -> ctx
.setResponseCode(StatusCode.OK)
.send("Easy unit testing")
);
}
-}
public class App extends Jooby {
+
+}public class App extends Jooby {
{
post("/", ctx -> {
String name = ctx.form("name").value();
return name;
});
}
-}
import static org.mockito.Mockito.mock;
+
+}import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class TestApp {
@@ -10703,9 +10703,9 @@
<dependency>
+
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-test</artifactId>
<version></version>
-</dependency>
App
public class App extends Jooby {
+
+}public class App extends Jooby {
{
get("/", ctx -> "Easy testing!");
}
-}
TestApp
import io.jooby.JoobyTest;
+
+}import io.jooby.JoobyTest;
@JoobyTest(App.class)
public class TestApp {
@@ -10820,9 +10820,9 @@
@JoobyTest(App.class)
+
+}@JoobyTest(App.class)
public void test(String serverPath) { (1)
-}
App
public class App extends Jooby {
+
+}public class App extends Jooby {
public App(String argument) { (1)
get("/", ctx -> "Easy testing!");
}
-}
TestApp
import io.jooby.JoobyTest;
+
+}import io.jooby.JoobyTest;
public class TestApp {
@@ -10987,9 +10987,9 @@
(2)
return new App("Argument"); (3)
}
-}
<plugins>
+
+</plugins><plugins>
...
<plugin>
<groupId>io.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</plugin>
...
-</plugins>
<properties>
+
+</properties><properties>
<application.class>myapp.App</application.class>
-</properties>
+mvn jooby:run
mvn jooby:run
<
<plugins>
+
+</plugins><plugins>
...
<plugin>
<groupId>io.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
<configuration>
<mainClass>${application.class}</mainClass> (1)
<restartExtensions>conf,properties,class</restartExtensions> (2)
@@ -11157,16 +11157,16 @@
<
</configuration>
</plugin>
...
-</plugins>
mvn jooby:testRun
and ./gradlew joobyTestRun
they work
+by expanding the classpath to uses the test
scope or source set.
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jetty</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-netty</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-undertow</artifactId>
- <version>3.0.2</version>
-</dependency>
<
import io.jooby.netty.NettyServer;
+
+}import io.jooby.netty.NettyServer;
{
install(new NettyServer());
-}
Server Options
{
+
+}{
setServerOptions(new ServerOptions()
.setBufferSize(16384)
.setCompressionLevel(6)
@@ -11576,9 +11580,9 @@
Hello HTTPS
{
+
+}{
setServerOptions(new ServerOptions()
.setSecurePort(8443) (1)
);
-}
+mkcert -pkcs12 localhost
mkcert -pkcs12 localhost
+mkcert localhost
mkcert localhost
X509
{
+
+}{
SslOptions ssl = SslOptions.x509("path/to/server.crt", "path/to/server.key");
setServerOptions(new ServerOptions()
.setSsl(ssl) (1)
);
-}
server {
+
+}server {
ssl {
type: X509,
cert: "path/to/server.crt",
key: "path/to/server.key"
}
-}
{
+
+}{
setServerOptions(new ServerOptions()
.setSsl(SslOptions.from(getConfig()))
);
-}
PKCS12
{
+
+}{
SslOptions ssl = SslOptions.pkcs12("path/to/server.p12", "password");
setServerOptions(new ServerOptions()
.setSsl(ssl) (1)
);
-}
server {
+
+}server {
ssl {
type: PKCS12,
cert: "path/to/server.p12",
password: "password"
}
-}
{
+
+}{
setServerOptions(new ServerOptions()
.setSsl(SslOptions.from(getConfig()))
);
-}
Client Authentication
{
+
+}{
SslOptions ssl = SslOptions.pkcs12("path/to/server.p12", "password")
.setTrustCert(Files.newInputStream("path/to/trustCert")) (1)
.setTrustPassword("password") (2)
@@ -11921,16 +11925,16 @@
{
+
+}{
setServerOptions(new ServerOptions()
.setSsl(SslOptions.from(getConfig()))
);
-}
TLS example
{
+
+}{
setServerOptions(new ServerOptions()
.setSsl(new SslOptions().setProtocol("TLSv1.3", "TLSv1.2"))
);
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-conscrypt</artifactId>
- <version>3.0.2</version>
-</dependency>
{
+
+}{
setServerOptions(new ServerOptions()
.setHttp2(true)
.setSecurePort(8433)
@@ -12094,9 +12098,9 @@
import io.jooby.Extension;
+
+}import io.jooby.Extension;
public class MyExtension implements Extension {
@@ -12172,9 +12176,9 @@
(4)
}
-}
public class App extends Jooby {
+
+}public class App extends Jooby {
{
install(new MyExtension()); (1)
@@ -12224,9 +12228,9 @@
<dependency>
+
+</dependency><dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.20</version>
-</dependency>
<build>
+
+</build><build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -12312,15 +12316,15 @@
Dagger
import static io.jooby.Jooby.runApp;
+
+}import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -12348,9 +12352,9 @@
MVC and Dagger
import static io.jooby.Jooby.runApp;
+
+}import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -12401,9 +12405,9 @@
MVC and Dagger provider
import static io.jooby.Jooby.runApp;
+
+}import static io.jooby.Jooby.runApp;
public class App extends Jooby {
@@ -12451,9 +12455,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-guice</artifactId>
- <version>3.0.2</version>
-</dependency>
Installing Guice
import io.jooby.guice.GuiceModule;
+
+}import io.jooby.guice.GuiceModule;
import io.jooby.kt.runApp;
public class App extends Jooby {
@@ -12521,9 +12525,9 @@
+currency = USD
currency = USD
MVC and Guice
import io.jooby.guice.GuiceModule;
+
+}import io.jooby.guice.GuiceModule;
import io.jooby.kt.runApp
public class App extends Jooby {
@@ -12606,9 +12610,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-kotlin</artifactId>
- <version>3.0.2</version>
-</dependency>
{
+
+}{
use("*", (req, rsp, chain) -> {
System.out.println("first");
// Moves execution to next handler: second
@@ -13408,7 +13412,7 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-kotlin</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-avaje-jsonb</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.avaje.jsonb.AvajeJsonbModule;
+
+}import io.jooby.avaje.jsonb.AvajeJsonbModule;
{
install(new AvajeJsonbModule()); (1)
@@ -624,9 +624,9 @@
(3)
...
});
-}
Default Jsonb
import io.jooby.avaje.jsonb.AvajeJsonbModule;
+
+}import io.jooby.avaje.jsonb.AvajeJsonbModule;
import io.avaje.jsonb.Jsonb;
{
@@ -678,16 +678,16 @@
Custom Jsonb
import io.jooby.avaje.jsonb.AvajeJsonbModule;
+
+}import io.jooby.avaje.jsonb.AvajeJsonbModule;
import io.avaje.jsonb.Jsonb;
{
var jsonb = Jsonb.builder().build();
install(new AvajeJsonbModule(jsonb));
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-awssdk-v1</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.528</version>
-</dependency>
+aws.accessKeyId = "your access key id"
-aws.secretKey = "your secret key"
aws.accessKeyId = "your access key id"
+aws.secretKey = "your secret key"
import io.jooby.awssdkv1.AwsModule;
+
+}import io.jooby.awssdkv1.AwsModule;
{
install(
@@ -653,9 +653,9 @@
(4)
})
);
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-caffeine</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.caffeine.CaffeineSessionStore;
+
+}import io.jooby.caffeine.CaffeineSessionStore;
{
setSessionStore(new CaffeineSessionStore()); (1)
@@ -618,9 +618,9 @@
(2)
// work with session
});
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-camel</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.camel.CamelModule;
+
+}import io.jooby.camel.CamelModule;
{
install(new CamelModule(new MyRoutes())); (1)
@@ -632,9 +632,9 @@
+myprop = "my prop value"
myprop = "my prop value"
public class MyRoutes extends RouteBuilder {
+
+}public class MyRoutes extends RouteBuilder {
@Override public void configure() throws Exception {
from("direct://foo")
.log("{{myprop}}");
}
-}
import io.jooby.guice.GuiceModule;
+
+}import io.jooby.guice.GuiceModule;
import io.jooby.camel.CamelModule;
{
@@ -736,9 +736,9 @@
(3)
.log("${body}");
}
-}
+camel.main.name = My Camel Context
-camel.threadpool.poolSize = 10
camel.main.name = My Camel Context
+camel.threadpool.poolSize = 10
<!-- DataSource via HikariCP-->
+
+ <version>3.0.3</version>
+</dependency><!-- DataSource via HikariCP-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- Ebean Module-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-ebean</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version></version>
-</dependency>
db.url = "jdbc:mysql://localhost/mydb"
+
+db.password = mypassdb.url = "jdbc:mysql://localhost/mydb"
db.user = myuser
-db.password = mypass
<plugin>
+
+</plugin><plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>${tiles-maven-plugin.version}</version>
@@ -665,9 +665,9 @@
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.ebean.EbeanModule;
{
@@ -699,9 +699,9 @@
(3)
// work with Database
});
-}
TransactionalRequest
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.ebean.EbeanModule;
import io.jooby.ebean.TransactionalRequest;
@@ -763,9 +763,9 @@
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Transactional(false)
@GET("/")
public void get(Context ctx) {
// no automatic transaction management here
-}
TransactionalRequest disabled by default
import io.jooby.ebean.TransactionalRequest;
+
+}import io.jooby.ebean.TransactionalRequest;
{
...
use(new TransactionalRequest().enabledByDefault(false));
...
-}
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Inject
private Database database;
@@ -856,9 +856,9 @@
Transactional for script routes
{
+
+}{
get("/", ctx -> {
...
}).attribute(Transactional.ATTRIBUTE, false);
-}
<
{
+
+}{
DatabaseConfig dbConfig = ...; (1)
install(new EbeanModule(dbConfig)); (2)
-}
<
{
+
+}{
ebean {
ddl {
generate = true
run = true
}
}
-}
<!-- DataSource via HikariCP-->
+
+ <version>3.0.3</version>
+</dependency><!-- DataSource via HikariCP-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- Flyway Module-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-flyway</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version></version>
-</dependency>
db.url = "jdbc:mysql://localhost/mydb"
+
+db.password = mypassdb.url = "jdbc:mysql://localhost/mydb"
db.user = myuser
-db.password = mypass
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.flyway.FlywayModule;
{
@@ -657,16 +657,16 @@
(2)
-}
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.flyway.FlywayModule;
{
@@ -722,9 +722,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-freemarker</artifactId>
- <version>3.0.2</version>
-</dependency>
+<p> Hello ${name}! </p>
<p> Hello ${name}! </p>
import io.jooby.freemarker.FreemarkerModule;
+
+}import io.jooby.freemarker.FreemarkerModule;
{
install(new FreemarkerModule());
@@ -630,9 +630,9 @@
+freemarker.cacheStorage = soft
-freemarker.strictSyntax = yes
freemarker.cacheStorage = soft
+freemarker.strictSyntax = yes
import io.jooby.freemarker.FreemarkerModule;
+
+}import io.jooby.freemarker.FreemarkerModule;
{
Configuration freemarker = new Configuration();
install(new FreemarkerModule(freemarker));
-}
<!-- GraphQL-->
+
+ <version>3.0.3</version>
+</dependency><!-- GraphQL-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-graphql</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- JSON library-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
import io.jooby.graphql.GraphQLModule;
{
@@ -672,9 +672,9 @@
HTTP GET
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
import io.jooby.graphql.GraphQLModule;
{
install(new GraphQLModule(...)
.setSupportHttpGet(true)
);
-}
<!-- JSON library-->
+
+ <version>3.0.3</version>
+</dependency><!-- JSON library-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- GraphQL-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-graphql</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- GraphIQL-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-graphiql</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
import io.jooby.graphql.GraphQLModule;
import io.jooby.graphql.GraphiQLModule;
@@ -861,9 +861,9 @@
(2)
install(new GraphiQLModule()); (3)
-}
<!-- JSON library-->
+
+ <version>3.0.3</version>
+</dependency><!-- JSON library-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- GraphQL-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-graphql</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- GraphQL Playground-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-graphiql-playground</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
import io.jooby.graphql.GraphQLModule;
import io.jooby.graphql.GraphQLPlaygroundModule;
@@ -953,9 +953,9 @@
(2)
install(new GraphQLPlaygroundModule()); (3)
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-gson</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.json.GsonModule;
+
+}import io.jooby.json.GsonModule;
{
install(new GsonModule()); (1)
@@ -624,9 +624,9 @@
(3)
...
});
-}
Default object mapper
import io.jooby.json.GsonModule;
+
+}import io.jooby.json.GsonModule;
{
install(new GsonModule());
@@ -677,15 +677,15 @@
Custom ObjectMapper
import io.jooby.json.GsonModule;
+
+}import io.jooby.json.GsonModule;
{
Gson gson = new GsonBuilder().create();
install(new GsonModule(gson));
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-guice</artifactId>
- <version>3.0.2</version>
-</dependency>
Installing Guice
import io.jooby.guice.GuiceModule;
+
+}import io.jooby.guice.GuiceModule;
import io.jooby.kt.runApp;
public class App extends Jooby {
@@ -621,9 +621,9 @@
+currency = USD
currency = USD
MVC and Guice
import io.jooby.guice.GuiceModule;
+
+}import io.jooby.guice.GuiceModule;
import io.jooby.kt.runApp
public class App extends Jooby {
@@ -706,9 +706,9 @@
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-handlebars</artifactId>
- <version>3.0.2</version>
-</dependency>
+<p> Hello {{name}}! </p>
<p> Hello {{name}}! </p>
import io.jooby.handlebars.HandlebarsModule;
+
+}import io.jooby.handlebars.HandlebarsModule;
{
install(new HandlebarsModule());
@@ -630,9 +630,9 @@
import io.jooby.handlebars.HandlebarsModule;
+
+}import io.jooby.handlebars.HandlebarsModule;
{
Handlebars handlebars = new Handlebars();
@@ -683,9 +683,9 @@
<!-- DataSource via HikariCP-->
+
+ <version>3.0.3</version>
+</dependency><!-- DataSource via HikariCP-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- Hibernate Module-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hibernate</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version></version>
-</dependency>
db.url = "jdbc:mysql://localhost/mydb"
+
+db.password = mypassdb.url = "jdbc:mysql://localhost/mydb"
db.user = myuser
-db.password = mypass
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.hibernate.HibernateModule;
{
install(new HikariModule()); (1)
@@ -682,9 +682,9 @@
(9)
}
});
-}
TransactionalRequest
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.hibernate.HibernateModule;
import io.jooby.hibernate.TransactionalRequest;
@@ -816,9 +816,9 @@
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Transactional(false)
@GET("/")
public void get(Context ctx) {
// no automatic transaction management here
-}
TransactionalRequest disabled by default
import io.jooby.ebean.TransactionalRequest;
+
+}import io.jooby.ebean.TransactionalRequest;
{
...
use(new TransactionalRequest().enabledByDefault(false));
...
-}
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Inject
private EntityManager entityManager;
@@ -933,9 +933,9 @@
Transactional for script routes
{
+
+}{
get("/", ctx -> {
...
}).attribute(Transactional.ATTRIBUTE, false);
-}
{
+
+}{
get("/pets", ctx -> require(UnitOfWork.class)
.apply(em -> em.createQuery("from Pet", Pet.class).getResultList()));
-}
{
+
+}{
get("/update", ctx -> require(UnitOfWork.class)
.apply((em, txh) -> {
em.createQuery("from Pet", Pet.class).getResultList().forEach(pet -> {
@@ -1023,9 +1023,9 @@
{
+
+}{
use(new TransactionalRequest());
// will lead to exception
get("/nope", ctx -> require(UnitOfWork.class)
.apply(em -> em.createQuery("from Pet", Pet.class).getResultList()));
-}
+hibernate.hbm2ddl.auto = create
hibernate.hbm2ddl.auto = create
{
+
+}{
install(new HibernateModule().with(builder -> {
return builder
.flushMode(AUTO)
.openSession();
}));
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version></version>
-</dependency>
db.url = "jdbc:mysql://localhost/mydb"
+
+db.password = mypassdb.url = "jdbc:mysql://localhost/mydb"
db.user = myuser
-db.password = mypass
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
{
install(new HikariModule());
@@ -649,9 +649,9 @@
Custom database prefix
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
{
install(new HikariModule("mydb"));
-}
No properties
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
{
install(new HikariModule("jdbc:mysql://localhost/mydb"));
-}
maindb.url = "jdbc:mysql://localhost/main"
+
+auditdb.password = mypassmaindb.url = "jdbc:mysql://localhost/main"
maindb.user = myuser
maindb.password = mypass
auditdb.url = "jdbc:mysql://localhost/audit"
auditdb.user = myuser
-auditdb.password = mypass
db.url = "jdbc:mysql://localhost/main"
+
+hikari.maximumPoolSize = 10db.url = "jdbc:mysql://localhost/main"
db.user = myuser
-hikari.maximumPoolSize = 10
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jackson</artifactId>
- <version>3.0.2</version>
-</dependency>
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
install(new JacksonModule()); (1)
@@ -625,9 +625,9 @@
(3)
...
});
-}
Default object mapper
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
install(new JacksonModule());
@@ -678,15 +678,15 @@
Custom ObjectMapper
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
ObjectMapper mapper = new ObjectMapper();
install(new JacksonModule(mapper));
-}
XmlMapper
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
install(new JacksonModule(new XmlMapper()));
-}
XmlMapper
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
install(new JacksonModule(new ObjectMapper()));
install(new JacksonModule(new XmlMapper()));
-}
Provisioning Modules
import io.jooby.json.JacksonModule;
+
+}import io.jooby.json.JacksonModule;
{
install(new JacksonModule().module(MyModule.class);
-}
<dependency>
+
+ <version>3.0.3</version>
+</dependency><dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jasypt</artifactId>
- <version>3.0.2</version>
-</dependency>
jasypt.password = password (1)
+
+enc.property = "uTSqb9grs1+vUv3iN8lItC0kl65lMG+8" (2)jasypt.password = password (1)
-enc.property = "uTSqb9grs1+vUv3iN8lItC0kl65lMG+8" (2)
import io.jooby.jasypt.JasyptModule;
+
+}import io.jooby.jasypt.JasyptModule;
{
install(new JasyptModule()); (3)
@@ -634,9 +634,9 @@
(4)
System.out.println(property);
-}
import io.jooby.jasypt.JasyptModule;
+
+}import io.jooby.jasypt.JasyptModule;
{
install(new JasyptModule());
PBEStringEncryptor encryptor = require(PBEStringEncryptor.class);
-}
+jasypt.password = mypassword
-jasypt.password = ${?JASYPT_PASSWORD}
jasypt.password = mypassword
+jasypt.password = ${?JASYPT_PASSWORD}
{
+
+}{
install(new JasyptModule(config -> {
return new String(Files.path(Paths.get("mypassword"), UTF-8));
}));
-}
jasypt.password = mypassword
+
+jasypt.providerName = SunJCEjasypt.password = mypassword
jasypt.algorithm = PBEWithMD5AndDES
jasypt.keyObtentionIterations = 1000
jasypt.poolSize = 2
jasypt.ivGeneratorClassName = classname
jasypt.saltGeneratorClassName = org.jasypt.salt.RandomSaltGenerator
-jasypt.providerName = SunJCE
<!-- DataSource via HikariCP-->
+
+ <version>3.0.3</version>
+</dependency><!-- DataSource via HikariCP-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
</dependency>
<!-- Jdbi Module-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jdbi</artifactId>
- <version>3.0.2</version>
-</dependency>
<dependency>
+
+</dependency><dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version></version>
-</dependency>
db.url = "jdbc:mysql://localhost/mydb"
+
+db.password = mypassdb.url = "jdbc:mysql://localhost/mydb"
db.user = myuser
-db.password = mypass
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.jdbi.JdbiModule;
{
@@ -671,9 +671,9 @@
TransactionalRequest
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.jdbi.JdbiModule;
import io.jooby.jdbi.TransactionalRequest;
@@ -749,9 +749,9 @@
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Transactional(false)
@GET("/")
public void get(Context ctx) {
// no automatic transaction management here
-}
TransactionalRequest disabled by default
import io.jooby.ebean.TransactionalRequest;
+
+}import io.jooby.ebean.TransactionalRequest;
{
...
use(new TransactionalRequest().enabledByDefault(false));
...
-}
@Transactional
import io.jooby.annotation.Transactional;
+
+}import io.jooby.annotation.Transactional;
@Inject
private Handle handle;
@@ -847,9 +847,9 @@
Transactional for script routes
{
+
+}{
get("/", ctx -> {
...
}).attribute(Transactional.ATTRIBUTE, false);
-}
SQLObjects
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.jdbi.JdbiModule;
import io.jooby.jdbi.TransactionalRequest;
@@ -911,9 +911,9 @@
<
import io.jooby.hikari.HikariModule;
+
+}import io.jooby.hikari.HikariModule;
import io.jooby.jdbi.JdbiModule;
import io.jooby.jdbi.TransactionalRequest;
@@ -954,9 +954,9 @@
<
Jdbi jdbi = Jdbi.create(dataSource);
return jdbi;
});
-}
JStachio A type-safe Java Mustache templating engine.
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jstachio</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
@JStache(path="index.mustache") (1)
-public record IndexPage(String message){}
+@JStache(path="index.mustache") (1)
+public record IndexPage(String message){}
<p>Hello {{message}}!</p>
+<p>Hello {{message}}!</p>
import io.jooby.jstachio.JStachioModule;
+import io.jooby.jstachio.JStachioModule;
{
install(new JStachioModule()); (1)
@@ -686,9 +686,9 @@ (2)
});
-}
+}
import io.jooby.jstachio.JStachioModule;
+import io.jooby.jstachio.JStachioModule;
{
install(new JStachioModule().bufferSize(1024));
-}
+}
<dependencies>
+<dependencies>
<dependency>
<groupId>io.jstach</groupId>
<artifactId>jstachio-jmustache</artifactId>
- <version>1.3.0</version>
+ <version>1.3.1</version>
<scope>runtime</scope>
</dependency>
-<dependencies>
+<dependencies>
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jte</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<plugin>
+<plugin>
<groupId>gg.jte</groupId>
<artifactId>jte-maven-plugin</artifactId>
<version>${jte.version}</version>
@@ -631,9 +631,9 @@
+</plugin>
@param String name
+@param String name
-<p>Hello ${name}!</p>
+<p>Hello ${name}!</p>
import io.jooby.jte.JteModule;
+import io.jooby.jte.JteModule;
{
install(new JteModule(Paths.of("src", "main", "jte"))); (1)
@@ -685,9 +685,9 @@ (2)
});
-}
+}
<plugin>
+<plugin>
<groupId>gg.jte</groupId>
<artifactId>jte-maven-plugin</artifactId>
<version>${jte.version}</version>
@@ -754,9 +754,9 @@
+</plugin>
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jwt</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-kafka</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
kafka.producer.bootstrap.servers = "localhost:9092"
+kafka.producer.bootstrap.servers = "localhost:9092"
kafka.producer.key.serializer = "org.apache.kafka.common.serialization.StringSerializer"
kafka.producer.value.serializer = "org.apache.kafka.common.serialization.StringSerializer"
kafka.consumer.bootstrap.servers = "localhost:9092"
kafka.consumer.key.deserializer = "org.apache.kafka.common.serialization.StringDeserializer"
-kafka.consumer.value.deserializer = "org.apache.kafka.common.serialization.StringDeserializer"
+kafka.consumer.value.deserializer = "org.apache.kafka.common.serialization.StringDeserializer"
import io.jooby.kafka.KafkaModule;
+import io.jooby.kafka.KafkaModule;
{
install(new KafkaModule()); (1)
@@ -638,9 +638,9 @@
+}
<!-- Metrics Module-->
+<!-- Metrics Module-->
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-metrics</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
{
+{
install(new MetricsModule()
.metric("memory", new MemoryUsageGaugeSet())
.metric("threads", new ThreadStatesGaugeSet())
.metric("gc", new GarbageCollectorMetricSet())
.metric("fs", new FileDescriptorRatioGauge()));
-}
+}
{
+{
install(new MetricsModule()
.healthCheck("deadlock", new ThreadDeadlockHealthCheck());
-}
+}
{
+{
use(new Metricsuse());
// inspected route
get("/", context -> "Hello metrics!");
-}
+}
{
+{
install(new MetricsModule()
.threadDump();
-}
+}
{
+{
install(new MetricsModule()
.reporter(registry -> {
ConsoleReporter reporter = ConsoleReporter.forRegistry(registry)
@@ -767,9 +767,9 @@
+}
{
+{
MetricRegistry metricRegistry = new MetricRegistry();
HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry();
@@ -805,9 +805,9 @@
+}
{
+{
install(new MetricsModule("/diag")
.threadDump();
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-node</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
{
+{
"name": "myapp",
"version": "1.0.0",
"scripts": {
"build": "echo \"Default task\"" (1)
}
-}
+}
import io.jooby.node.NpmModule;
+import io.jooby.node.NpmModule;
{
install(new NpmModule("v12.16.1")); (2)
-}
+}
import io.jooby.node.NpmModule;
+import io.jooby.node.NpmModule;
{
install(new NpmModule("v12.16.1")
.execute("run", "local") (1)
);
-}
+}
<properties>
+<properties>
<application.class>myapp.App</application.class>
</properties>
...
@@ -629,7 +629,7 @@ <
<plugin>
<groupId>io.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
- <version>3.0.2</version>
+ <version>3.0.3</version>
<executions>
<execution>
<goals>
@@ -638,12 +638,12 @@ <
</execution>
</executions>
</plugin>
-</plugins>
+</plugins>
<dependency>
+<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version></version>
-</dependency>
+</dependency>
@OpenAPIDefinition(
+@OpenAPIDefinition(
info = @Info(
title = "Title",
description = "description",
@@ -966,9 +966,9 @@
+}
@Tag(name = "Pets", description = "Pet operations")
+@Tag(name = "Pets", description = "Pet operations")
class App extends Jooby {
{
// All routes now have the default tag: `Pets`
}
-}
+}
@Tag(name = "Pets", description = "Pet operations")
+@Tag(name = "Pets", description = "Pet operations")
@Path("/pets")
class Pets {
// All web method now have the default tag: `Pets`
-}
+}
@Tag(name = "Pets", description = "Pet operations")
+@Tag(name = "Pets", description = "Pet operations")
public List<Pet> list(Context ctx) {
...
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-swagger-ui</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-redoc</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-pac4j</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
import io.jooby.pac4j.Pac4jModule;
+import io.jooby.pac4j.Pac4jModule;
{
install(new Pac4jModule()); (1)
@@ -629,9 +629,9 @@ (2)
return "Hello " + user.getId();
});
-}
+}
<dependency>
+<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-oidc</artifactId>
<version>5.7.0</version>
-</dependency>
+</dependency>
oidc.clientId = 167480702619-8e1lo80dnu8bpk3k0lvvj27noin97vu9.apps.googleusercontent.com
-oidc.secret = MhMme_Ik6IH2JMnAT6MFIfee
+oidc.clientId = 167480702619-8e1lo80dnu8bpk3k0lvvj27noin97vu9.apps.googleusercontent.com
+oidc.secret = MhMme_Ik6IH2JMnAT6MFIfee
import io.jooby.pac4j.Pac4jModule;
+import io.jooby.pac4j.Pac4jModule;
{
install(new Pac4jModule()
@@ -720,9 +720,9 @@
+}
<dependency>
+<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-oauth</artifactId>
<version>5.7.0</version>
-</dependency>
+</dependency>
<dependency>
+<dependency>
<groupId>org.pac4j</groupId>
<artifactId>pac4j-jwt</artifactId>
<version>5.7.0</version>
-</dependency>
+</dependency>
jwt.salt = CoxUiYwQOSFDReZYdjigBA
+jwt.salt = CoxUiYwQOSFDReZYdjigBA
import io.jooby.pac4j.Pac4jModule;
+import io.jooby.pac4j.Pac4jModule;
{
install(new Pac4jModule()
@@ -866,9 +866,9 @@
+}
import io.jooby.pac4j.Pac4jModule;
+import io.jooby.pac4j.Pac4jModule;
{
install(new Pac4jModule()
@@ -907,9 +907,9 @@ <
return ...;
})
);
-}
+}
{
+{
install(
new Pac4jModule()
.client("/api/*", new MyTestAuthorizer(), conf -> {...});
);
-}
+}
{
+{
install(
new Pac4jModule()
.client("/api/*", MyTestAuthorizer.class, conf -> {...});
);
-}
+}
import io.jooby.pac4j.Pac4jModule;
+import io.jooby.pac4j.Pac4jModule;
import org.pac4j.core.config.Config;
{
@@ -996,9 +996,9 @@
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-pebble</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<p> Hello {{name}}! </p>
+<p> Hello {{name}}! </p>
import io.jooby.pebble.PebbleModule;
+import io.jooby.pebble.PebbleModule;
{
install(new PebbleModule());
@@ -630,9 +630,9 @@
+}
import io.jooby.pebble.PebbleModule;
+import io.jooby.pebble.PebbleModule;
{
// Apply custom configuration via builder
@@ -684,9 +684,9 @@
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-quartz</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
import io.jooby.quartz.QuartzModule;
+import io.jooby.quartz.QuartzModule;
{
install(new QuartzModule(SampleJob.class));
-}
+}
import io.quartz.Scheduled;
+import io.quartz.Scheduled;
import org.quartz.Job;
@@ -652,9 +652,9 @@
+}
import io.quartz.Scheduled;
+import io.quartz.Scheduled;
public class SampleJob {
@@ -699,9 +699,9 @@
+}
import io.quartz.Scheduled;
+import io.quartz.Scheduled;
public class SampleJob {
@@ -742,9 +742,9 @@
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-hikari</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
import io.jooby.hikari.HikariModule;
+import io.jooby.hikari.HikariModule;
import io.jooby.quartz.QuartzModule;
{
install(new HikariModule());
install(new QuartzModule(SampleJob.class));
-}
+}
db.url = "jdbc:mysql://localhost/mydb"
+db.url = "jdbc:mysql://localhost/mydb"
db.user = "myuser"
db.password = "mypassword"
-org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
+org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
# Set number of threads to use, default is to use the number of available processor
-org.quartz.threadPool.threadCount = 2
+# Set number of threads to use, default is to use the number of available processor
+org.quartz.threadPool.threadCount = 2
{
+{
Scheduler scheduler = QuartzModule.newScheduler(this);
// configure scheduler as you need it
install(new QuartzModule(scheduler, SampleJob.class));
-}
+}
org.quartz.jobs.SampleJob.execute.enabled = false
+org.quartz.jobs.SampleJob.execute.enabled = false
import io.jooby.quartz.QuartzApp
+import io.jooby.quartz.QuartzApp
import io.jooby.quartz.QuartzModule;
{
install(new QuartzModule(SampleJob.class));
use("/scheduler", new QuartzApp());
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-redis</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
redis = "redis://localhost:6379"
+redis = "redis://localhost:6379"
import io.jooby.redis.RedisModule;
+import io.jooby.redis.RedisModule;
import io.lettuce.core.api.StatefulRedisConnection;
{
@@ -631,9 +631,9 @@ (2)
// work with redis
});
-}
+}
import io.jooby.redis.RedisModule;
+import io.jooby.redis.RedisModule;
import io.lettuce.core.api.StatefulRedisConnection;
{
@@ -710,9 +710,9 @@
+}
foo = "redis://server1:6379"
+foo = "redis://server1:6379"
-bar = "redis://server2:6379"
+bar = "redis://server2:6379"
import io.jooby.redis.RedisModule;
+import io.jooby.redis.RedisModule;
import io.jooby.redis.RedisSessionStore;
import io.lettuce.core.RedisClient;
@@ -762,9 +762,9 @@ (3)
// HTTP session is backed by Redis
});
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-rocker</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<plugin>
+<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<version>1.3.0</version>
@@ -627,9 +627,9 @@
+</plugin>
@args (String message)
+@args (String message)
-<p>Hello @message!</p>
+<p>Hello @message!</p>
import io.jooby.rocker.RockerModule;
+import io.jooby.rocker.RockerModule;
{
install(new RockerModule()); (1)
@@ -680,9 +680,9 @@ (2)
});
-}
+}
import io.jooby.rocker.RockerModule;
+import io.jooby.rocker.RockerModule;
{
install(new RockerModule().bufferSize(1024));
-}
+}
import io.jooby.rocker.RockerModule;
+import io.jooby.rocker.RockerModule;
{
install(new RockerModule().reuseBuffer(true));
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-thymeleaf</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
<!DOCTYPE html>
+<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<p>
Hello <span th:text="${name}">World</span>
</p>
</body>
-</html>
+</html>
import io.jooby.thymeleaf.ThymeleafModule;
+import io.jooby.thymeleaf.ThymeleafModule;
{
install(new ThymeleafModule());
@@ -637,9 +637,9 @@
+}
import io.jooby.thymeleaf.ThymeleafModule;
+import io.jooby.thymeleaf.ThymeleafModule;
{
TemplateEngine templateEngine = new TemplateEngine();
// configure as need it
install(new ThymeleafModule(templateEngine));
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-whoops</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
import io.jooby.whoops.WhoopsModule;
+import io.jooby.whoops.WhoopsModule;
{
install(new WhoopsModule()); (1)
@@ -622,9 +622,9 @@ (2)
});
-}
+}
<dependency>
+<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-yasson</artifactId>
- <version>3.0.2</version>
-</dependency>
+ <version>3.0.3</version>
+</dependency>
import io.jooby.json.YassonModule;
+import io.jooby.json.YassonModule;
{
install(new YassonModule()); (1)
@@ -624,9 +624,9 @@ (3)
...
});
-}
+}
import io.jooby.json.YassonModule;
+import io.jooby.json.YassonModule;
{
install(new YassonModule());
@@ -677,15 +677,15 @@
+}
import io.jooby.json.YassonModule;
+import io.jooby.json.YassonModule;
{
Jsonb jsonb = JsonbBuilder.create();
install(new YassonModule(jsonb));
-}
+}
<build>
+ <build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
@@ -631,15 +631,15 @@
+ </build>
dependencies {
- annotationProcessor "io.jooby:jooby-apt:3.0.2"
-}
+dependencies {
+ annotationProcessor "io.jooby:jooby-apt:3.0.3"
+}
<build>
+ <build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
@@ -847,9 +847,9 @@
+ </build>
tasks.withType(JavaCompile) {
+tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters'
options.debug = true
-}
+}