@RestController @Log public class ClickResource { @Autowired private ClickRepository clickRepository; @RequestMapping(value = "/api/click", method = RequestMethod.GET, produces = { "text/plain" }) public String click(// @RequestParam(value = "url", required = true) String url, // @RequestParam(value = "projectName", required = true) String projectName, // HttpServletResponse httpServletResponse, // HttpServletRequest httpServletRequest) throws MessagingException, IOException, URISyntaxException { String decodedUrl = URLDecoder.decode(url, Charset.forName("utf-8")); saveClickToDb(decodedUrl, projectName, httpServletRequest); httpServletResponse.sendRedirect(decodedUrl); return "Redirect to " + decodedUrl; }