X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fweb%2Froot%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fweb%2FDaylightWeb.java;fp=opendaylight%2Fweb%2Froot%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fweb%2FDaylightWeb.java;h=ca37f4b7c19658ca14facf9af29d6d83d2cd07cb;hp=1d4211a9267e25a1399f48d99c145cdb6bf5b6fa;hb=afb7fca4a9c8e1d5f0fcf6aa368714806b1e5f87;hpb=19ec9cff6e2aab82d4b9483653cb529a7e53131a diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWeb.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWeb.java index 1d4211a926..ca37f4b7c1 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWeb.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWeb.java @@ -8,8 +8,10 @@ package org.opendaylight.controller.web; +import java.io.FileInputStream; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -28,6 +30,7 @@ import org.opendaylight.controller.sal.utils.StatusCode; import org.opendaylight.controller.usermanager.IUserManager; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -52,6 +55,23 @@ public class DaylightWeb { return "main"; } + /** + * Read the version.properties file for the property + * + * @param request + * @return String value configured in the version.properties file + */ + @RequestMapping(value="/versionProperty/{property}", method = RequestMethod.GET) + @ResponseBody + public String getVersion(HttpServletRequest request, @PathVariable("property") String property) { + Properties prop = new Properties(); + try { + prop.load(new FileInputStream("version.properties")); + return prop.getProperty(property+".version"); + } catch (Exception e) { + return null; + } + } @RequestMapping(value = "web.json") @ResponseBody public Map> bundles(HttpServletRequest request) {