Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:13

    jknack on 2.x

    Enable netty ws compression for… Merge pull request #2400 from a… (compare)

  • 15:13
    jknack closed #2400
  • 15:13
    jknack labeled #2400
  • 15:13
    jknack milestoned #2400
  • 15:13
    jknack milestoned #2367
  • 15:13
    jknack labeled #2367
  • 15:13
    jknack edited #2367
  • 15:12
    jknack commented #2367
  • 15:10
    jknack closed #2367
  • 15:10

    jknack on 2.x

    After handler must reflect erro… (compare)

  • Jul 21 09:01
    apaulau opened #2400
  • Jul 20 18:11
    GitRowin synchronize #2367
  • Jul 20 15:21
    cmitchell opened #2399
  • Jul 20 00:45
    dependabot[bot] labeled #2398
  • Jul 20 00:45
    dependabot[bot] labeled #2398
  • Jul 20 00:45
    dependabot[bot] opened #2398
  • Jul 20 00:45

    dependabot[bot] on maven

    Bump ebean.version from 12.8.3 … (compare)

  • Jul 20 00:41

    jknack on 2.x

    change dependabot frequency to … (compare)

  • Jul 20 00:36
    dependabot[bot] labeled #2397
  • Jul 20 00:36
    dependabot[bot] labeled #2397
Edgar Espina
@jknack
if that doesn’t work, you can rely on path patterns
Jonathan Curran
@joncfoo
Gotcha, that would mean that I can't mix unauthenticated + authenticated methods in a MVC class that is defined after installing the module.
lospejos
@lospejos
@jknack Still no 2.9.5 version?
Edgar Espina
@jknack
@joncfoo That’s right
@lospejos not yet, will try tomorrow
Edgar Espina
@jknack
lospejos
@lospejos
@jknack jooby 2.9.5 is out - that's good news, thanks!
Deepak Arora
@deepakarora3
Hi, I am trying to use jooby for hosting an api which will be protected by a JWT token. I have a jar file which I have to use for validating the token. The question is - what is the preferred way to validate the JWT token before the path is hit? In other words, lets say I have three routes set up /foo/1, /foo/2 and /foo/3. And lets say I have 3 different JWT tokens which are used to authorize access to each of these routes. Will creating 3 scoped decorators (one for each route) work? Or do I have 1 handler for all three and I call the validation from inside of the handler based on the path? Sorry if I am sounding a bit confused but right now I guess I am. Just to make my scenario more clear, had it been a heavyweight framework like JEE, a servlet filter would have been used for this purpose. Any help would be greatly appreciated.
Marcel Stör
@marcelstoer
@jknack would fixing jooby-project/jooby#2252 be as easy as switching that constructor parameter in NettyPush?
andychan82
@andychan82

I am trying to use the openapi annotation to create swagger doc, not sure how to work with the parameters when using script api
Here is the code i am using , and it failed during maven build

Please help. Thanks.

code

public class App extends Jooby {

    {
        install(new GsonModule());
        install(new OpenAPIModule());   
        get("/test/test", this::test);

    }

    public static void main(final String[] args) {
        runApp(args, App::new);
    }

    @Operation(
            description = "test",
            parameters = {@Parameter(name = "token", in = ParameterIn.QUERY)},
            requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = ApiRequest.class)))
    )
    public ApiRequest test( 
            Context ctx) {
        ctx.setResponseType(MediaType.json);
        return new ApiRequest();
    }

}

error

[ERROR] Failed to execute goal io.jooby:jooby-maven-plugin:2.9.5:openapi (default) on project swagger-test: execution of openapi resulted in exception: Parameter not found: token at  position: 0 for annotation: {name=token, in=[Ljava.lang.String;@1f018dd} -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.jooby:jooby-maven-plugin:2.9.5:openapi (default) on project swagger-test: execution of openapi resulted in exception
......
Caused by: org.apache.maven.plugin.MojoFailureException: execution of openapi resulted in exception
    at io.jooby.maven.BaseMojo.execute(BaseMojo.java:83)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    ... 24 more
Caused by: java.lang.IllegalArgumentException: Parameter not found: token at  position: 0 for annotation: {name=token, in=[Ljava.lang.String;@1f018dd}
    at io.jooby.internal.openapi.OpenAPIParser.parameters(OpenAPIParser.java:450)
    at io.jooby.internal.openapi.OpenAPIParser.lambda$operation$57(OpenAPIParser.java:380)
    at io.jooby.internal.openapi.AsmUtils.annotationList(AsmUtils.java:108)
    at io.jooby.internal.openapi.OpenAPIParser.operation(OpenAPIParser.java:380)
......
Marcel Stör
@marcelstoer

@jknack would fixing jooby-project/jooby#2252 be as easy as switching that constructor parameter in NettyPush?

If so, I could easily raise a PR to that effect.

Max De Marzi
@maxdemarzi
Got a weird issue.
I am able to run unit tests just fine... but when I try to DEBUG a unit test in Intellij IDEA on Jooby 2.9.5 using Java 11, I get a ClassNotFoundException for org.junit.internal.AssumptionViolatedException
Max De Marzi
@maxdemarzi
nevermind... had a java exception breakpoint set I forgot about...
Max De Marzi
@maxdemarzi
Also I've been using Rocker for template but https://github.com/casid/jte seems to be 25% to 100% faster. Maybe a good addition to Jooby?
Bart van Deenen
@bvdeenen
Hi Jooby people
I'm trying to find if there's a maximum number of concurrent tcp connections for jooby-jetty somewhere? We're currently facing a performance issue with an http/1 client (we will upgrade it), but for now it looks like we might be hitting a tcp connections limit
sameer
@SameerChorge94

Hello Guys,
i am new to jooby graphql development
i referenced below jooby graphql-starter example to setup the graphql server with java
https://github.com/jooby-project/jooby/tree/2.x/starters/graphql-starter

i have some doubts related to the setting up the graphql resolvers context with jooby server setup
As per the project requirements i need to set the databases sessions and some information in graphql context which also need a way to get the same context reference in datafetcher used in above example
anyone have suggestions or workarounds regarding same?

andrendp
@andrendp

I am trying to use the openapi annotation to create swagger doc, not sure how to work with the parameters when using script api
Here is the code i am using , and it failed during maven build

Please help. Thanks.

code

public class App extends Jooby {

    {
        install(new GsonModule());
        install(new OpenAPIModule());   
        get("/test/test", this::test);

    }

    public static void main(final String[] args) {
        runApp(args, App::new);
    }

    @Operation(
            description = "test",
            parameters = {@Parameter(name = "token", in = ParameterIn.QUERY)},
            requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = ApiRequest.class)))
    )
    public ApiRequest test( 
            Context ctx) {
        ctx.setResponseType(MediaType.json);
        return new ApiRequest();
    }

}

error

