Ad

How To Prevent Apache Server To Be Hitting Twice On A Java Get Request

- 1 answer

I'm using an apache tomcat server, on doing a project all my get request methods are hitting twice without initiating the call manually. If i call a method, on its return the method is being called again automatically. I have tried many ways but it doesn't helps me. This project is a same copy of another working project, however the old project is working fine.

I have tried these following answers, but this couldn't solve my problem

  1. https://www.niceonecode.com/Question/20307/MVC-Controller-Action-Gets-Called-Multiple-Times

  2. Spring controller method called twice

I have also verified if any of my scripts is initiating the second call, but there is no scripts like that. Can anyone helps me out?

Sample code of my method

@RequestMapping(value = "/method/test/{id}/{name}", method = RequestMethod.GET) public String getTestMethod(@PathVariable int id, @PathVariable String name, Model model, HttpServletRequest request, HttpServletResponse response, RedirectAttributes ra) { System.out.println("success"); return "success"; }

Ad

Answer

I had the same problem. Then I have changed target="_blank" rel="nofollow noreferrer" href="Favicon.ico" to empty in my index.html file. Then it worked. Change it to target="_blank" rel="nofollow noreferrer" href="".

Ad
source: stackoverflow.com
Ad