Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 09 12:14
    dzmitrybeinia opened #2616
  • Aug 04 19:42
    jryan128 opened #2615
  • Aug 04 11:33
    madskaddie opened #2614
  • Jul 29 15:55

    jknack on 2.x

    Add FUNDING/sponsor file (compare)

  • Jul 25 13:28
    jknack closed #2611
  • Jul 25 13:28

    jknack on 2.x

    App should return 400 code if f… Merge pull request #2612 from e… (compare)

  • Jul 25 13:28
    jknack closed #2612
  • Jul 25 13:28
    jknack milestoned #2612
  • Jul 22 17:26
    agentgt commented #2613
  • Jul 22 16:02
    agentgt edited #2613
  • Jul 22 15:53
    agentgt commented #2613
  • Jul 22 15:40
    agentgt opened #2613
  • Jul 22 06:27
    extbe synchronize #2612
  • Jul 21 20:26
    extbe opened #2612
  • Jul 21 18:32
    extbe commented #2611
  • Jul 21 15:06
    jknack commented #2611
  • Jul 21 15:03
    extbe commented #2611
  • Jul 21 14:50
    jknack commented #2611
  • Jul 21 13:05
    agentgt commented #2611
  • Jul 21 11:29
    extbe edited #2611
Nguyen Huu Tuan
@snowyukischnee
i just dont want to define everything inside my main
Edgar Espina
@jknack
class A extens Jooby {
   {
      mvc(Controller.class);
   }
}
Then:
Nguyen Huu Tuan
@snowyukischnee
public static void main(String[] args) {
        Jooby.runApp(args, app -> {
            // app name
            app.setName(App.class.getSimpleName());
            app.install(new GracefulShutdown());
            app.decorator(new AccessLogHandler());
            app.error(new HttpDefaultJsonHandler());
            // metrics
            app.install(new MetricsModule("/actuator")
                    .threadDump()
                    .ping()
                    .healthCheck("deadlock", new ThreadDeadlockHealthCheck())
                    .metric("memory", new MemoryUsageGaugeSet())
                    .metric("threads", new ThreadStatesGaugeSet())
                    .metric("gc", new GarbageCollectorMetricSet())
                    .metric("fs", new FileDescriptorRatioGauge())
            );
            // openapi
            app.install(new CustomOpenAPIModule(RouterConfig.class));
            // dependency injection
            app.install(new GuiceModule(
                    // inject here
            ));

            app.mvc(CustomerController.class);
        });
    }
like this
Edgar Espina
@jknack
Jooby.runApp(args, app -> {
    app.use(new A());
})
that is supported by open api
and follow the design/goal of extensions: infrasture support
Nguyen Huu Tuan
@snowyukischnee
so I'll have to define every config inside the instance?
since I've familiar with spring and I just want to rewrite my project using a different framework
Edgar Espina
@jknack
don’t follow
What you show me, looks good. Just remove the install you did for your custom module:
```
public static void main(String[] args) {
        Jooby.runApp(args, app -> {
            // app name
            app.setName(App.class.getSimpleName());
            app.install(new GracefulShutdown());
            app.decorator(new AccessLogHandler());
            app.error(new HttpDefaultJsonHandler());
            // metrics
            app.install(new MetricsModule("/actuator")
                    .threadDump()
                    .ping()
                    .healthCheck("deadlock", new ThreadDeadlockHealthCheck())
                    .metric("memory", new MemoryUsageGaugeSet())
                    .metric("threads", new ThreadStatesGaugeSet())
                    .metric("gc", new GarbageCollectorMetricSet())
                    .metric("fs", new FileDescriptorRatioGauge())
            );
            // openapi
            app.install(new OpenApiModule());
            // dependency injection
            app.install(new GuiceModule(
                    // inject here
            ));

            app.mvc(CustomerController.class);
        });
    }
```
Nguyen Huu Tuan
@snowyukischnee
okay
Edgar Espina
@jknack
Another thing to keep in mind if you come from Spring
is the Guice bean scope: prototype (new insance each time)
while spring ccontroller are singleton by default
Nguyen Huu Tuan
@snowyukischnee
yes, i've see the different
another question
in the mvc controller, how can i define a filter
i cant find it anywhere inside the mvc api section
Edgar Espina
@jknack
well yea, we don’t have that type of composition/isolation yet
the way it works is like every other route
so if you need a filter for a controller:
decorator(next -> ctx -> …);

mvc(Controller.class);
so that route run before all controller routes
Nguyen Huu Tuan
@snowyukischnee
oh
Edgar Espina
@jknack
yea, controller methods are “expanded” as lambda routes by APT proccessor
pipeline works exactly the same
Nguyen Huu Tuan
@snowyukischnee
so i might switch to router
i've worked with expressjs before
Edgar Espina
@jknack
yea it is similar
Nguyen Huu Tuan
@snowyukischnee
and this router look similar
Edgar Espina
@jknack
1.x was identical
2.x is similar not identical
Nguyen Huu Tuan
@snowyukischnee
i've not look into the 1.x yet
Edgar Espina
@jknack
sequential pipeline is identical
Nguyen Huu Tuan
@snowyukischnee
i just discover this framework yesterday
Edgar Espina
@jknack
except that a pipeline is executed over a matched route
in 1.x pipeline is always executed, no matter if there is a matching route handler at the end or not
Nguyen Huu Tuan
@snowyukischnee
you mean in 2.x only the match routes are executed?
Edgar Espina
@jknack
yes
Nguyen Huu Tuan
@snowyukischnee
@jknack does use(Router) is the same with mount(Router), since i've look into the source code and see that the use method would call the mount method
however, if i using jooby-openapi to generate api spec, the mount() will not work and use() works
Edgar Espina
@jknack
good catch
we need to fix this
Nguyen Huu Tuan
@snowyukischnee
@jknack also jooby-openapi do not generate the example i defined using annotation
reddierocket
@reddierocket
Can someone send me a link on how to set up TLS 1.2 or 1.3 with Jooby 2 using Netty? I'm not finding anything in my searches, but someone ran a security scan and using ssl was a vulnerability that was cited, with a recommendation to use TLS 1.2 or greater. Thanks.
Emmanuel Oga
@EmmanuelOga
did you see this? https://jooby.io/#server-ssl
Nguyen Huu Tuan
@snowyukischnee
Hi, how can I enable http2 support for jooby 2.x