[ERROR] Failed to execute goal io.jooby:jooby-maven-plugin:2.9.5:openapi (default) on project swagger-test: execution of openapi resulted in exception: Parameter not found: token at  position: 0 for annotation: {name=token, in=[Ljava.lang.String;@1f018dd} -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.jooby:jooby-maven-plugin:2.9.5:openapi (default) on project swagger-test: execution of openapi resulted in exception
......
Caused by: org.apache.maven.plugin.MojoFailureException: execution of openapi resulted in exception
    at io.jooby.maven.BaseMojo.execute(BaseMojo.java:83)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    ... 24 more
Caused by: java.lang.IllegalArgumentException: Parameter not found: token at  position: 0 for annotation: {name=token, in=[Ljava.lang.String;@1f018dd}
    at io.jooby.internal.openapi.OpenAPIParser.parameters(OpenAPIParser.java:450)
    at io.jooby.internal.openapi.OpenAPIParser.lambda$operation$57(OpenAPIParser.java:380)
    at io.jooby.internal.openapi.AsmUtils.annotationList(AsmUtils.java:108)
    at io.jooby.internal.openapi.OpenAPIParser.operation(OpenAPIParser.java:380)
......

Did you manage to sort this out? I get the same issue with 2.9.5 where I cannot add any parameters. I have followed the docs to the tee but with no luck.

Or is there any other working examples on how to get the parameters into the swagger openapi.json

Here is even a more basic one that still gives the issue:

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(){
        return "Bla";
    }

Then I also get the following error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':openAPI'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    ...
andychan82
@andychan82

Here is even a more basic one that still gives the issue:

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(){
        return "Bla";
    }

Then I also get the following error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':openAPI'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    ...

try this

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(@QueryParam String id){
        return "Bla";
    }
andrendp
@andrendp

Here is even a more basic one that still gives the issue:

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(){
        return "Bla";
    }

Then I also get the following error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':openAPI'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    ...

try this

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(@QueryParam String id){
        return "Bla";
    }

Still no luck my side:

 @GET
    @Operation(
            summary = "Find a pet by ID",
            description = "Find a pet by ID or throws a 404",
            parameters = { @Parameter(name = "id", description = "Pet ID") }
    )
    public String test(@QueryParam String id){
        return "Bla";
    }
Execution failed for task ':openAPI'.
> Parameter not found: id at  position: 0 for annotation: {in=[Ljava.lang.String;@6b20ffcf, name=id, description=Pet ID}

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':openAPI'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.ja
Rishav Sharan
@rishavs
Hi. I am completely new to the JVM/Kotlin ecosystem and wanted to use Kooby as an entry point. Have a few questions that I hope you folks can help me with.
  1. Which server to choose between Jetty, Netty and Undertow? Which one would you recommend a beginner to use?
  2. Are there any benefits to using the MVS api/annotations? from the code samples, i prefer the cleaner script api but don't know enough to choose between the two
Hashim Sayyid
@Sayyiditow
  1. I would prefer undertow but since this is an embedded servlet, does not really matter.
  2. Its more of a preference again. I would use MVC style for huge apps to separate the diff concerns and not have everything in one huge file.
Edgar Espina
@jknack
Antoine DAVID
@antoinedvd

Hi folks, someone has already create a Unit Test for resource with an App that use the Hikari Module ?
I follow this link jooby-project/jooby#1891 but I don't understand how to mock Hikari ?
For me it's not possible due to this line (https://github.com/jooby-project/jooby/blob/34eb70cf2583e317d3c77f94d165bc8be7520bb5/modules/jooby-hikari/src/main/java/io/jooby/hikari/HikariModule.java#L209).
My App.java code :

public class App extends Jooby {
    {
        install(new HikariModule());
[...]
    }
}

The unit test execute the new HikariModule() that try to create a connection to a database...
My unit test method :

    @Test
    @SneakyThrows
    void getSensors() {
        final var router = new MockRouter( new App());
}
Marcel Stör
@marcelstoer
@jknack will you consider merging jooby-project/jooby#2370 to fix a critical security issue (at least reported as critical) for 1.x?
Facundo Parra
@facup94

Hi! I'm having some issues combining dynamic routing (mount with predicates) and DI with Guice and mvc() primitives.
This is throwing "Service not found" exception

public class V1 extends Jooby {
  {
    install(new GuiceModule());
    mvc(PingController.mvc);
  }
}

public class App extends Jooby {
  {
    mount(ctx -> ctx.header("version").value().equals("v1"), new V1()); 
  }
}
curl localhost:8080/ping
io.jooby.exception.RegistryException: Service not found: project.controllers.PingController

How can I solve it?

Facundo Parra
@facup94

This also fails. I don't understand really how mvc + Guice primitives work.

Jooby app = new Jooby();
app.install(new GuiceModule());
app.mvc(PingController.class);
mount(app);

But this works:

mvc(PingController.class);
Edgar Espina
@jknack