java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.aoapps.servlet.tomcat.GetParallelDeploymentVersion
- All Implemented Interfaces:
Servlet,ServletConfig,Serializable
Gets the Tomcat parallel deployment version based on the path the application is deployed to.
Uses
ServletContext.getRealPath("/"),
then takes the version as the final part of the directory name if contains "##".
This is specific to Tomcat installations, and should not be assumed to apply generally.- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(HttpServletRequest request, HttpServletResponse response) Gets the parallel deployment version by parsing the deploy directory observed by callingServletContext.getRealPath("/").Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
GetParallelDeploymentVersion
public GetParallelDeploymentVersion()
-
-
Method Details
-
getParallelDeploymentVersion
Gets the parallel deployment version by parsing the deploy directory observed by callingServletContext.getRealPath("/").If unable to find, the specific reason is logged with level
Level.WARNINGorLevel.SEVERE, depending on the nature of the failure. This method is not expected to be used frequently, only after deployments and possibly via occasional audit / monitoring. Logging of these messages is considered best from a security standpoint and are not expected to fill storage space significantly.- Returns:
- The non-empty string of the parallel deployment version or
Optional.empty()when unable to determine the version (in which case the underlying cause is logged).
-
doGet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - Overrides:
doGetin classHttpServlet- Throws:
ServletExceptionIOException
-
