I have a logging servlet called LoggingServlet and it overrides the doGet and doPost method as follows:
public class LoggingServlet extends HttpServlet {
private static final long serialVersionUID = 2L;
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
...do stuff here
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
...do stuff here
}
And my web.xml looks something like this:
<servlet>
<servlet-name>LoggingServlet</servlet-name>
<servlet-class>com.example.servlets.LoggingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoggingServlet</servlet-name>
<url-pattern>/LoggingServlet/*</url-pattern>
</servlet-mapping>
And this is a snippet of a jsp that implements some JavaScript:
<script>
document.getElementById("ad_div").onmousedown = function () {
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","/LoggingServlet?bookie_id=<%= request.getParameter("id") %>&app_id=<%= request.getParameter("app_id") %>",true);
xmlhttp.send();
return true;
};
</script>
I also have another jsp that calls the LoggingServlet via a Post request. Now my problem:
- The Post request works fine without any problems
- However the Get request from the javascript returns a 404 error. I also manually entered the complete url into the webbrowser and I got a 404 error.
How is that possible?