0
我在春季開發服務,服務部署在JBOSS 7.1.0中。對於請求映射 示例代碼:請求參數中的特殊字符
@RequestMapping(value=/state, method=RequestMethod.GET)
public ResponseEntity<ListStatesResponseVO> getListOfStates(@RequestParam(required=false) Long id,
@RequestParam(required=false) Long page,
@RequestParam(required=false) Long pagesize);
我的問題是,當我在請求參數傳遞的特殊字符,它返回我一個有效的XML響應,但按照我的理解,它應該返回「400錯誤的請求」。
樣品URI:
http://localhost:8080/location-services/location/api/state?id=$%^$^$#$%^$%
我還添加了
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
在JBoss的standalone.xml。
而且還
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<!-- set forceEncoding to true if you want to override encoding of servlet -->
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
web.xml中。
但是這些都沒有解決問題。
是否有任何解決方案可用於此。 在此先感謝。
Thnx的答覆。 – Soutrick
不客氣。如果它真的幫助了你,請接受並點贊答案。 :-) –