春は次のパス変数への正確なカンマを起動しました

ラボBexter:

私は2.1.0.RELEASEバージョンと春ブーツアプリを持っています。

私は次のように私のURLでパス変数を持っている@GetMapping("/{type}/car")と私は私のアプリを呼び出します。

http://localhost:8080/BMW;AAAAAAAAAAAAA/car 

しかし、私は唯一のBMWの文字列を取得します。春は正確なカンマや「AAAAAAAAAAAAAを」スキップ。

私は、フィルタを適用し、私はそれと同じexpereinceを持っています。私は「BMW; AAAAAAAAAAAAA」のようなパス変数を取得したいが、私はそれを得るいけません。

それはセキュリティホールであるので、私は、コールアウトのこの種をフィルタリングする理由。

ラボBexter:

私は、可能な解決策を見つけます:

@Configuration
public class SolutionConfig extends WebMvcConfigurationSupport {

@Override
protected PathMatchConfigurer getPathMatchConfigurer() {
    PathMatchConfigurer pathMatchConfigurer = super.getPathMatchConfigurer();
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setRemoveSemicolonContent(false);
    pathMatchConfigurer.setUrlPathHelper(urlPathHelper);
    return pathMatchConfigurer;
    }
}

ソースコードのリンク:https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

主なメソッド名は「removeSemicolonContent」です。

おすすめ

転載: http://10.200.1.11:23101/article/api/json?id=395535&siteId=1