# HG changeset patch # User ymh # Date 1392286038 -3600 # Node ID c14725cb24ae13bf9b1fcad353c5e98d63bed329 # Parent 6bf1126c5add89055bdc77f617975ff167f2dec4 take version from manifest diff -r 6bf1126c5add -r c14725cb24ae server/pom.xml --- a/server/pom.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/pom.xml Thu Feb 13 11:07:18 2014 +0100 @@ -4,7 +4,7 @@ 4.0.0 org.iri_research.renkan renkan - 0.7.5 + 0.7.6 war @@ -15,7 +15,7 @@ 3.2.6.RELEASE 1.3.3.RELEASE 3.2.0.RELEASE - 1.6.1.RELEASE + 1.6.3.RELEASE 1.4.3.RELEASE 8.1.14.v20131031 8.1.14.v20131031 @@ -26,7 +26,7 @@ 2.7.0 2.2.3 2.3 - 2.11.3 + 2.11.4 2.0 1.2 1 diff -r 6bf1126c5add -r c14725cb24ae server/src/main/java/org/iri_research/renkan/Constants.java --- a/server/src/main/java/org/iri_research/renkan/Constants.java Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/main/java/org/iri_research/renkan/Constants.java Thu Feb 13 11:07:18 2014 +0100 @@ -10,42 +10,6 @@ public class Constants { - static { - - } - - public final static List VERSION = Collections - .unmodifiableList(new ArrayList() { - private static final long serialVersionUID = -6935554100028328149L; - { - add("0"); - add("7"); - add("5"); - add("final"); - add("0"); - } - }); - - public static String getVersion() { - - String[] version_array = VERSION.toArray(new String[VERSION.size()]); - - String version = String.format("%s.%s", version_array[0], - version_array[1]); - if (version_array[2] != null && !version_array[2].isEmpty() - && Integer.parseInt(version_array[2]) > 0) { - version = String.format("%s.%s", version, version_array[2]); - } - if (version_array[3] == "alpha" && version_array[4] == "0") { - version = String.format("%s pre-alpha", version); - } else if (version_array[3] != "final") { - version = String.format("%s %s %s", version, version_array[3], - version_array[4]); - } - return version; - - } - public final static String KEYHEX = "f2338d2299ac28ef64f82956fde37337b87a2b9e8fc03e28fa0768cac37d838113c7d0fc78c60fce1e23b1b3e03ac7db4676b3189c267f26baaab10f72544441"; public final static int SALT_LENGTH = 24; public final static int PAGINATION_SIZE = 10; diff -r 6bf1126c5add -r c14725cb24ae server/src/main/java/org/iri_research/renkan/controller/VersionHandlerInterceptor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/controller/VersionHandlerInterceptor.java Thu Feb 13 11:07:18 2014 +0100 @@ -0,0 +1,55 @@ +package org.iri_research.renkan.controller; + +import java.io.IOException; +import java.io.InputStream; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +@Component +public class VersionHandlerInterceptor extends HandlerInterceptorAdapter { + + @SuppressWarnings("unused") + private final Logger logger = LoggerFactory + .getLogger(VersionHandlerInterceptor.class); + + private static String version = null; + + @Override + public void postHandle(HttpServletRequest request, + HttpServletResponse response, Object handler, + ModelAndView modelAndView) throws Exception { + if(modelAndView != null) { + if(version == null) { + ServletContext context = request.getServletContext(); + InputStream inputStream = context.getResourceAsStream("/META-INF/MANIFEST.MF"); + if(inputStream != null) { + try { + Manifest manifest = new Manifest(inputStream); + Attributes att = manifest.getMainAttributes(); + version = att.getValue("Implementation-Version"); + } + catch(IOException e) { + version = "N/A"; + } + } + if(version == null) { + version = "NULL"; + } + else if (version == "") { + version = "EMPTY"; + } + } + modelAndView.addObject("version", version); + } + } +} diff -r 6bf1126c5add -r c14725cb24ae server/src/main/webapp/WEB-INF/applicationContext.xml --- a/server/src/main/webapp/WEB-INF/applicationContext.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/main/webapp/WEB-INF/applicationContext.xml Thu Feb 13 11:07:18 2014 +0100 @@ -6,17 +6,18 @@ xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd + http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util - http://www.springframework.org/schema/util/spring-util-3.0.xsd + http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/mvc - http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd" + http://www.springframework.org/schema/mvc/spring-mvc.xsd" > - - - + + + + WEB-INF/renkan.properties @@ -82,6 +83,7 @@ + @@ -92,6 +94,5 @@ - diff -r 6bf1126c5add -r c14725cb24ae server/src/main/webapp/WEB-INF/spring-servlet.xml --- a/server/src/main/webapp/WEB-INF/spring-servlet.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/main/webapp/WEB-INF/spring-servlet.xml Thu Feb 13 11:07:18 2014 +0100 @@ -30,6 +30,10 @@ + + + + @@ -54,12 +58,12 @@ - - - + + + - + diff -r 6bf1126c5add -r c14725cb24ae server/src/main/webapp/WEB-INF/templates/fragment/pageFragment.html --- a/server/src/main/webapp/WEB-INF/templates/fragment/pageFragment.html Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/main/webapp/WEB-INF/templates/fragment/pageFragment.html Thu Feb 13 11:07:18 2014 +0100 @@ -22,7 +22,7 @@
-
© 2013 IRI - Version 0.0a
+
© 2013 IRI - Version 0.0a
\ No newline at end of file diff -r 6bf1126c5add -r c14725cb24ae server/src/test/java/org/iri_research/renkan/test/controller/GroupsAdminControllerTest.java --- a/server/src/test/java/org/iri_research/renkan/test/controller/GroupsAdminControllerTest.java Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/java/org/iri_research/renkan/test/controller/GroupsAdminControllerTest.java Thu Feb 13 11:07:18 2014 +0100 @@ -178,7 +178,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups?version=NULL")); Group group = this.groupsRepository.findOne(this.groupsUuids.get(0)); @@ -204,7 +204,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups?version=NULL")); Assert.assertEquals("Must have one more group", GROUP_NB + 1, this.groupsRepository.count()); @@ -410,7 +410,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups?version=NULL")); Assert.assertEquals("Must have one less space", GROUP_NB - 1, this.groupsRepository.count()); @@ -441,7 +441,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups?version=NULL")); Assert.assertEquals("Must have the same nb of group", GROUP_NB, this.groupsRepository.count()); @@ -462,7 +462,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/groups?version=NULL")); Group group = this.groupsRepository.findOne(this.groupsUuids.get(0)); diff -r 6bf1126c5add -r c14725cb24ae server/src/test/java/org/iri_research/renkan/test/controller/SpacesAdminControllerTest.java --- a/server/src/test/java/org/iri_research/renkan/test/controller/SpacesAdminControllerTest.java Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/java/org/iri_research/renkan/test/controller/SpacesAdminControllerTest.java Thu Feb 13 11:07:18 2014 +0100 @@ -120,7 +120,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces?version=NULL")); Space sp = this.spacesRepository.findOne(this.spacesUuids.get(0)); @@ -148,7 +148,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces?version=NULL")); Assert.assertEquals("Must have one more space", SPACE_NB + 1, this.spacesRepository.count()); @@ -481,7 +481,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces?version=NULL")); Assert.assertEquals("Must have one less space", SPACE_NB - 1, this.spacesRepository.count()); @@ -512,7 +512,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/spaces?version=NULL")); Assert.assertEquals("Must have the same nb of space", SPACE_NB, this.spacesRepository.count()); diff -r 6bf1126c5add -r c14725cb24ae server/src/test/java/org/iri_research/renkan/test/controller/UsersAdminControllerTest.java --- a/server/src/test/java/org/iri_research/renkan/test/controller/UsersAdminControllerTest.java Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/java/org/iri_research/renkan/test/controller/UsersAdminControllerTest.java Thu Feb 13 11:07:18 2014 +0100 @@ -177,7 +177,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users?version=NULL")); User user = this.usersRepository.findOne(this.usersUuids.get(0)); @@ -206,7 +206,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users?version=NULL")); Assert.assertEquals("Must have one more space", USER_NB + 1, this.usersRepository.count()); @@ -441,7 +441,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users?version=NULL")); Assert.assertEquals("Must have one less user", USER_NB - 1, this.usersRepository.count()); @@ -472,7 +472,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users?version=NULL")); Assert.assertEquals("Must have the same nb of user", USER_NB, this.usersRepository.count()); @@ -528,7 +528,7 @@ this.mvc.perform(post) .andExpect(MockMvcResultMatchers.status().isSeeOther()) - .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users")); + .andExpect(MockMvcResultMatchers.redirectedUrl("/admin/users?version=NULL")); User user = this.usersRepository.findOne(this.usersUuids.get(0)); diff -r 6bf1126c5add -r c14725cb24ae server/src/test/resources/org/iri_research/renkan/test/controller/controller-context.xml --- a/server/src/test/resources/org/iri_research/renkan/test/controller/controller-context.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/resources/org/iri_research/renkan/test/controller/controller-context.xml Thu Feb 13 11:07:18 2014 +0100 @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + http://www.springframework.org/schema/context/spring-context-3.2.xsd"> diff -r 6bf1126c5add -r c14725cb24ae server/src/test/resources/org/iri_research/renkan/test/repositories/repositories-context.xml --- a/server/src/test/resources/org/iri_research/renkan/test/repositories/repositories-context.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/resources/org/iri_research/renkan/test/repositories/repositories-context.xml Thu Feb 13 11:07:18 2014 +0100 @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + http://www.springframework.org/schema/context/spring-context-3.2.xsd"> diff -r 6bf1126c5add -r c14725cb24ae server/src/test/resources/org/iri_research/renkan/test/rest/rest-context.xml --- a/server/src/test/resources/org/iri_research/renkan/test/rest/rest-context.xml Tue Feb 11 10:18:29 2014 +0100 +++ b/server/src/test/resources/org/iri_research/renkan/test/rest/rest-context.xml Thu Feb 13 11:07:18 2014 +0100 @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + http://www.springframework.org/schema/context/spring-context-3.2.xsd">