Package com.randomnoun.common.servlet
Class VersionServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.randomnoun.common.servlet.VersionServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
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
Modifier and TypeFieldDescriptionstatic final org.apache.log4j.Logger
Logger for this class -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doGet
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) See class documentationprotected void
doPost
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Post method; just defers to getMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
logger
Logger for this class
-
-
Constructor Details
-
VersionServlet
public VersionServlet()
-
-
Method Details
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException Post method; just defers to get- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
- See Also:
-
HttpServlet.doPost(HttpServletRequest request, HttpServletResponse response)
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException See class documentation- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
- See Also:
-
HttpServlet.doGet(HttpServletRequest request, HttpServletResponse response)
-