문제

@RequestMapping(value = {"/hello"}, method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<String> getContent(@RequestParam(value = "url", required = true) String url) {
    System.out.println("My passed url is: " + url);
}

When I do

curl "localhost:8080/hello?url=http://www.test.com/boom/4?utm_source=Google+Places&utm_medium=LLM&utm_campaign=DAC+LLM"

The url I'm trying to pass as a GET parameter gets truncated at the & sign because it thinks it's the start of another GET parameter.

My passed url is http://www.test.com/boom/4?utm_source=Google+Places

Any way to get around this, or should I change from GET to POST?

도움이 되었습니까?

해결책

You should encode your string in frontend for example using encodeURIComponent

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top