Class DumpsResource

All Implemented Interfaces:
BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig

public class DumpsResource extends BasicRestResource
Child-resource flavor of the diagnostic dump endpoints (/threaddump, /heapdump).

Mounts as a routed child via @Rest(children=DumpsResource.class) and delegates to a shared DumpsManager worker — the same logic the mixin flavor uses, so the two forms cannot drift. Extends BasicRestResource (mirrors HealthResource).

Both dumps are deny-by-default — they respond 403 Forbidden unless a DumpsSettings bean enabling them is registered. /heapdump additionally degrades to 501 Not Implemented on a JVM without HotSpot heap-dump support.

See Also:
Since:
10.0.0
  • Constructor Details

  • Method Details

    • manager

      protected DumpsManager manager(RestRequest req)
      Returns the DumpsManager worker, resolved from the bean store when a consumer registers one, else a built-in default. Resolving through the bean store lets consumers (and tests) supply an alternate worker without subclassing.
      Parameters:
      req - The HTTP request (its context's bean store is searched).
      Returns:
      The resolved manager; never null.
    • getThreadDump

      [GET /threaddump] - Full thread dump from the ThreadMXBean.
      Parameters:
      req - The HTTP request.
      Returns:
      The thread dump text.
      Throws:
      Forbidden - If the thread-dump endpoint is not enabled.
    • getHeapDump

      [GET /heapdump] - HotSpot heap dump (hprof) stream.
      Parameters:
      req - The HTTP request.
      res - The HTTP response.
      Returns:
      A self-deleting stream over the hprof file.
      Throws:
      Forbidden - If the heap-dump endpoint is not enabled.
      NotImplemented - If this JVM has no HotSpot heap-dump support.
      IOException - If the dump could not be produced.