gpt4 book ai didi

spring-boot - Spring boot 2 Undertow,无法设置 UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL

转载 作者:行者123 更新时间:2023-12-02 03:29:29 28 4
gpt4 key购买 nike

Springboot 2.0

通过类型引用导航时:localhost:9093/?foo=bar|bar

Return error: Caused by: java.net.URISyntaxException: Illegal character in query

我添加了一个额外的选项:

@Component
public class MyWebServerCustomizer implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addBuilderCustomizers(builder-> builder.setServerOption(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, Boolean.TRUE));
}
}

不起作用,异常仍然存在。

我做错了什么?

谢谢。

最佳答案

@Configuration
public class HttpConfig {
@Bean
public UndertowServletWebServerFactory servletWebServerFactory(ApplicationProperties properties) {
UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
factory.addBuilderCustomizers((UndertowBuilderCustomizer) builder ->
builder.setServerOption(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, Boolean.TRUE));
return factory;
}
}

关于spring-boot - Spring boot 2 Undertow,无法设置 UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52217286/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com