Created
October 30, 2019 21:08
-
-
Save thiagofa/ce48c08e4caae34c5dca0a7a5c252666 to your computer and use it in GitHub Desktop.
Customiza Tomcat embedado do Spring Boot para aceitar colchetes nas URLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Referências: | |
// - https://stackoverflow.com/a/53613678 | |
// - https://tomcat.apache.org/tomcat-8.5-doc/config/http.html | |
// - https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-webserver | |
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | |
import org.springframework.boot.web.server.WebServerFactoryCustomizer; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class TomcatCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> { | |
@Override | |
public void customize(TomcatServletWebServerFactory factory) { | |
factory.addConnectorCustomizers(connector -> connector.setAttribute("relaxedQueryChars", "[]")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Olá Thiago, sei que esse código é apenas uma alternativa...
O método 'setAttribute' está depreciado, eu usei aqui o 'setProperty' no lugar.