The modular web framework for Java and Kotlin

Overview

Maven Central Javadoc Build Status Github Join the chat at https://gitter.im/jooby-project/jooby Become a Patreon Donate

∞ do more, more easily

Jooby is a modern, performant and easy to use web framework for Java and Kotlin built on top of your favorite web server.

Java:

import static org.jooby.Jooby.runApp;

public class App {

  public static void main(final String[] args) {
    runApp(args, app -> {
      app.get("/", ctx -> "Welcome to Jooby!");
    });
  }
}

Kotlin:

import org.jooby.runApp

fun main(args: Array<String>) {
  runApp(args) {
    get ("/") {
      "Welcome to Jooby!"
    }
  }
}

documentation

Documentation is available at https://jooby.io

help

Gitter

donate & support

1.x version

Documentation for 1.x is available at https://jooby.io/v1

Source code for 1.x is available at the 1.x branch

author

Edgar Espina

license

Apache License 2

Comments
  • APITool slows down startup drastically

    APITool slows down startup drastically

    The API tool is very good and useful for documentation, but is rarely accessed. Yet causes very slow start ups.

    With ApiTool:

    [2018-07-23 15:09:40,081]-[main] INFO c.z.s.App - [local@netty]: Server started in 34232ms

    Without ApiTool:

    [2018-07-23 15:10:09,926]-[main] INFO c.z.s.App - [local@netty]: Server started in 2860ms

    We looked into running the maven apitool but we can't configure it, and also has some issues.

    com.fasterxml.jackson.databind.JsonMappingException: Index: 0, Size: 0 (through reference chain: java.util.ArrayList[5]->org.jooby.apitool.RouteMethod["response"]->org.jooby.apitool.RouteResponse["type"])
    	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:391)
    	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:351)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1711)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:290)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
    	at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
    	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
    	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
    	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
    	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
    	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2985)
    	at org.jooby.internal.apitool.BytecodeRouteParser.read(BytecodeRouteParser.java:364)
    	at org.jooby.internal.apitool.BytecodeRouteParser.lambdas(BytecodeRouteParser.java:595)
    	at org.jooby.internal.apitool.BytecodeRouteParser.parse(BytecodeRouteParser.java:397)
    	at org.jooby.apitool.ApiParser.parse(ApiParser.java:295)
    	at org.jooby.apitool.ApiParser.parseFully(ApiParser.java:310)
    	at org.jooby.internal.apitool.APIProvider.<init>(APIProvider.java:225)
    	at org.jooby.internal.apitool.APIProvider$$FastClassByGuice$$9b325895.newInstance(<generated>)
    	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
    	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
    	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    	at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:60)
    	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:148)
    	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    	at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
    	at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
    	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    	at com.google.inject.Guice.createInjector(Guice.java:87)
    	at com.google.inject.Guice.createInjector(Guice.java:78)
    	at org.jooby.Jooby.lambda$new$0(Jooby.java:885)
    	at org.jooby.Jooby.bootstrap(Jooby.java:2996)
    	at org.jooby.Jooby.start(Jooby.java:2197)
    	at org.jooby.Jooby.start(Jooby.java:2178)
    	at org.jooby.Jooby.run(Jooby.java:2107)
    	at co.zeekit.server.App.main(App.java:296)
    Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    	at java.util.ArrayList.get(ArrayList.java:433)
    	at org.jooby.internal.apitool.TypeJsonDeserializer.deserialize(TypeJsonDeserializer.java:226)
    	at org.jooby.internal.apitool.TypeJsonDeserializer.deserialize(TypeJsonDeserializer.java:217)
    	at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
    	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
    	... 35 common frames omitted
    
    Process finished with exit code 130 (interrupted by signal 2: SIGINT)
    
    bug apitool 
    opened by aclowkey 26
  • jooby future

    jooby future

    jooby 2

    After a long consideration of existing implementation, ideas described in #926, evaluation of new frameworks (specially from Go but also http4k)... found some time to draw what and how Jooby 2 is going to look and work.

    As always, your feedback is welcome.

    design

    • Single Context object replaces Request and Response
    • Route Handler is now a function (returns a value)
    • Filter is now a function and they are not tied to a route pattern. They are group and composed using as functions
    • Route chain/pipeline replaced by functional filter
    • Run code in the IO Thread
    • Router algorithm now matches a single Handler. We can't add multiple handlers to same route
    • No more greedy Ant path pattern: **
    • There will be a clear difference between query, path and form parameters. Must get rid of the generic Request.param(String) method
    • Root package will be io.jooby
    • Remove DI/Guice from core

    contracts

    interface Context {
      //... merge of Request/Response objects from 1.x
    }
    
    interface Handler {
      Object apply(Context ctx);
    }
    
    interface Filter {
      Handler apply(Handler next);
    
      default Filter then(Filter next) {
        return h -> apply(next.apply(h));
      }
    
      default Handler then(Handler next) {
        return ctx -> apply(next).apply(ctx);
      }
    }
    
    interface Router {
    
      Handler match(String method, String path);
    
      //.. usual router methods
    }
    

    examples

    HelloWorld

    {
      get("/", ctx -> "Hello world!");
    }
    

    Nothing new, except we replaced the (Request, Response) signature by (Context)

    Filter

    {
      /** Timing filter: */
      filter(next -> {
        return ctx -> {
          long start = System.currentTimeMillis();
          Object response = next.apply(ctx);
          long end = System.currentTimeMillis();
          System.out.println("Took: " + (end - start));
          return response;
        };
      });
    
      get("/", ctx -> "Hello world!");
    }
    

    Here the timing filter applies to all the route defined bellow it.

    Filters are not tied to a path pattern anymore, the Route.Chain was replaced by a function composition.

    Scoped Filter

    {
      group(() -> {
        /** JWT auth filter: */
        filter(new JWTToken());
    
        get("/api/pets", ctx -> ...);
      });
    }
    

    Here the JWT filter applies to all the route defined below which are wrapped by group operator.

    unit tests

    As expected unit test will be easily to write due we use a functional approach:

    @Test
    public void easyTest() {
       Context ctx = mock();
       Router router = ...;
       Handler handler = router.match("/");
       Object response = handler.apply(ctx);
       assertEquals("Hello world!", response);
    }
    

    path pattern

    We are going to remove the greedy Ant path pattern, so patterns like:

    • '/foo/**'
    • '/foo/**/bar'

    won't work any more

    The new router algorithm will be a port of go-chi

    thread model

    We are going to keep the worker thread as default execution mode, also going to allow to execute a route in the IO thread:

    {
        mode(Mode.IO); // Default is WORKER
    
        worker(ForkJoinPool.commonPool()); // Set a default worker or Fallback to `server` worker executor
    
        get("/", ctx -> "from IO thread");
    
        dispatch(() -> {
          get("/default-worker", ctx -> "from worker thread"); // Run with default worker executor
        });
    
        dispatch(executor, () -> {
          get("/executor", ctx -> "from custom executor thread"); // Run with a custom executor
        });
    }
    

    Filters are going run properly (not like in 1.x where they are ignored #996)

    Just a quick preview of what is coming in 2.x

    As always, your feedback is welcome.

    help wanted feedback 
    opened by jknack 25
  • Failed joobyRun on Apple M1 Silicon

    Failed joobyRun on Apple M1 Silicon

    How can I resolve this?

    ✦ ➜ ./gradlew joobyRun
    > Task :kaptGenerateStubsKotlin UP-TO-DATE
    > Task :kaptKotlin UP-TO-DATE
    > Task :compileKotlin UP-TO-DATE
    > Task :compileJava NO-SOURCE
    > Task :processResources NO-SOURCE
    > Task :classes UP-TO-DATE
    > Task :joobyRun FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':joobyRun'.
    > /Users/max/Library/Caches/JNA/temp/jna7013481395428920527.tmp: dlopen(/Users/max/Library/Caches/JNA/temp/jna7013481395428920527.tmp, 1): no suitable image found.  Did find:
      	/Users/max/Library/Caches/JNA/temp/jna7013481395428920527.tmp: no matching architecture in universal wrapper
      	/Users/max/Library/Caches/JNA/temp/jna7013481395428920527.tmp: no matching architecture in universal wrapper
    
    enhancement jooby:run 
    opened by max-bertinetti 18
  • LiveReload does not work with Gradle Project

    LiveReload does not work with Gradle Project

    With gradle the LiveReload throws the following exception:

    C:\dev\sandbox\joobytest\my-app>gradlew joobyRun
    :compileJava UP-TO-DATE
    :processResources NO-SOURCE
    :classes UP-TO-DATE
    :joobyRun
    >>> jooby:run[info|Daemon worker Thread 2]: Hotswap available on: [C:\dev\sandbox\joobytest\my-app]
    >>> jooby:run[info|Daemon worker Thread 2]:   includes: [**/*.class;**/*.conf;**/*.properties;**/*.html]
    >>> jooby:run[info|Daemon worker Thread 2]:   excludes: []
    [2017-08-02 14:18:29,019]-[HotSwap] INFO  com.mycompany.App - Stopped
    [2017-08-02 14:18:29,024]-[HotSwap] ERROR com.mycompany.App - An error occurred while starting the application:
    com.google.inject.CreationException: Unable to create injector, see the following errors:
    
    1) No implementation for java.util.Set<org.jooby.filewatcher.FileEventOptions> was bound.
      while locating java.util.Set<org.jooby.filewatcher.FileEventOptions>
        for the 4th parameter of org.jooby.filewatcher.FileMonitor.<init>(FileMonitor.java:252)
      at org.jooby.filewatcher.FileWatcher.configure(FileWatcher.java:540)
    
    1 error
            at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
            at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            at com.google.inject.Guice.createInjector(Guice.java:99)
            at com.google.inject.Guice.createInjector(Guice.java:84)
            at org.jooby.Jooby.lambda$new$0(Jooby.java:884)
            at org.jooby.Jooby.bootstrap(Jooby.java:2948)
            at org.jooby.Jooby.start(Jooby.java:2161)
            at org.jooby.Jooby.start(Jooby.java:2142)
            at org.jooby.Jooby.run(Jooby.java:2072)
            at com.mycompany.App.main(App.java:20)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.jooby.run.Main.lambda$startApp$1(Main.java:427)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
    >>> jooby:run[error|HotSwap]: com.mycompany.App.start() resulted in error
    java.lang.NullPointerException
            at org.jooby.run.Main.lambda$startApp$1(Main.java:432)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
    

    Example Project: https://github.com/JStumpp/jooby-gradle-livereload

    bug gradle livereload 
    opened by JStumpp 18
  • Same module Generated Classes not being imported in generated MVC resources

    Same module Generated Classes not being imported in generated MVC resources

    We use another maven annotation processor to create immutable data classes (https://immutables.github.io/). When we define these immutable classes inside the same maven module as Jooby, it appears that the MVC processor doesn't generated an import for the jooby generated module class. At runtime, this gives us a NoClassDefFoundError.

    Interestingly, if our generated data classes are in a different module, Jooby is properly able to create import statements.

    For example public SourceConnectionTestResult testSource(SourceConnectionTestRequest testRequest) a resource defined like this (both the argument and return are immutables generated classes) ends up generating a module

    that looks like

    var2 = app.post("/source/test", (ctx) -> {
          SourceResource var2 = (SourceResource)provider.get();
          return var2.testSource((SourceConnectionTestRequest)ctx.body(SourceConnectionTestRequest.class));
        });
        var2.setReturnType(SourceConnectionTestResult.class);
    

    While this code is correct, the class doesn't have any import statements for SourceConnectionTestResult or SourceConnectionTestRequest.

    I played around with different package configurations, and that doesn't seem to change the error.

    My naive guess here is that there's a race/ordering issue with both of these annotation processors running in the same maven module.

    question 
    opened by tpoll 17
  • jooby2.x io.jooby.Usage: Router not found

    jooby2.x io.jooby.Usage: Router not found

    hello, I have set according to the documentation

    <plugin>
    			<artifactId>maven-compiler-plugin</artifactId>
    			<version>3.8.1</version>
    			<configuration>
    				<forceJavacCompilerUse>true</forceJavacCompilerUse>
    				<!-- 
    				<compilerArgs>
    					<arg>-parameters</arg>
    				</compilerArgs> 
    				-->
    				<annotationProcessorPaths>
    					<path>
    					    <groupId>org.projectlombok</groupId>
    					    <artifactId>lombok</artifactId>
    					    <version>1.18.12</version>
    					</path>
    					<path>
    						<groupId>io.jooby</groupId>
    						<artifactId>jooby-apt</artifactId>
    						<version>2.8.1</version>
    					</path>
    				</annotationProcessorPaths>
    			</configuration>
    		</plugin>
    		<plugin>
    			<groupId>io.jooby</groupId>
    			<artifactId>jooby-maven-plugin</artifactId>
    			<version>2.8.1</version>
    			<configuration>
    				<mainClass>${application.class}</mainClass>
    				<restartExtensions>conf,properties,class</restartExtensions>
    				<compileExtensions>java,kt</compileExtensions>
    				<port>8080</port>
    			</configuration>
    		</plugin>
    

    But after I modified the code Console output error

    io.jooby.Usage: Router not found: cn.ef.modules.sys.action.DownloadAct. Make sure Jooby annotation processor is configured properly. For more details, please visit: https://jooby.io/usage#annotation-processing-tool-router-not-found at io.jooby.Usage.apt (Usage.java:62) at io.jooby.Usage.mvcRouterNotFound (Usage.java:41) at io.jooby.Jooby.lambda$null$3 (Jooby.java:323) at java.util.Optional.orElseThrow (Optional.java:290) at io.jooby.Jooby.lambda$mvc$4 (Jooby.java:323) at java.util.Optional.orElseGet (Optional.java:267) at io.jooby.Jooby.mvc (Jooby.java:320) at io.jooby.Jooby.mvc (Jooby.java:310)

    bug 
    opened by j2eekingcn 17
  • Exception when using RAML with MVC Routes

    Exception when using RAML with MVC Routes

    Hello, check this out:

    I get this exception when I try to use the RAML module with MVC routes:

    java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class

    This is how I'm using:

    new Raml().install(this);

    I've also tried like this:

    new Raml().filter(routeSpec -> routeSpec.pattern().startsWith("/user")).install(this);

    To no avail.

    Do you know what I might be doing wrong?

    Thanks

    bug 
    opened by paulovictorv 17
  • Async Request Feature Request

    Async Request Feature Request

    No sure if I'm simply not finding it in the docs, but async request processing would be great. If Jooby had support for async and modules for ebean and akka I know a lot of folks that would be happy dropping the playframework.

    research feature 
    opened by noboomu 17
  • V2 module grammar including multiple domains and a 'dir' idiom

    V2 module grammar including multiple domains and a 'dir' idiom

    It may actually be compatible/possible in the V1.2x codebase, but seeing as V2 is being designed here is what I'd love to see in Jooby:

    Demo of decomposition of Jooby application that includes 'domains' and 'directories'

    That demo's repo showing tracing output from the running of that representative Jooby application

    What the demo is showcasing is the nesting of directories and a Jooby app serving two domains (through a single 80/443 port):

    1. dir(..) and Dir is similar to the existing path, but implicitly directories are bounded by '/' chars in URLs.

    2. domain(..) and Domain are not currently modeled in Jooby.

    Another difference is that the instead of Runnable (as in path(str, Runnable)), there is JoobyComponent (would implement most of the methods of DSL Jooby today).

    feature 
    opened by paul-hammant 16
  • Upgrade to pac4j v1.8

    Upgrade to pac4j v1.8

    We just released pac4j v1.8 and as Jooby uses it for authentication, it should be upgraded.

    pac4j v1.8 is a major version as it is now a full security engine and not only an authentication one for Facebook, Twitter...: it now supports REST/web services as well as authorizations. Which allows implementations (like jooby-pac4j) to become full security libraries. Configuration can now be handled at the pac4j level (-> https://github.com/pac4j/pac4j/tree/master/pac4j-core/src/main/java/org/pac4j/core/config) as well as profile storage (-> https://github.com/pac4j/pac4j/blob/master/pac4j-core/src/main/java/org/pac4j/core/profile/ProfileManager.java).

    The idea with pac4j v1.8 is not only to have implementations which are close, but to provide guidelines on how to implement pac4j and have the same algorithm implemented for all frameworks/tools, making evolutions and adoption easier.

    If you read: https://github.com/pac4j/pac4j,

    There are now two kinds of clients (= authentication mechanims):

    • indirect / stateful clients are for UI when the user authenticates once at an external provider (like Facebook, a CAS server...) or via a local form (or basic auth popup)
    • direct / stateless clients are for web services when credentials (like basic auth, tokens...) are passed for each HTTP request.

    To define your security configuration, gather all your authentication mechanisms = clients via the Clients class (to share the same callback url). Also define your authorizers to check authorizations and aggregate both (clients and authorizers) on the Config. Notice you may also use the ConfigSingleton object to keep one instance of your configuration and share it among the different components (if you don't have any dependency injection capability). You can also use the ConfigFactory to build you configuration if no other mean is available.

    To secure your Java web application, the reference implementation is to create two "filters": one to protect urls, the other one to receive callbacks for stateful authentication processes (indirect clients):

    1. For your protection "filter", it must be based on two String parameters: clientName (list of clients used for authentication) and authorizerName (list of authorizers to check authorizations) and use the following logic: loop on direct clients for authentication then check the user profile and authorizations
    2. For your callback "filter", get the credentials and the user profile on the callback url.

    We moved things really far as you can see that both implementations between J2E and Play for example are very very close: https://github.com/pac4j/j2e-pac4j/blob/master/src/main/java/org/pac4j/j2e/filter/RequiresAuthenticationFilter.java#L91 vs https://github.com/pac4j/play-pac4j/blob/master/play-pac4j-java/src/main/java/org/pac4j/play/java/RequiresAuthenticationAction.java#L95.

    Even the README are organized the same way with the same texts for common parts. The associated demos have been upgraded and that should be done for: https://github.com/pac4j/jooby-pac4j-demo as well. The README of the demo can be copy/pasted from the one for J2E and updated. There is even a specific logo for the jooby-pac4j implementation: https://pac4j.github.io/pac4j/img/logo-jooby.png which should appear at the top of the README demo and of the implementation documentation: http://jooby.org/doc/pac4j/

    If you have any question or need any help, don't hesitate.

    enhancement 
    opened by leleuj 16
  • OpenAPI and routes operator

    OpenAPI and routes operator

    Again me bringing a OpenAPI issue (I have to apologize for it!)...

    It seems that when I have this: mvc(UserSettingsController())

    openAPI correctly parses and displays the results.

    However if I have this:

    routes {
            decorator(RequireRole(StaffRole, CustomerRole))
            mvc(UserSettingsController())
        }
    

    than openAPI will not show anything. The perpetrator here is the routes{} scoping. I need it since different routes have different decorators, but I also realized that removing it does give me my docs back.

    Maybe someone can help

    invalid openapi 
    opened by Flavsditz 15
  • Websocket idle cleanup close causing exception in undertow

    Websocket idle cleanup close causing exception in undertow

    Starting a jooby app with undertow results in this exception after a couple of minutes:

    [worker I/O-5] ERROR io.jooby.Kooby - Websocket resulted in exception: /test
    java.io.IOException: UT002002: Channel is closed
    	at io.undertow.websockets.core.WebSocketChannel.send(WebSocketChannel.java:354)
    	at io.undertow.websockets.core.WebSockets.sendInternal(WebSockets.java:906)
    	at io.undertow.websockets.core.WebSockets.sendInternal(WebSockets.java:900)
    	at io.undertow.websockets.core.WebSockets.sendClose(WebSockets.java:856)
    	at io.undertow.websockets.core.WebSockets.sendClose(WebSockets.java:831)
    	at io.jooby.internal.utow.UtowWebSocket.handleClose(UtowWebSocket.java:251)
    	at io.jooby.internal.utow.UtowWebSocket.onCloseMessage(UtowWebSocket.java:241)
    	at io.undertow.websockets.core.AbstractReceiveListener.onFullCloseMessage(AbstractReceiveListener.java:189)
    	at io.undertow.websockets.core.AbstractReceiveListener$1.complete(AbstractReceiveListener.java:136)
    	at io.undertow.websockets.core.AbstractReceiveListener$1.complete(AbstractReceiveListener.java:124)
    	at io.undertow.websockets.core.BufferedBinaryMessage.read(BufferedBinaryMessage.java:95)
    	at io.undertow.websockets.core.AbstractReceiveListener.readBufferedBinary(AbstractReceiveListener.java:124)
    	at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:98)
    	at io.undertow.websockets.core.AbstractReceiveListener.onClose(AbstractReceiveListener.java:62)
    	at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:50)
    	at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33)
    	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:959)
    	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:939)
    	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
    	at io.undertow.conduits.IdleTimeoutConduit$1.run(IdleTimeoutConduit.java:84)
    	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
    	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
    

    Jooby version: 2.16.1

    question undertow 
    opened by U1F984 1
  • how to use datasource in mvc class

    how to use datasource in mvc class

    How to use hikari datasource in MVC class

    File: App.java

    package app;

    import io.jooby.Jooby; import io.jooby.hikari.HikariModule; import javax.sql.DataSource;

    public class App extends Jooby {

    {
    	install(new HikariModule());
    	mvc(new Usercontroller());  
    	DataSource DS = require(DataSource.class);
        }
    
    public static void main(final String[] args) {
        runApp(args, App::new);
    }
    

    }

    File: Usercontroller.java

    package app;

    import io.jooby.Jooby; import io.jooby.annotations.*; import io.jooby.MediaType; import io.jooby.Context;

    @Path("/api-v1") public class Usercontroller {

    public String sayHi(Context ctx) {
        // want to use Hikari DataSource here
        ctx.setResponseCode(200);
        ctx.setResponseType(MediaType.json);
        String q = ctx.query("q").value();
        return "{\"message\": \"Hello Raw Response" + q + "\"}";
    }
    
    @Path("/pvc")
    @GET
    public String sayHi2(Context ctx) {
        //ctx.setResponseCode(401);                  
        ctx.setResponseType(MediaType.json);
        return "{\"message\": \"Hello PVC Response\"}";
    }
    

    }

    No documentation found, plz help

    question 
    opened by paliwalsam 1
  • Jooby does smth that causes ZipFileClosed error while reading resource from classpath.

    Jooby does smth that causes ZipFileClosed error while reading resource from classpath.

    I have some component that takes a lot of time to get initialised and I decided to start it in parallel. Everything was ok, until I packed it to the Jar file - I start to get errors like ZipFileClosed, ClosedStream, etc.

    After some debug I found out that it caused by assets setup function of Jooby. It works with jar inside of ClassPathAssetSource and this prevents other threads to read the classpath resources, so I put my component async run after assets setup.

    But today I got this error again. Running everything sequentially - ok; running everything in parallel, but after Jooby has started - ok; running everything in parallel while jooby is starting too - causes random errors related to reading of classpath resource.

    opened by dmitryb-dev 2
  • [FR] MVC Add method meta data to route

    [FR] MVC Add method meta data to route

    For 3.0 it would be very helpful if the Route had more metadata for MVC handlers. For example which class and method is the handler. Currently the MVC annotation processor does add the path as well annotation metadata but it would be helpful if it added:

    • Class name
    • Method name
    • Method parameters

    The idea for are use case is in dev mode (or not) you could print that information out for diagnostic purposes. e.g. perhaps a meta tag on the page that says what view and controller rendered it. (the view is easy and doable today but the other meta data like class is not)

    In other frameworks this information is available because they are using reflection and give you the the java reflect Method that handled the request. We do not want to do that but should give enough information to effectively get the Method (or MethodHandle) if one desires so. That is static strings like how annotations are added to the route should be enough I think.

    I can put in a PR in 3.0 if you are interested?

    opened by agentgt 2
  • Memory leak in Undertow (2.15.1)

    Memory leak in Undertow (2.15.1)

    Hello.

    For a long time I have been trying to detect a memory leak in my program, but after tests it turns out that the leak is not in my code. I built the project with Jooby 2.13.0 and Kotlin 1.4.32 - no leaks. Then I built the project with 2.15.1 and Kotlin 1.6 without any code changes and found memory leaks again. I'm attaching a screenshot of heap analysis in MAT, maybe I should clarify some details from MAT (I haven't dealt with memory leaks before) - I'd be happy to share it, or maybe I should report it to Undertow?

    I would like to note that the leak occurs in project with active SSE usage, in my other projects (without SSE) I haven't encountered OOM even on 2.15.1 version, but I haven't investigated their memory consumption carefully either.

    image image

    opened by vellrya 1
  • Could starter:graphql-starter:1.0.0 drop off redundant dependencies?

    Could starter:graphql-starter:1.0.0 drop off redundant dependencies?

    Hi! I found the pom file of project starter:graphql-starter:1.0.0 introduced 49 dependencies. However, among them, 6 libraries (12%) are not used by your project. I list the redundant dependencies below (labelled as red ones in the figure):

    Redundant dependencies

    com.google.code.findbugs:jsr305:jar:3.0.2:compile com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile com.google.errorprone:error_prone_annotations:jar:2.3.4:compile com.google.j2objc:j2objc-annotations:jar:1.3:compile org.reactivestreams:reactive-streams:jar:1.0.2:compile org.jetbrains:annotations:jar:13.0:test


    Removing the redundant dependencies can reduce the size of project and prevent potential dependency conflict issues (i.e., multiple versions of the same library). More importantly, one of the redundant dependencies com.google.code.findbugs:jsr305:jar:3.0.2:compile induced dependency conflict in the dependency graph. As such, I suggest a refactoring operation for starter:graphql-starter:1.0.0’s pom file.

    The attached PR helps resolve the reported problem. It is safe to remove the unused libraries (we considered Java reflection relations when analyzing the dependencies). These changes have passed starter:graphql-starter:1.0.0’s maven tests.

    Best regards

    opened by Celebrate-future 0
