我休息端点(弹簧引导1.3.0-RELEASE - >弹簧芯4.2.4.RELEASE),这需要多重实例字符串参数Spring框架REST多值请求参数空数组
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ResponseEntity<Object> getTest(@RequestParam(value = "testParam", required = false) String[] testParamArray) {}
/test?testParam= => testParamArray has length 0
/test?testParam=&testParam= => testParamArray has length 2 (two empty string items)
我期望第一种情况在数组中获得单个空sting元素,但没有。 关于如何实现这一点的任何想法?
检查您的浏览器或http客户端是否不放弃空参数。 – JVXR
我不认为这是事实。当使用类似@RequestParam Map params的东西时,我在那里看到单个null值(?testParam =) –
silverdrop