summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/GitBlitWebApp.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-07-19 10:46:16 -0400
committerJames Moger <james.moger@gitblit.com>2013-07-19 10:50:32 -0400
commita7db5748622e1b322b67fbbd72aed4e6efff7690 (patch)
tree90e5ff60ee365da5b32388cfd790382672dbc232 /src/main/java/com/gitblit/wicket/GitBlitWebApp.java
parent0bfd34316b5903c29f93b352f0aa8e8cdce51cad (diff)
downloadgitblit-a7db5748622e1b322b67fbbd72aed4e6efff7690.tar.gz
gitblit-a7db5748622e1b322b67fbbd72aed4e6efff7690.zip
Implemented optional page caching
Diffstat (limited to 'src/main/java/com/gitblit/wicket/GitBlitWebApp.java')
-rw-r--r--src/main/java/com/gitblit/wicket/GitBlitWebApp.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java
index cdae0931..74ccac7d 100644
--- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java
+++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java
@@ -15,7 +15,9 @@
*/
package com.gitblit.wicket;
+import java.util.HashMap;
import java.util.Locale;
+import java.util.Map;
import org.apache.wicket.Application;
import org.apache.wicket.Page;
@@ -71,6 +73,8 @@ public class GitBlitWebApp extends WebApplication {
public final static Class<? extends BasePage> HOME_PAGE_CLASS = MyDashboardPage.class;
+ private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>();
+
@Override
public void init() {
super.init();
@@ -149,6 +153,12 @@ public class GitBlitWebApp extends WebApplication {
parameters = new String[] {};
}
mount(new GitblitParamUrlCodingStrategy(location, clazz, parameters));
+
+ // map the mount point to the cache control definition
+ if (clazz.isAnnotationPresent(CacheControl.class)) {
+ CacheControl cacheControl = clazz.getAnnotation(CacheControl.class);
+ cacheablePages.put(location.substring(1), cacheControl);
+ }
}
@Override
@@ -156,6 +166,14 @@ public class GitBlitWebApp extends WebApplication {
return HOME_PAGE_CLASS;
}
+ public boolean isCacheablePage(String mountPoint) {
+ return cacheablePages.containsKey(mountPoint);
+ }
+
+ public CacheControl getCacheControl(String mountPoint) {
+ return cacheablePages.get(mountPoint);
+ }
+
@Override
public final Session newSession(Request request, Response response) {
GitBlitWebSession gitBlitWebSession = new GitBlitWebSession(request);