Releases(v3.0.0.M2)
  • v3.0.0.M2(Jan 1, 2023)

    Happy to announce a new release! 🚀 🎉

    • #2465: In case of async route handlers, after() runs before the handler, not after it
    • #2710: AccessLogger logs miss protocol and content length when using Kotlin Coroutines
    • #2256: Logback config not properly referenced for a self-containing JAR
    • #1921: Allow extension to provide handlers for routes' return type
    • #2031: core: remove reactive supports from jooby core
    • #2698: core: remove asm and route return type analysis

    Changes

    Support my work

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0.M1(Dec 5, 2022)

    Happy to announce a new release! 🚀 🎉

    • Java 17 minimum
    • Upgrade all modules dependencies to latest
    • Java 9 modules (when possible)

    Package renames

    • jooby-graphiql: io.jooby.graphql => io.jooby.graphiql
    • jooby-graphql-playgroind: io.jooby.graphql => io.jooby.graphql.playground
    • jooby-gson: io.jooby.json => io.jooby.gson
    • jooby-guice: io.jooby.di => io.jooby.guice
    • jooby-spring: io.jooby.di => io.jooby.spring
    • jooby-awssdk-v1: io.jooby.aws => io.jooby.awssdkv1
    • jooby-commons-email=>jooby-commons-mail: io.jooby.email => io.jooby.commons.mail
      • io.jooby.email.CommonsEmailModule => io.jooby.commons.mail.CommonsMailModule

    Changes

    Support my work

    Source code(tar.gz)
    Source code(zip)
  • v2.16.1(Sep 6, 2022)

  • v2.15.1(May 30, 2022)

  • v2.15.0(May 22, 2022)

  • v2.14.2(May 15, 2022)

  • v2.14.1(May 2, 2022)

    Happy to announce a new release! 🚀 🎉

    • #2571: Add HTTPS only option
    • #2572 : netty: onComplete callback must run on caller thread
    • #2574: @Transactional annotation must be supported at class/type level too
    • #2570: FileUpload is missing in a MVC controller
    • #2565: UndertowWebsocket close #2565

    Changes

    Donate/Support

    Contributors

    @U1F984

    Source code(tar.gz)
    Source code(zip)
  • v2.14.0(Apr 27, 2022)

    Happy to announce a new release! 🚀 🎉

    • #2303: Fix SSL absolute paths on Windows
    • #2510: Assets: don't allow to create assets without source
    • #2512: OpenAPI: better support for Map and byte array
    • #2534: Jackson: Fix ObjectMapper binding
    • #2537: OpenAPI: Support Nullable field
    • #2529: Support multiple accept headers
    • #2539 Error handler now works with app composition
    • #2457 Fix controller lookup with app composition
    • #2554 Netty: NPE while checking for open connection
    • #2561 Gson: Set charset while decoding
    • #2565 WebSocket: Websocket now close session

    Changes

    Donate/Support

    Contributors

    @imeszaros @Xerxekyran @lukasbarti

    Source code(tar.gz)
    Source code(zip)
  • v2.13.0(Jan 16, 2022)

  • v2.12.0(Dec 30, 2021)

    Happy to announce a new release! 🚀 🎉

    • #2363 jooby-utow (undertow) doesn't seem to support Expect 100 Continue on PUT
    • #2428 jackson: remove BlackBirdModule from defaults setup
    • #2413 Make JackonsonModule able to support XML or JSON based on ACCEPT header -- proposed implementation attached
    • #2448 Fix OpenAPI generation for newer Kotlin compiler and support java.time types
    • #2467 Origin of config entries are overriden by Jooby
    • #2449 #2451 fix websocket ByteBuf array usage issue
    • #2453 jooby-netty Context getRemoteAddress always return ""

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.11.0(Sep 15, 2021)

    Happy to announce a new release! 🚀 🎉

    • #2367 After handler must reflect errored status code on failure
    • #2401 Client/peer certificates
    • #2405 [MVC] Cannot have methods with similar arguments that are Nonnull
    • #2408 [MVC] TYPE_USE annotation on MVC method parameters break the annotation processor
    • #2417 [MVC] Annotations with array of annotations break annotation processor with UnsupportedOperationException
    • #2399 netty: http2: streamId is lost on server exception
    • #2285: Can't remove session attributes when using RedisSessionStore
    • #2420 BREAK CHANGE: redis: RedisSessionStore requires a redis pool
    • #2403 OpenAPI not generated with MVC API managed by Spring

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.10.0(Jul 19, 2021)

    Happy to announce a new release! 🚀 🎉

    • #2326 gradle: support new mainclass attribute
    • #2351 gradle: support gradle 6.8 or higher
    • #2240 Jooby.install(Supplier) doesn't share registry
    • #2357 Jooby header(String) doesn't support case insensitive
    • #2364 Netty: WebSocket compression
    • #2325 MVC annotations will never use custom Value Converters. @QueryParam and friends is confusing for custom objects
    • #2362 Kotlin: Improve coroutine context redefinition
    • #2368 JSONB module
    • #2369: Customize which error is considered connection lost
    • #2372: SSL (for jooby-http2-netty) broken for reactor Flux

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.9.6(May 10, 2021)

    Happy to announce a new release! 🚀 🎉

    • #2194 SSL: allow to configure custom SSL provider (conscrypt)
    • #2210 Websockets onClose not working
    • #2260 Netty: Interrupted request leads to NPE using Netty + AccessLog
    • #2293 Undertow: error while sending non-blocking request with a large response
    • #2305: websocket.idleTimeout only working for whole minutes
    • #2257 Kotlin/Coroutine: Allow to redefine context

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.9.5(Dec 27, 2020)

  • v2.9.4(Nov 26, 2020)

  • v2.9.3(Nov 13, 2020)

  • v2.9.2(Oct 25, 2020)

    Happy to announce a new release! 🚀 🎉

    • #2054 undertow: Fix exception thrown at startup
    • #1881 config: stackoverflow when OS has lot of environment variables
    • #2068: bean converter: favor empty constructor when there are multiple constructors
    • #2069: bean converter: support java.util.Collection while provisioning parameter
    • #2046: openapi: api doc generator doesn't respect mount() construction

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.9.1(Oct 1, 2020)

    Happy to announce a new release! 🚀 🎉

    • #1995 Fix for double urldecoding with Formdata/Multipart
    • #1990 pac4j: URL resolver doesn't work with null context
    • #1999 OpenAPI generator now supports routes() and Kotlin objects
    • #1998 Chrome cookie SameSite issue
    • #1972 pac4j-module: Can't apply a client directly to a POST route?
    • #2026 hibernate/mvc: package scanner report bad byte code while processing generated byte code

    Changes

    Donate/Support

    Contributors

    @imeszaros

    Source code(tar.gz)
    Source code(zip)
  • v2.9.0(Sep 8, 2020)

    Happy to announce a new release! 🚀 🎉

    Thank you @imeszaros for all the work you did in this release.

    • #1968 Add Parameter Lookup
    • #1955 Metrics module
    • #1957 Transactional annotation for jdbc modules (hibernate, jdbi, ebean)
    • #1936 DSL for inline attachment
    • #1897 Jooby.start doesn't block anymore
    • #1909 undertow: fix event loop execution
    • #1973 pac4j: clients provisioning by dependency injection framework
    • #1924 Kotlin 1.4

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
  • v2.8.10(Aug 3, 2020)

    Happy to announce a new release! 🚀 🎉

    • #1843 : [mvc]: jooby-apt generates incorrect import statement for arrays
    • #1855: [openapi]: OpenApi execution of openapi resulted in exception: NullPointerException
    • #1866: [mvc]: jooby-apt and Lombok processing
    • #1860: Support for incremental annotation processing with Gradle
    • #1890: ctx.body().value() must throws a MissingValueException when empty/missing
    • #1859: Null/Empty body param mapped to empty string ("")
    • #1865: Null/Empty body param mapped to empty string ("")

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
  • v1.6.8(Jul 28, 2020)

  • v2.8.9(Jul 2, 2020)

  • v2.8.8(Jun 25, 2020)

    Happy and proud to announce a new release! 🚀 🎉

    • #1805: [openapi] generation fails if I use java.net.URI as a query param
    • #1806: [mvc]: java.util.List contains null if query param doesn't specified
    • #1807: [mvc]: VerifyError after upgrading to 2.8.5 when using @FormParam MVC Annotation
    • #1810: [ssl]: Mutual TLS
    • #1813: [ssl]: Bug in ServerOptions.java
    • #1814: [mvc]: jooby-apt generates incorrect import statement for bounded wildcards
    • #1815: File upload multipart hits an error of ClassCastException while using CsrfHandler

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
  • v2.8.7(Jun 20, 2020)

  • v2.8.6(Jun 18, 2020)

    Happy and proud to announce a new release! 🚀 🎉

    • #1771: Gzip: Set compression level
    • #1774: Access to Config/Environment from ctx.require()
    • #1785: Packaging documentation: https://jooby.io/packaging
    • #1786: mvc: follow/respect Nonnull annotation on HTTP parameter
    • #1794: openapi: ignore io.jooby.StatusCode
    • #1795: openapi: support RequestBody annotation
    • #1796: shutdown handler

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
  • v2.8.5(Jun 7, 2020)

    Happy and proud to announce the 2.8.5 release! 🚀 🎉

    • #1737: pac4j: signed session doesn't work
    • #1763: redis module https://jooby.io/modules/redis
    • #1765: redis http session https://jooby.io/modules/redis
    • #1745: http session time out
    • #1765: caffeine http session
    • #1769: openapi: support hidden annotation/attribute
    • #1767: mvc/apt: invalid class name. Affects IDE integration

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
  • v2.8.4(May 22, 2020)

  • v2.8.3(May 11, 2020)

  • v1.6.7(May 11, 2020)

  • v2.8.2(May 6, 2020)

    Happy and proud to announce the 2.8.2 release! 🚀 🎉

    • #1656 Netty: Fix Gzip with Assets
    • #1668 [jooby-cli] posix file permissions throws UnsupportedOperationException on Windows
    • #1681 MockRouter(unit test): support coroutine execution
    • #1676 Access to multipart form data file names
    • #1690 Thymeleaf Module
    • #1687 router: support hidden http method

    API/break changes

    • #1694 assets: requires classpath location/prefix
    • #1693 pac4j: turn off csrf authorizer

    Changes

    Donate/Support

    Source code(tar.gz)
    Source code(zip)
