private static void createRoutes ( ) { pathHandler = new PathHandler ( getRoutingHandler ( ) ) ; Router . getWebSocketRoutes ( ) . forEach ( ( WebSocketRoute webSocketRoute ) -> pathHandler . addExactPath ( webSocketRoute . getUrl ( ) , Handlers . websocket ( getInstance ( WebSocketHandler . class ) . withControllerClass ( webSocketRoute . getControllerClass ( ) ) . withAuthentication ( webSocketRoute . hasAuthentication ( ) ) ) ) ) ; Router . getServerSentEventRoutes ( ) . forEach ( ( ServerSentEventRoute serverSentEventRoute ) -> pathHandler . addExactPath ( serverSentEventRoute . getUrl ( ) , Handlers . serverSentEvents ( getInstance ( ServerSentEventHandler . class ) . withAuthentication ( serverSentEventRoute . hasAuthentication ( ) ) ) ) ) ; Router . getPathRoutes ( ) . forEach ( ( PathRoute pathRoute ) -> pathHandler . addPrefixPath ( pathRoute . getUrl ( ) , new ResourceHandler ( new ClassPathResourceManager ( Thread . currentThread ( ) . getContextClassLoader ( ) , Default . FILES_FOLDER . toString ( ) + pathRoute . getUrl ( ) ) ) ) ) ; Config config = getInstance ( Config . class ) ; if ( config . isApplicationAdminEnable ( ) ) { pathHandler . addPrefixPath ( "/@admin/assets/" , new ResourceHandler ( new ClassPathResourceManager ( Thread . currentThread ( ) . getContextClassLoader ( ) , "templates/@admin/assets/" ) ) ) ; } }
Create routes for WebSockets ServerSentEvent and Resource files