添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello all,

For legacy reasons in my project based on spring boot 2.2.5 and spring cloud Hoxton.SR4, we should accept non URL encoded character "|" in query string.
We had set the "server.tomcat.relaxed-query-chars=|" in order to let coyotte connector accept this non URL encode character.
But I am facing an issue with ServletHttpHandlerAdapter -> Failed to get request URL: Illegal character in query
How can I deal with illegal caracters in ServletHttpHandlerAdapter like the server.tomcat.relaxed-query-chars do?
Thank's

import org.apache.catalina.connector.Connector; import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.stereotype.Component; @Component public class MyTomcatWebServerCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> { @Override public void customize(TomcatServletWebServerFactory factory) { factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { @Override public void customize(Connector connector) { connector.setProperty("relaxedQueryChars", "|");

Assuming you are on Tomcat 8, 9 or 10
https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/connector/Connector.html
https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/connector/Connector.html
https://tomcat.apache.org/tomcat-10.0-doc/api/org/apache/catalina/connector/Connector.html

(I didn't check older version. It may just work the same way.)

@et00448 this looks like a question to me which would be better suited to StackOverflow, and sharing an exception snippet that we don't throw ourselves is not really to be sufficient. If you want support, please share a small sample that we can run ourselves to reproduce the behavior that you've described.

status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Oct 12, 2023