Class HealthServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
me.nickhanson.codeforge.web.HealthServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@WebServlet(urlPatterns="/health") public class HealthServlet extends jakarta.servlet.http.HttpServlet
Lightweight readiness/liveness endpoint. Returns 200 quickly without touching downstream dependencies.
Author:
Nick Hanson
See Also:
  • Field Summary

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    Handles health-check requests by returning an immediate 200 OK response with a plain-text OK body.

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HealthServlet

      public HealthServlet()
  • Method Details

    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException
      Handles health-check requests by returning an immediate 200 OK response with a plain-text OK body.
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Parameters:
      req - the incoming HTTP request
      resp - the HTTP response used to return health status
      Throws:
      IOException - if writing the response fails