Package com.randomnoun.common.servlet
Class VersionServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.randomnoun.common.servlet.VersionServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
Reads the contents of the build.properties file in the
current application and sends it to the browser in a
variety of forms. Probably JSON for starters.
The properties file must be located on the classpath at the location "/build.properties".
For this to work, the application needs to have been built
through maven (and possibly bamboo), and there should be a
build.properties
file in the application being created,
with the contents:
bamboo.buildKey=${bambooBuildKey} bamboo.buildNumber=${bambooBuildNumber} bamboo.buildPlanName=${bambooBuildPlanName} bamboo.buildTimeStamp=${bambooBuildTimeStamp} bamboo.buildForceCleanCheckout=${bambooForceCleanCheckout} bamboo.custom.cvs.last.update.time=${bambooCustomCvsLastUpdateTime} bamboo.custom.cvs.last.update.time.label=${bambooCustomCvsLastUpdateTimeLabel} maven.pom.name=${pom.name} maven.pom.version=${pom.version} maven.pom.groupId=${pom.groupId} maven.pom.artifactId=${pom.artifactId}and the bamboo plan should have the following in the bamboo plan's stage's job's task's maven goal specification:
"-DbambooBuildKey=${bamboo.buildKey}" "-DbambooBuildNumber=${bamboo.buildNumber}" "-DbambooBuildPlanName=${bamboo.buildPlanName}" "-DbambooBuildTimeStamp=${bamboo.buildTimeStamp}" "-DbambooBuildForceCleanCheckout=${bamboo.buildForceCleanCheckout}" "-DbambooCustomCvsLastUpdateTime=${bamboo.custom.cvs.last.update.time}" "-DbambooCustomCvsLastUpdateTimeLabel=${bamboo.custom.cvs.last.update.time.label}" -DuniqueVersion=false
This script will also look for a build.properties file in /etc/build.properties; this should exist on docker containers built by bamboo. If this exists, it is also included in the JSON output under the "/etc/build.properties" key.
- Author:
- knoxg
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.log4j.Logger
Logger for this classFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doGet
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) See class documentationprotected void
doPost
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Post method; just defers to getMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, init, service, service
Methods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
logger
Logger for this class
-
-
Constructor Details
-
VersionServlet
public VersionServlet()
-
-
Method Details
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException Post method; just defers to get- Overrides:
doPost
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
- See Also:
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException See class documentation- Overrides:
doGet
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
- See Also:
-