Class ShutdownResource
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,BasicUniversalConfig,DefaultConfig,DefaultHtmlConfig
POST /shutdown stops the process: the "OK" response is sent first, and the exit follows about a
second later on a background thread. Shutting down is a write, so it is a POST, never a GET: a safe
method passes every CSRF check, so a GET would let any page that embeds <img src=".../shutdown">
stop the process. GET /shutdown is answered with 405.
From the command line, send a non-form content type so a CSRF boundary in front of this resource (see
AdminBoundary) admits the request without a token:
curl -X POST -H 'Content-Type: application/json' http://localhost:10000/shutdown
This resource has no authentication of its own. Do not expose it on an untrusted network.
See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHow the process is stopped.Nested classes/interfaces inherited from class org.apache.juneau.rest.server.servlet.RestServlet
RestServlet.Builder<R extends RestServlet,SELF extends RestServlet.Builder<R, SELF>>, RestServlet.DefaultBuilder<R extends RestServlet> -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor. -
Method Summary
Methods inherited from class org.apache.juneau.rest.server.servlet.RestServlet
builder, createAuthenticator, destroy, doLog, getContext, getPath, getPaths, getRequest, getResponse, getRestBuilder, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
ShutdownResource
public ShutdownResource()Constructor.A shutdown calls
System.exit(int). -
ShutdownResource
Constructor.When the resource is mounted as a child by class, this constructor is used if the parent resource's bean store holds an
ShutdownResource.Exit, for example from a@Bean method on the parent. A microservice's own beans are not in that store.- Parameters:
exit- How a shutdown stops the process. Must not benull .- Throws:
IllegalArgumentException- Ifexitisnull .
-
-
Method Details
-
shutdown
[POST /] - Shuts down this microservice.- Returns:
- The string
"OK" .
-