Owner
jooby
The modular web framework for Java and Kotlin
jooby
Javalin - A simple web framework for Java and Kotlin

Javalin is a very lightweight web framework for Kotlin and Java which supports WebSockets, HTTP2 and async requests. Javalin’s main goals are simplicity, a great developer experience, and first class interoperability between Kotlin and Java.

David (javalin.io) 6.2k Jan 6, 2023
Firefly is an asynchronous web framework for rapid development of high-performance web application.

What is Firefly? Firefly framework is an asynchronous Java web framework. It helps you create a web application Easy and Quickly. It provides asynchro

Alvin Qiu 289 Dec 18, 2022
An evolving set of open source web components for building mobile and desktop web applications in modern browsers.

Vaadin components Vaadin components is an evolving set of high-quality user interface web components commonly needed in modern mobile and desktop busi

Vaadin 519 Dec 31, 2022
Ninja is a full stack web framework for Java. Rock solid, fast and super productive.

_______ .___ _______ ____. _____ \ \ | |\ \ | | / _ \ / | \| |/ | \ | |/ /_\ \ / | \

Ninja Web Framework 1.9k Jan 5, 2023
ZK is a highly productive Java framework for building amazing enterprise web and mobile applications

ZK ZK is a highly productive Java framework for building amazing enterprise web and mobile applications. Resources Documentation Tutorial ZK Essential

