From dc44d7c9980bbc3249f9406b0e220bbae09a423e Mon Sep 17 00:00:00 2001 From: mibo Date: Mon, 10 Aug 2015 20:09:46 +0200 Subject: [PATCH] [OLINGO-731] Added version information to MANIFEST.MF --- lib/server-core/pom.xml | 3 ++- .../core/debug/DebugResponseHelperImpl.java | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml index 68c48a3e0..9e5e494fa 100644 --- a/lib/server-core/pom.xml +++ b/lib/server-core/pom.xml @@ -116,10 +116,11 @@ org.apache.felix maven-bundle-plugin - ${maven.bundle.plugin.version} + ${maven.bundle.plugin.version} true + ${project.version} org.apache.olingo.server.core diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java index 94ab544ab..4b093e935 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java @@ -46,9 +46,9 @@ import com.fasterxml.jackson.core.JsonGenerator; public class DebugResponseHelperImpl implements DebugResponseHelper { - private static enum DebugFormat { + private enum DebugFormat { JSON, HTML, DOWNLOAD - }; + } private final DebugFormat requestedFormat; @@ -150,12 +150,7 @@ public class DebugResponseHelperImpl implements DebugResponseHelper { gen.writeFieldName("server"); gen.writeStartObject(); - String version = DebugResponseHelperImpl.class.getPackage().getImplementationVersion(); - if (version != null) { - gen.writeStringField("version", version); - } else { - gen.writeNullField("version"); - } + gen.writeStringField("version", getVersion()); for (DebugTab part : parts.subList(2, parts.size())) { gen.writeFieldName(part.getName().toLowerCase(Locale.ROOT)); part.appendJson(gen); @@ -169,6 +164,20 @@ public class DebugResponseHelperImpl implements DebugResponseHelper { return csb.getInputStream(); } + /** + * Get version field information for response. + * Result is never null. + * + * @return version field information + */ + private String getVersion() { + final String version = DebugResponseHelperImpl.class.getPackage().getImplementationVersion(); + if (version == null) { + return "Olingo"; + } + return "Olingo " + version; + } + private InputStream wrapInHtml(final List parts, String title) throws IOException { StringWriter writer = new StringWriter();