[OLINGO-731] Added version information to MANIFEST.MF

This commit is contained in:
mibo 2015-08-10 20:09:46 +02:00
parent 1d88d9c986
commit dc44d7c998
2 changed files with 19 additions and 9 deletions

View File

@ -116,10 +116,11 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven.bundle.plugin.version}</version>
<version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Implementation-Version>${project.version}</Implementation-Version>
<Export-Package>
org.apache.olingo.server.core
</Export-Package>

View File

@ -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<DebugTab> parts, String title) throws IOException {
StringWriter writer = new StringWriter();