Mit Spring6+Tomcat10+Jakarta Servlet ..url mit JSP-Erweiterung [/Application-context/etepalive.jsp] Seite lädt aber Stat
Posted: 16 May 2025, 18:59
Ich habe die folgende Konfiguration und schreibe hier keine andere Standardkonfiguration. 200 < /p>
Code: Select all
web.xml
contextConfigLocation
/WEB-INF/dispatcher-servlet.xml
org.springframework.web.context.ContextLoaderListener
//servlet didpatcher
dispatcher
org.springframework.web.servlet.DispatcherServlet
1
dispatcher
/
< /code>
Unten finden Sie den Inhalt von Dispatcher-servlet.xml für Laoding-Eigenschaften und und < /p>
@Controller
public class KeepAliveController {
@RequestMapping(value = {"/","/keepalive","/keepalive.jsp","/error"}, method = RequestMethod.GET)
public String validateHealthCheck(Model model, HttpServletRequest request, HttpServletResponse resp) {
if (TaskScheduler.STATUS){
model.addAttribute("message", getTimeInFormat());
return "keepalive";
}else{
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
model.addAttribute("errorMsg", "The server encountered an Internal Error and unable to complete your request. Please contact administrator. ");
return "error";
}
}
}
```