Reputation: 1919
My controller attaches a question mark at the end of a string. It works great for every types of string.
https://www.mywebsite.com/attachQuestionmark/33 returns 33?
https://www.mywebsite.com/attachQuestionmark/hello returns hello?
However it returns not found error for urls such as https:://www.test.com.
https://www.mywebsite.com/attachQuestionmark/https:://www.test.com returns 404 error.
Is there any way to pass a full url to spring mvc controller?
@RequestMapping(
value = MyUrlBuilder.API_CREATIVE_CREATE + "/attachQuestionmark/{string}",
method = RequestMethod.GET,
produces = MediaType.ALL_VALUE)
@ResponseBody
@PMET
public static String attachQustionmark(@PathVariable("url") String value)
{
return value + "?";
}
Upvotes: 0
Views: 466
Reputation: 41123
Try URL-encoding the path variable, eg:
https://www.mywebsite.com/attachQuestionmark/https%3A%3A%2F%2Fwww.test.com
Because otherwise the / inside the variable will be interpreted as another path
Upvotes: 2