简体   繁体   English

如何忽略 Javalin 5 中的尾部斜线?

[英]How to ignore trailing slashes in Javalin 5?

There have been a lot of changes to the configuration in Javalin 5. One thing that used to work in previous versions is to "ignore trailing slashes" like this: Javalin 5 中的配置发生了很多变化。以前版本中常用的一件事是“忽略尾部斜杠”,如下所示:

var javalin = Javalin.create(cfg -> {
    cfg.ignoreTrailingSlashes = true;
}).start(8080);

But I cannot seem to find this setting in version 5. So the question is, how do you enable "ignore trailing slashes" in Javalin version 5?但我似乎无法在版本 5 中找到此设置。所以问题是,如何在 Javalin 版本 5 中启用“忽略尾部斜线”?

The setting is now moved to 'routing config' you can now set it as below:该设置现已移至“路由配置”,您现在可以按如下方式进行设置:

Javalin.create(config -> {
    config.routing.ignoreTrailingSlashes = true; 
});

See the documentation here - https://javalin.io/documentation#routingconfig请参阅此处的文档 - https://javalin.io/documentation#routingconfig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM