sorry but I do not have the actual code with me, but I will try to explain:
I have a servlet mapped to the following:
/admin/*
So, this goes to a servlet:
public class AdminController extends MainController {
public void doPost(HttpServletRequest request, HttpServletResponse response) {
// Do stuf here
}
}
Here is MainController:
public class MainController extends HttpServlet {
@Override
public void service(ServletRequest request, ServletResponse response) {
String requesturi = ((HttpServletRequest)request).getRequestURI();
reqlist = Arrays.asList(requesturi.substring(requesturi.indexOf(Util.rootPath) + Util.rootPath.length()).split("/"));
reqlist = reqlist.subList(1, reqlist.size());
doPost((HttpServletRequest)request, (HttpServletResponse)response);
}
So, the request is passed to AdminController, no problem, but then I reallized something:
The servlet is being called twice!. And this is causing me many errors..
Does anybody have a clue on this? It is because I used some kind of heritance? Thank you for all!
Though it is old thread but my answer may help someone. Today I faced the same issue. My particular servlet is working fine earlier and suddenly it has started calling doGet method twice. On investigation, I found that my chrome browser has html validator extension which is calling the servlet again with same request to do html validation. After I disabling the extension, the problem got resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With