基本上,我要做的是提出这样的请求:
http://localhost:8085/api/candidates/searchWithFacet?q=helmut&page=0&size=20&fq=skills%3A%22Keine%20Angabe%22&
但是Spring MVC抛出了这个错误:
java.net.URISyntaxException: Illegal character in query at index 51: /api/candidates/searchWithFacet?q=helmut&fq=skills:"Keine Angabe"?page=0&size=20
我不明白为什么它说我有一个非法字符,因为我编码它。我也试过编码整个URL,而不仅仅是这样的最后一部分:
http://localhost:8085/%2Fapi%2Fcandidates%2Fsearch%3Fq%3Dhelmut%26page%3D0%26size%3D20
我在这里收到的错误是400 - 错误请求。
我的两个控制器功能是:
@Timed
@RequestMapping(value = "/candidates/search", method = RequestMethod.GET, produces = {
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<CandidateListDTO> searchCandidatesWithFaceting(@RequestParam(name = "q") String query,
Pageable page) throws SolrServerException, URISyntaxException {
...
@Timed
@RequestMapping(value = "/candidates/searchWithFacet", method = RequestMethod.GET, produces = {
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<CandidateListDTO> getCandidatesWithFacet(@RequestParam(name = "q") String query,
@RequestParam(name = "fq") String facetQuery, Pageable page)
throws SolrServerException, URISyntaxException {
感谢任何帮助,谢谢! : - )