The Method request.getRequestURI()
returns URI with path variables.
The following example service takes Path Variable. How can I get URL that without Path Variables
@RequestMapping(value = "/getUser/{username}", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getUser(@PathVariable String username)
if i make request like this(
localhost:8080/user/getUser/tommy
)
request.getRequestURI()
returns with path variable.
user/getUser/tommy
I want to get a result like this:
user/getUser/
or
user/getUser
How can I get the path without path variables?
I solved my problem by using @RequestParam instead of @PathVariable for get services in my Controller classes
Example
@RequestMapping(value = "/getUser", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getUser(@RequestParam String username)