Class VersionServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.server.servlet.RestServlet
org.apache.juneau.rest.server.convention.VersionServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class VersionServlet extends RestServlet
Standalone servlet companion of the VersionMixin mixin.

Mounts as a sibling top-level servlet at /version/* and serves the same deployment-introspection JSON map as the mixin by delegating to a shared flavor-neutral VersionProvider worker bean — so the two forms cannot drift.

Whereas the VersionMixin mixin pins its op at /version for composition into a host at /, this companion declares the mount at the class level (@Rest(paths="/version/*")) and pins the op at /*.

Microservice registration:

@Bean Servlet version() { return new VersionServlet(); // auto-mounted at /version/* by JettyServerComponent }

See Also:
Since:
10.0.0
  • Constructor Details

    • VersionServlet

      public VersionServlet()
      No-arg constructor — uses a default VersionProvider worker.
    • VersionServlet

      protected VersionServlet(VersionProvider worker)
      Worker constructor.
      Parameters:
      worker - The shared flavor-neutral version worker this servlet delegates to. Must not be null.
  • Method Details

    • getInfo

      public void getInfo(RestResponse res) throws IOException
      [GET /*] — emit the assembled metadata as a JSON map.
      Parameters:
      res - The current REST response.
      Throws:
      IOException - If an I/O error occurs while writing the response.