freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
changeset 88 a3be2be0112f
parent 85 3574b08dc3c3
child 95 36ace6ba1dc1
     1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Mon Sep 14 16:11:39 2009 +0200
     1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Tue Sep 15 07:32:17 2009 +0200
     1.3 @@ -35,11 +35,14 @@
     1.4  import com.sun.jersey.api.view.Viewable;
     1.5  import com.sun.net.httpserver.HttpServer;
     1.6  import java.io.File;
     1.7 +import java.io.IOException;
     1.8 +import java.io.InputStream;
     1.9  import java.net.URI;
    1.10  import java.util.HashMap;
    1.11  import java.util.Locale;
    1.12  import java.util.Map;
    1.13  import java.util.MissingResourceException;
    1.14 +import java.util.Properties;
    1.15  import java.util.ResourceBundle;
    1.16  import java.util.concurrent.Callable;
    1.17  import javax.ws.rs.DefaultValue;
    1.18 @@ -63,6 +66,19 @@
    1.19   */
    1.20  @Path("/")
    1.21  public final class UI {
    1.22 +    private static final String version;
    1.23 +    static {
    1.24 +        Properties p = new Properties();
    1.25 +        try {
    1.26 +            InputStream is = FreemarkerProcessor.class.getResourceAsStream("/META-INF/maven/org.apidesign/freemarkerdor/pom.properties"); // NOI18N
    1.27 +            if (is != null) {
    1.28 +                p.load(is);
    1.29 +            }
    1.30 +        } catch (IOException ex) {
    1.31 +            ex.printStackTrace();
    1.32 +        }
    1.33 +        version = p.getProperty("version", "unknown"); // NOI18N
    1.34 +    }
    1.35      private static WebResource base;
    1.36  
    1.37      @Context
    1.38 @@ -274,6 +290,7 @@
    1.39          map.put("user", user);
    1.40          map.put("bundle", rb);
    1.41          map.put("now", System.currentTimeMillis());
    1.42 +        map.put("version", version);
    1.43          for (int i = 0; i < more.length; i += 2) {
    1.44              map.put((String)more[i],more[i + 1]);
    1.45          }