How to return http status?
My application gets a request from an external server and it has to send a http 200 status back if the request was received successfully. If the requesting server does not get a response then it will try to send the request again. Now how do I send a status code 200 to the requesting server from a jsp ?
Thanks.
# 1
This should work:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
response.setStatus(HttpServletResponse.SC_OK);
%>
or
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
response.setStatus(200);
%>
But if a browser is making the request, it automatically returns HTTP 200 . I think even when another application is making a request, it automatically sends a 200 status in the header but I'm not sure about this.