javaspringdebuggingspring-bootprogram-flow

Trouble understanding Spring Boot code flow


I have a spring boot code like following which handles a particular mapping like following -

@RestController
@ResponseBody
public class SomeAPIController {

    @RequestMapping(
            value = "/some-api",
            method = RequestMethod.GET,
            produces = {"application/json", "application/xml"}
    )

    @ResponseStatus(HttpStatus.OK)
    @ResponseBody
    public SomeAPIPayload validateAPIUpdate(
            @Valid @RequestParam(value = "query", defaultValue="") String queryString

    )

But in above code if I pass query as "something" it works fine but if I pass say, "#something" it fails to query(I verified it by printing queryString value, and it comes out to be empty) so, as far my understanding @Valid(which is imported from javax.validation) is doing some validation and doesn't let "#something" pass. I want to know how to track down the validation file or if something other is wrong how to locate it ? Any pointers in direction will be extremely helpful.

Thanks.


Solution

  • Everything following a hash (#) is interpreted as anchor/fragment and will not be sent to the server as stated in RFC 1738. To send a hash symbol, you need to encode it as %23.