All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lx.boot.web.ScTomcatWebServerCustomizer Maven / Gradle / Ivy

Go to download

使用文档: https://a7fi97h1rc.feishu.cn/docx/X3LRdtLhkoXQ8hxgXDQc2CLOnEg?from=from_copylink

There is a newer version: 1.1
Show newest version
package com.lx.boot.web;

import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;


//说明: 解决tomcat get请求不能携带|{}[] 特殊字符

/**{ ylx } 2022/4/2 14:46 */
@Component
public class ScTomcatWebServerCustomizer implements WebServerFactoryCustomizer {
    public ScTomcatWebServerCustomizer() {
    }
    @Override
    public void customize(TomcatServletWebServerFactory factory) {
        factory.addConnectorCustomizers((Connector connector) -> {
            connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
            connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy