Class AdminResource

java.lang.Object
org.apache.juneau.rest.server.servlet.RestResource
org.apache.juneau.rest.server.ops.AdminResource

public class AdminResource extends RestResource
Child-resource flavor of the AdminMixin mixin.

Mounts as a routed child via @Rest(children=AdminResource.class) under a parent at the subtree /admin and serves the same operational endpoints (/threads, /heap, /cache/flush, /ratelimit) as the mixin by delegating to a shared flavor-neutral AdminProvider worker bean — so the forms cannot drift.

Whereas the AdminMixin mixin pins its ops at /admin/<endpoint> for composition into a host at /, this child declares the subtree at the class level (@Rest(path="/admin")) and pins the ops at the bare endpoint names (e.g. /threads).

Default-deny security posture:

Like the mixin and servlet flavors, this child is annotated @Rest(guards=DenyAllGuard.class), so every admin path returns 403 Forbidden until the importer registers a RestGuardList factory.

See Also:
Since:
10.0.0
  • Constructor Details

    • AdminResource

      public AdminResource()
      No-arg constructor — uses a default AdminProvider worker.
    • AdminResource

      protected AdminResource(AdminProvider worker)
      Worker constructor.
      Parameters:
      worker - The shared flavor-neutral admin worker this child delegates to. Must not be null.
  • Method Details

    • getThreads

      public void getThreads(RestResponse res) throws IOException
      [GET /threads] — emit a JSON list of currently-live threads.
      Parameters:
      res - The current REST response.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • getHeap

      public void getHeap(RestResponse res) throws IOException
      [GET /heap] — emit JVM heap and non-heap memory statistics.
      Parameters:
      res - The current REST response.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • postCacheFlush

      public void postCacheFlush(RestRequest req, RestResponse res) throws IOException
      [POST /cache/flush] — run all registered cache-flush hooks (or a subset).
      Parameters:
      req - The current REST request — names query parameter is read off it.
      res - The current REST response.
      Throws:
      IOException - If an I/O error occurs while writing the response.
    • getRateLimit

      public void getRateLimit(RestRequest req, RestResponse res) throws IOException
      [GET /ratelimit] — emit registered RateLimitGuard bean configuration.
      Parameters:
      req - The current REST request — supplies the bean store for guard lookup.
      res - The current REST response.
      Throws:
      IOException - If an I/O error occurs while writing the response.
      NotFound - If no RateLimitGuard bean is registered on the importer's bean store.