Skip to content

Commit

Permalink
Added support for themeing
Browse files Browse the repository at this point in the history
Also fixed routing to dev mode proxy
  • Loading branch information
mcollovati committed Jun 22, 2021
1 parent 62778d3 commit 58d5ac9
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ private Router initRouter() {
vaadinRouter.routeWithRegex("^(?!/(VAADIN(?!/dynamic)|frontend|frontend-es6|webjars|webroot)/).*$").handler(sessionHandler);

// Serve push javascript
StaticHandler vaadinStatic = StaticHandler.create("VAADIN/static");
StaticHandler metaInfVaadinStatic = StaticHandler.create("META-INF/resources/VAADIN/static");

String pushJavascript = String.format(
Expand All @@ -220,20 +221,23 @@ private Router initRouter() {
if (DevModeHandler.getDevModeHandler() != null) {
logger.info("Starting DevModeHandler proxy");
HttpReverseProxy proxy = HttpReverseProxy.create(vertx, () -> DevModeHandler.getDevModeHandler().getPort());
vaadinRouter.routeWithRegex(".+\\.js$").blockingHandler(proxy::forward);
vaadinRouter.routeWithRegex("^/themes\\/[\\s\\S]+?\\/").handler(proxy::forward);
vaadinRouter.routeWithRegex("/VAADIN(?!/dynamic)/.*").handler(proxy::forward);
}

//
vaadinRouter.route("/VAADIN/static/client/*")
.handler(StaticHandler.create("META-INF/resources/VAADIN/static/client"));
vaadinRouter.route("/VAADIN/build/*").handler(StaticHandler.create("META-INF/VAADIN/build"));
vaadinRouter.route("/VAADIN/static/*").handler(StaticHandler.create("VAADIN/static"));
vaadinRouter.route("/VAADIN/static/*").handler(vaadinStatic);
vaadinRouter.route("/VAADIN/static/*").handler(metaInfVaadinStatic);
vaadinRouter.routeWithRegex("^/themes\\/[\\s\\S]+?\\/").handler(metaInfVaadinStatic);
vaadinRouter.routeWithRegex("/VAADIN(?!/dynamic)/.*").handler(StaticHandler.create("VAADIN"));
vaadinRouter.route("/webroot/*").handler(StaticHandler.create("webroot"));
vaadinRouter.route("/webjars/*").handler(StaticHandler.create("webroot"));
vaadinRouter.route("/webjars/*").handler(StaticHandler.create("META-INF/resources/webjars"));


vaadinRouter.routeWithRegex("/frontend/bower_components/(?<webjar>.*)").handler(ctx -> {
logger.trace("Rerouting bower component to {}/webjars/{}",
ctx.mountPoint(), Objects.toString(ctx.request().getParam("webjar"), "")
Expand Down

0 comments on commit 58d5ac9

Please sign in to comment.