You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/08/29 15:05:51 UTC
svn commit: r690245 -
/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Author: reinhard
Date: Fri Aug 29 06:05:50 2008
New Revision: 690245
URL: http://svn.apache.org/viewvc?rev=690245&view=rev
Log:
read the version number only once
Modified:
cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java?rev=690245&r1=690244&r2=690245&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java Fri Aug 29 06:05:50 2008
@@ -60,11 +60,13 @@
private boolean initialized;
private ServletConfig servletConfig;
private Sitemap sitemap;
+ private String version;
@Override
public void init(ServletConfig servletConfig) throws ServletException {
this.servletConfig = servletConfig;
super.init(this.servletConfig);
+ this.initVersionNumber();
}
public void invoke(String requestURI, Map<String, Object> parameters, OutputStream outputStream)
@@ -169,25 +171,31 @@
}
private void setVersionHeader(HttpServletResponse response) {
- // FIXME After renaming Corona to Cocoon3, read the version from the manifest
- // FIXME Make this header configureable
- String version = "3.0.0-SNAPSHOT";
- if (version.endsWith("SNAPSHOT")) {
+ if (this.version == null) {
+
+ }
+ response.setHeader("X-Cocoon-Version", this.version);
+ }
+
+ // FIXME After renaming Corona to Cocoon3, read the version from the manifest
+ // FIXME Make this header configureable
+ private void initVersionNumber() {
+ this.version = "3.0.0-SNAPSHOT";
+
+ if (this.version.endsWith("SNAPSHOT")) {
String buildNumber = "";
try {
String buildNumberAttr = ManifestUtils.getAttribute(this.getClass(), "Implementation-Build");
if (buildNumberAttr != null && !"".equals(buildNumberAttr) && !"na".equals(buildNumberAttr)) {
buildNumber = "/rev" + buildNumberAttr;
}
-
} catch (IOException e) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Error while reading an attribute from the manifest.", e);
}
}
- version += buildNumber;
+ this.version += buildNumber;
}
- response.setHeader("X-Cocoon-Version", version);
}
private void logRequest(HttpServletRequest request) throws ServletException {