Updated WebServerVerticle
This commit is contained in:
@@ -5,6 +5,11 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<name>ContaminUS</name>
|
<name>ContaminUS</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>23</maven.compiler.source>
|
||||||
|
<maven.compiler.target>23</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Vert.X Core -->
|
<!-- Vert.X Core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package net.miarma.contaminus.server;
|
package net.miarma.contaminus.server;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import io.vertx.core.AbstractVerticle;
|
import io.vertx.core.AbstractVerticle;
|
||||||
import io.vertx.core.Promise;
|
import io.vertx.core.Promise;
|
||||||
import io.vertx.ext.web.Router;
|
import io.vertx.ext.web.Router;
|
||||||
@@ -19,10 +22,17 @@ public class WebServerVerticle extends AbstractVerticle {
|
|||||||
Constants.LOGGER.info("📡 Iniciando WebServerVerticle...");
|
Constants.LOGGER.info("📡 Iniciando WebServerVerticle...");
|
||||||
|
|
||||||
Router router = Router.router(vertx);
|
Router router = Router.router(vertx);
|
||||||
|
|
||||||
|
Path webRootPath = Paths.get(configManager.getWebRoot());
|
||||||
|
|
||||||
|
if (webRootPath.isAbsolute()) {
|
||||||
|
Path basePath = Paths.get(System.getProperty("user.dir")); // Directorio actual
|
||||||
|
webRootPath = basePath.relativize(webRootPath);
|
||||||
|
}
|
||||||
|
|
||||||
router.route("/*")
|
router.route("/*")
|
||||||
.handler(
|
.handler(
|
||||||
StaticHandler.create(configManager.getWebRoot())
|
StaticHandler.create(webRootPath.toString())
|
||||||
.setCachingEnabled(false)
|
.setCachingEnabled(false)
|
||||||
.setDefaultContentEncoding("UTF-8")
|
.setDefaultContentEncoding("UTF-8")
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user