Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring启动URL长度验证_Java_Rest_Spring Mvc_Spring Security_Spring Boot - Fatal编程技术网

Java Spring启动URL长度验证

Java Spring启动URL长度验证,java,rest,spring-mvc,spring-security,spring-boot,Java,Rest,Spring Mvc,Spring Security,Spring Boot,出于安全原因,如果URI请求长度大于1024个字符,我需要返回400错误 有没有办法在Spring Boot中测试这一点 目前,我有一个简单的控制器对查询字符串和头参数进行验证 @RestController @Validated public class myController { @RequestMapping(value = "{id}", method = GET) public SegmentationResponse getSegments(

出于安全原因,如果URI请求长度大于
1024
个字符,我需要返回
400
错误

有没有办法在Spring Boot中测试这一点

目前,我有一个简单的控制器对查询字符串和头参数进行验证

@RestController
@Validated
public class myController {

    @RequestMapping(value = "{id}", method = GET)
    public SegmentationResponse getSegments(
            @PathVariable("id") @Valid @Size(min = 12) String id,
            @RequestHeader(value = "X-API-Key", required = true) @ValidAPIKey String apiKeyHeader,
            @RequestParam(value = "myParam", required = true) @Valid @Pattern(regexp = MY_REGEX) String myParam) {

        // DO Stuff
    }
}
所需的

http://localhost:8080/


返回
400错误请求

似乎是针对筛选器而不是控制器的。似乎是针对筛选器而不是控制器的。