ZK 375 Dec 23, 2022
A web MVC action-based framework, on top of CDI, for fast and maintainable Java development.

A web MVC action-based framework, on top of CDI, for fast and maintainable Java development. Downloading For a quick start, you can use this snippet i

Caelum 347 Nov 15, 2022
A server-state reactive Java web framework for building real-time user interfaces and UI components.

RSP About Maven Code examples HTTP requests routing HTML markup Java DSL Page state model Single-page application Navigation bar URL path UI Component

Vadim Vashkevich 33 Jul 13, 2022
Vaadin 6, 7, 8 is a Java framework for modern Java web applications.

Vaadin Framework Vaadin allows you to build modern web apps efficiently in plain Java, without touching low level web technologies. This repository co

Vaadin 1.7k Jan 5, 2023
Apache Wicket - Component-based Java web framework

What is Apache Wicket? Apache Wicket is an open source, java, component based, web application framework. With proper mark-up/logic separation, a POJO

The Apache Software Foundation 657 Dec 31, 2022
Micro Java Web Framework

Micro Java Web Framework It's an open source (Apache License) micro web framework in Java, with minimal dependencies and a quick learning curve. The g

Pippo 769 Dec 19, 2022
True Object-Oriented Java Web Framework

Project architect: @paulodamaso Takes is a true object-oriented and immutable Java8 web development framework. Its key benefits, comparing to all othe

Yegor Bugayenko 748 Dec 23, 2022
An Intuitive, Lightweight, High Performance Full Stack Java Web Framework.

mangoo I/O mangoo I/O is a Modern, Intuitive, Lightweight, High Performance Full Stack Java Web Framework. It is a classic MVC-Framework. The foundati

Sven Kubiak 52 Oct 31, 2022
The Grails Web Application Framework

Build Status Slack Signup Slack Signup Grails Grails is a framework used to build web applications with the Groovy programming language. The core fram

grails 2.7k Jan 5, 2023
jetbrick web mvc framework

jetbrick-webmvc Web MVC framework for jetbrick. Documentation http://subchen.github.io/jetbrick-webmvc/ Dependency <dependency> <groupId>com.githu

Guoqiang Chen 25 Nov 15, 2022
🚀 The best rbac web framework. base on Spring Boot 2.4、 Spring Cloud 2020、 OAuth2 . Thx Give a star

?? The best rbac web framework. base on Spring Boot 2.4、 Spring Cloud 2020、 OAuth2 . Thx Give a star

pig-mesh 4.3k Jan 8, 2023
RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications

RESTEasy RESTEasy is a JBoss.org project aimed at providing productivity frameworks for developing client and server RESTful applications and services

RESTEasy 1k Dec 23, 2022
Java Web Toolkit

What is JWt ? JWt is a Java library for developing web applications. It provides a pure Java component-driven approach to building web applications, a

null 48 Jul 16, 2022
:rocket: Lightning fast and elegant mvc framework for Java8

Based on Java8 + Netty4 to create a lightweight, high-performance, simple and elegant Web framework ?? Spend 1 hour to learn it to do something intere

Blade Framework 5.7k Dec 28, 2022
:rocket: Lightning fast and elegant mvc framework for Java8

Based on Java8 + Netty4 to create a lightweight, high-performance, simple and elegant Web framework ?? Spend 1 hour to learn it to do something intere

Blade Framework 5.7k Jan 5, 2023