diff --git a/index.html b/index.html index f025e69..1c92c5f 100644 --- a/index.html +++ b/index.html @@ -570,7 +570,7 @@

Welcome to Jooby!

by Edgar Espina
-3.0.10 +3.1.0
Table of Contents
@@ -711,6 +711,7 @@

Welcome to Jooby!

  • 7. Templates
  • 8. Session @@ -854,7 +855,8 @@

    Welcome to Jooby!

  • Java
    Kotlin
    -
    import io.jooby.Jooby;
    +
    import io.jooby.Jooby;
     
     public class App extends Jooby {
     
    @@ -941,15 +943,15 @@ 

    +}
    @@ -960,7 +962,7 @@

    -

    Latest Release: 3.0.10.

    +

    Latest Release: 3.1.0.

    Looking for a previous version?

    @@ -1026,7 +1028,7 @@

    Script with sub-class:

    Java
    Kotlin

    Java
    Kotlin
    Java
    Kotlin
    -
    import io.jooby.annotation.*;
    +
    import io.jooby.annotation.*;
     
     public class MyController {
     
    @@ -1122,9 +1124,9 @@ 

    +}
    @@ -1187,7 +1189,7 @@

    Creates a Maven Kotlin project:
    -
    jooby> create myapp --kotlin
    +
    jooby> create myapp --kotlin
    @@ -1310,13 +1312,13 @@

    Creates a Gradle Java project:
    -
    jooby> create myapp --gradle
    +
    jooby> create myapp --gradle
    Creates a Gradle Kotlin project:
    -
    jooby> create myapp --gradle --kotlin
    +
    jooby> create myapp --gradle --kotlin
    Java
    Kotlin
    -
    {
    +
    {
       get("/", ctx -> "Snippet");
    -}
    +}
    Java
    Kotlin
    @@ -1619,21 +1621,21 @@

    Single path variable:
    Java
    Kotlin
    -
    {
    +
    {
       (1)
       get("/user/{id}", ctx -> {
         int id = ctx.path("id").intValue(); (2)
         return id;
       });
    -}
    +}
    Java
    Kotlin
    -
    {
    +
    {
       (1)
       get("/file/{file}.{ext}", ctx -> {
         String filename = ctx.path("file").value(); (2)
         String ext = ctx.path("ext").value();   (3)
         return filename + "." + ext;
       });
    -}
    +}
    Java
    Kotlin
    -
    {
    +
    {
       (1)
       get("/profile/{id}?", ctx -> {
         String id = ctx.path("id").value("self"); (2)
         return id;
       });
    -}
    +}
    Java
    Kotlin
    -
    {
    +
    {
       (1)
       get("/user/{id:[0-9]+}", ctx -> {
         int id = ctx.path("id").intValue(); (2)
         return id;
       });
    -}
    +}
    Java
    Kotlin
    -
    interface Filter {
    +
    interface Filter {
       Handler apply(Handler next);
    -}
    +}
    -
    interface Before {
    +
    interface Before {
       void apply(Context ctx);
    -}
    +}
    @@ -2080,16 +2082,16 @@

    -
    interface After {
    +
    interface After {
       void apply(Context ctx, Object result, Throwable failure);
    -}
    +}
    Functional Handler:
    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         System.out.println(result);          (1)
         ctx.setResponseHeader("foo", "bar"); (2)
    @@ -2098,9 +2100,9 @@ 

    +}
    @@ -2134,7 +2136,7 @@

    Side-Effect Handler:

    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         System.out.println(result);          (1)
         ctx.setResponseHeader("foo", "bar"); (2)
    @@ -2143,9 +2145,9 @@ 

    +}
    @@ -2182,7 +2184,7 @@

    Safe After:

    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         if (ctx.isResponseStarted()) {
           // Don't modify response
    @@ -2190,9 +2192,9 @@ 

    +}
    @@ -2226,7 +2228,7 @@

    Run code depending of success or failure responses:

    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         if (failure == null) {
           db.commit();                   (1)
    @@ -2234,9 +2236,9 @@ 

    (2) } }); -}

    +}
    @@ -2254,21 +2256,21 @@

    Recover fom exception and produces an alternative output:

    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         if (failure instanceOf MyBusinessException) {
           ctx.send("Recovering from something");        (1)
         }
       });
    -}
    +}
    @@ -2289,7 +2291,7 @@

    Suppressed exceptions:

    Java
    Kotlin
    -
    {
    +
    {
       after((ctx, result, failure) -> {
         ...
         throw new AnotherException();
    @@ -2304,9 +2306,9 @@ 

    (1) Throwable anotherException = failure.getSuppressed()[0]; (2) }); -}

    +}
    @@ -2351,7 +2353,7 @@

    Example

    Java
    Kotlin
    Java
    Kotlin
    -
    {
    +
    {
       routes(() -> {
     
         get("/", ctx -> "Hello");
     
       });
    -}
    +}
    Java
    Kotlin
    Java
    Kotlin
    Java
    Kotlin
    Java
    Kotlin
    @@ -2967,7 +2969,7 @@

    Dynamic Routing
    Java
    Kotlin
    Java
    Kotlin
    -
    import io.jooby.Jooby;
    +
    import io.jooby.Jooby;
     ...
     {
     
       setHiddenMethod(ctx -> ctx.header("X-HTTP-Method-Override").toOptional());  (1)
    -}
    +}
    Java
    Kotlin
    Java
    Kotlin
    Java
    Kotlin
    @@ -4044,7 +4046,7 @@

    Java
    Kotlin
    Java
    Kotlin
    -
    {
    +
    {
       post("/string", ctx -> {
         String body = ctx.body().value();        (1)
         ...
    @@ -4733,9 +4735,9 @@ 

    (3) ... }); -}

    +}
    Java
    Kotlin
    @@ -4886,7 +4888,7 @@

    <
    Response body
    Java
    Kotlin
    Java
    Kotlin
    @@ -5067,20 +5069,20 @@

    build.gradle
    Java
    Kotlin
    -
    tasks.withType(JavaCompile) {
    +
    tasks.withType(JavaCompile) {
         options.compilerArgs += [
             '-parameters',
             '-Ajooby.incremental=true',
             '-Ajooby.services=true'
         ]
    -}
    +}
    Java
    Kotlin
    @@ -5189,7 +5191,7 @@

    Simple MVC route registration

    Java
    Kotlin
    -
    public class App extends Jooby {
    +
    public class App extends Jooby {
       {
         mvc(new MyController());
       }
    @@ -5197,15 +5199,15 @@ 

    +}
    @@ -5216,7 +5218,7 @@

    Class MVC route registration

    Java
    Kotlin
    -
    public class App extends Jooby {
    +
    public class App extends Jooby {
       {
         mvc(MyController.class);
       }
    @@ -5224,15 +5226,15 @@ 

    +}
    @@ -5257,7 +5259,7 @@

    Provider MVC route registration

    Java
    Kotlin
    -
    import jakarta.inject.Provider;
    +
    import jakarta.inject.Provider;
     
     public class App extends Jooby {
       {
    @@ -5269,9 +5271,9 @@ 

    +}
    @@ -5306,21 +5308,21 @@

    Headers

    Java
    Kotlin
    -
    public class MyController {
    +
    public class MyController {
     
       @GET
       public Object provisioning(@HeaderParam String token) {  (1)
         ...
       }
    -}
    +}
    Java
    Kotlin
    -
    public class MyController {
    +
    public class MyController {
     
       @GET
       public Object provisioning(@HeaderParam("Last-Modified-Since") long lastModifiedSince) {
         ...
       }
    -}
    +}
    @@ -5366,21 +5368,21 @@