mcardle 2005/12/05 20:03:11 CET
Modified files:
WEB-INF/config data.xml
src/net/sf/j2ep ConfigParser.java
src/org/jahia/esi EsiConst.java GetThread.java Utils.java
src/org/jahia/esi/cache FragmentCache.java
src/org/jahia/esi/settings GeneralSettings.java
Log:
* adds configurable default MaxRemovalDelay and ExpirationDelay
Revision Changes Path
1.9 +3 -2 esi_server/WEB-INF/config/data.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/WEB-INF/config/data.xml.diff?r1=1.8&r2=1.9&f=h
1.8 +3 -0 esi_server/src/net/sf/j2ep/ConfigParser.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/net/sf/j2ep/ConfigParser.java.diff?r1=1.7&r2=1.8&f=h
1.2 +0 -2 esi_server/src/org/jahia/esi/EsiConst.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/EsiConst.java.diff?r1=1.1&r2=1.2&f=h
1.13 +4 -2 esi_server/src/org/jahia/esi/GetThread.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/GetThread.java.diff?r1=1.12&r2=1.13&f=h
1.14 +1 -1 esi_server/src/org/jahia/esi/Utils.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/Utils.java.diff?r1=1.13&r2=1.14&f=h
1.10 +4 -4 esi_server/src/org/jahia/esi/cache/FragmentCache.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/cache/FragmentCache.java.diff?r1=1.9&r2=1.10&f=h
1.6 +62 -41
esi_server/src/org/jahia/esi/settings/GeneralSettings.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/settings/GeneralSettings.java.diff?r1=1.5&r2=1.6&f=h
Index: data.xml
===================================================================
RCS file: /home/cvs/repository/esi_server/WEB-INF/config/data.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- data.xml 24 Nov 2005 17:21:08 -0000 1.8
+++ data.xml 5 Dec 2005 19:03:09 -0000 1.9
@@ -21,13 +21,14 @@
<userCookieName>username</userCookieName>
- <numberOfAttempts>3</numberOfAttempts>
+ <numberOfAttempts>2</numberOfAttempts>
<maximumSizeOfCacheableContent>100000</maximumSizeOfCacheableContent>
<nonCacheableContentTypes>application/x-shockwave-flash,
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
application/x-icq</nonCacheableContentTypes>
-
+ <defaultExpirationDelayInSecs>86400</defaultExpirationDelayInSecs>
+ <defaultMaxRemovalDelayInSecs>0</defaultMaxRemovalDelayInSecs>
</generalsettings>
<!--server className="net.sf.j2ep.servers.BaseServer"
Index: ConfigParser.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/net/sf/j2ep/ConfigParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConfigParser.java 24 Nov 2005 17:25:15 -0000 1.7
+++ ConfigParser.java 5 Dec 2005 19:03:10 -0000 1.8
@@ -107,6 +107,9 @@
digester.addBeanPropertySetter(
"config/generalsettings/numberOfAttempts", "numberOfAttempts" );
digester.addBeanPropertySetter(
"config/generalsettings/nonCacheableContentTypes", "nonCacheableContentTypes" );
digester.addBeanPropertySetter(
"config/generalsettings/maximumSizeOfCacheableContent",
"maximumSizeOfCacheableContent" );
+ digester.addBeanPropertySetter(
"config/generalsettings/defaultExpirationDelayInSecs", "defaultExpiration" );
+ digester.addBeanPropertySetter(
"config/generalsettings/defaultMaxRemovalDelayInSecs", "defaultMaxRemovalDelay"
);
+
GeneralSettings generalSettings = (GeneralSettings)
digester.parse(data);
GeneralSettings.setInstance(generalSettings);
Index: EsiConst.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/org/jahia/esi/EsiConst.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EsiConst.java 25 Oct 2005 12:32:19 -0000 1.1
+++ EsiConst.java 5 Dec 2005 19:03:10 -0000 1.2
@@ -18,12 +18,10 @@
public static final String SURROGATE_10 = "Surrogate/1.0";
public static final String ESI_10 = "ESI/1.0";
public static final String CONTENT_ESI_10 = "content=\"ESI/1.0\"";
//process standard ESI tags
- public static final int DEFAULT_EXPIRATION = 86400;
public static final String INFINITY_EXPIRATION_MARKER = "infinity";
//max-age=infinity specifies that the document never expires
public static final int INFINITY_EXPIRATION = -1;
public static final String ESI_INLINE_10 = "ESI-Inline/1.0"; //process
<esi:inline> tags
public static final String ESI_INV_10 = "ESI-INV/1.0"; //process
<esi:invalidate> tags
- public static final int DEFAULT_DELAY = 0;
public static final String NO_STORE = "no-store";
/*The no-store-remote directive has similar semantics to the no-store
directive,
Index: GetThread.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/org/jahia/esi/GetThread.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- GetThread.java 24 Nov 2005 17:25:16 -0000 1.12
+++ GetThread.java 5 Dec 2005 19:03:10 -0000 1.13
@@ -70,8 +70,8 @@
private String errorPageUrlKey = null; //holds the UrlKey of the object
which generated the HTTP 403 Forbidden error
long expirationDateInSecs = -2;
- long expirationInSecs = EsiConst.DEFAULT_EXPIRATION;
- long maxRemovalDelayInSecs = EsiConst.DEFAULT_DELAY;
+ long expirationInSecs;
+ long maxRemovalDelayInSecs ;
boolean isContentEsi10 = false; //process standard ESI tags
boolean isContentEsiInline10 = false; //process <esi:inline> tags
boolean isContentEsiInv10 = false; //process <esi:invalidate> tags
@@ -86,6 +86,8 @@
String urlKey,
UrlCacheObject urlObj,
String clientRequestUrl) {
+ expirationInSecs =
GeneralSettings.getInstance().getDefaultExpiration();
+ maxRemovalDelayInSecs =
GeneralSettings.getInstance().getDefaultMaxRemovalDelay();
this.clientRequestUrl = clientRequestUrl;
this.httpClient = httpClient;
Index: Utils.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/org/jahia/esi/Utils.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Utils.java 5 Dec 2005 16:49:00 -0000 1.13
+++ Utils.java 5 Dec 2005 19:03:10 -0000 1.14
@@ -25,7 +25,7 @@
private static final transient Log log = LogFactory.getLog(Utils.class);
public static String jahiaEsiServerBuildNumber = "0.1";
-
+
public static GetMethod copyMethod ( HttpMethod method) {
try {
//TODO: expand to other methods than GetMethod
Index: FragmentCache.java
===================================================================
RCS file:
/home/cvs/repository/esi_server/src/org/jahia/esi/cache/FragmentCache.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FragmentCache.java 5 Dec 2005 16:49:01 -0000 1.9
+++ FragmentCache.java 5 Dec 2005 19:03:10 -0000 1.10
@@ -11,7 +11,7 @@
import org.apache.commons.codec.binary.Base64;
import org.jahia.esi.cache.CacheObject;
import org.jahia.esi.cache.ContentCacheObject;
-import org.jahia.esi.EsiConst;
+import org.jahia.esi.settings.GeneralSettings;
import org.jahia.esi.stats.EsiStats;
/**
@@ -97,9 +97,9 @@
refObjsUrls,
referencedObjsStartIndex,
referencedObjsEndIndex,
- EsiConst.DEFAULT_EXPIRATION,
- (new Date()).getTime()/1000 + EsiConst.DEFAULT_EXPIRATION,
- EsiConst.DEFAULT_DELAY );
+ GeneralSettings.getInstance().getDefaultExpiration(),
+ (new Date()).getTime()/1000 +
GeneralSettings.getInstance().getDefaultMaxRemovalDelay(),
+ GeneralSettings.getInstance().getDefaultMaxRemovalDelay() );
}
public synchronized void addUnfectched(String urlKey, HttpMethod method,
String errorMsg,
Index: GeneralSettings.java
===================================================================
RCS file:
/home/cvs/repository/esi_server/src/org/jahia/esi/settings/GeneralSettings.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GeneralSettings.java 24 Nov 2005 16:59:02 -0000 1.5
+++ GeneralSettings.java 5 Dec 2005 19:03:10 -0000 1.6
@@ -11,42 +11,61 @@
*/
public class GeneralSettings {
- private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone( "GMT"
);
+ private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone(
"GMT" );
- private int invalidationPort;
- private boolean activateInvalidationServer;
+ private int invalidationPort;
+ private boolean activateInvalidationServer;
- private boolean enableCacheBypass;
- private boolean enableCacheOff;
- private boolean enableCacheOffOnce;
+ private boolean enableCacheBypass;
+ private boolean enableCacheOff;
+ private boolean enableCacheOffOnce;
- private String userCookieName; //marker to recognize ESI specific cookie
+ private String userCookieName; //marker to recognize ESI specific cookie
- private int maximumSizeOfCacheableContent = 100000;
- private String nonCacheableContentTypes = "";
+ private int maximumSizeOfCacheableContent = 100000;
+ private String nonCacheableContentTypes = "";
- private boolean enableESI; //TODO: support this
+ private boolean enableESI; //TODO: support this
- private int maxCacheableBinarySize;
- private int maxHttpClientThreads;
+ private int maxCacheableBinarySize;
+ private int maxHttpClientThreads;
- private int numberOfAttempts;
+ private int numberOfAttempts;
- private int connectionTimeout;
+ private int connectionTimeout;
- private String username;
- private String password;
+ private String username;
+ private String password;
- //TODO:public static final int DEFAULT_EXPIRATION = 86400;
- //TODO:public static final int DEFAULT_DELAY = 0;
+ private int defaultExpiration;
+ private int defaultMaxRemovalDelay;
- public GeneralSettings() {}
+ public static final int DEFAULT_EXPIRATION = 86400;
+ public static final int DEFAULT_DELAY = 0;
- static GeneralSettings generalSettings;
+ public GeneralSettings() {}
- public static void setInstance(GeneralSettings _generalSettings) {
- generalSettings = _generalSettings;
- }
+ static GeneralSettings generalSettings;
+
+ public static void setInstance(GeneralSettings _generalSettings) {
+ generalSettings = _generalSettings;
+ }
+
+ public int getDefaultExpiration() {
+ return defaultExpiration;
+ }
+
+ public void setDefaultExpiration(int defaultExpiration) {
+ this.defaultExpiration = defaultExpiration;
+ }
+
+ public int getDefaultMaxRemovalDelay() {
+ return defaultMaxRemovalDelay;
+ }
+
+ public void setDefaultMaxRemovalDelay(int defaultMaxRemovalDelay) {
+ this.defaultMaxRemovalDelay = defaultMaxRemovalDelay;
+ }
public int getNumberOfAttempts() {
return numberOfAttempts;
@@ -65,8 +84,8 @@
}
public static GeneralSettings getInstance() {
- return generalSettings;
- }
+ return generalSettings;
+ }
public String getUsername() {
return username;
@@ -173,22 +192,24 @@
}
public String toString() {
- return "GeneralSettings{" +
- "invalidationPort=" + invalidationPort +
- ", activateInvalidationServer=" + activateInvalidationServer
+
- ", enableCacheBypass=" + enableCacheBypass +
- ", enableCacheOff=" + enableCacheOff +
- ", enableCacheOffOnce=" + enableCacheOffOnce +
- ", userCookieName='" + userCookieName + "'" +
- ", maximumSizeOfCacheableContent=" +
maximumSizeOfCacheableContent +
- ", nonCacheableContentTypes='" + nonCacheableContentTypes +
"'" +
- ", enableESI=" + enableESI +
- ", maxCacheableBinarySize=" + maxCacheableBinarySize +
- ", maxHttpClientThreads=" + maxHttpClientThreads +
- ", numberOfAttempts=" + numberOfAttempts +
- ", connectionTimeout=" + connectionTimeout +
- ", username='" + username + "'" +
- ", password='" + password + "'" +
+ return "GeneralSettings{" + "\n" +
+ "invalidationPort=" + invalidationPort + "\n" +
+ ", activateInvalidationServer=" + activateInvalidationServer
+ "\n" +
+ ", enableCacheBypass=" + enableCacheBypass + "\n" +
+ ", enableCacheOff=" + enableCacheOff + "\n" +
+ ", enableCacheOffOnce=" + enableCacheOffOnce + "\n" +
+ ", userCookieName='" + userCookieName + "'" + "\n" +
+ ", maximumSizeOfCacheableContent=" +
maximumSizeOfCacheableContent + "\n" +
+ ", nonCacheableContentTypes='" + nonCacheableContentTypes +
"'" + "\n" +
+ ", defaultExpirationInSecs=" + defaultExpiration + "\n" +
+ ", defaultMaxRemovalDelayInSecs='" + defaultMaxRemovalDelay
+ "'" + "\n" +
+ ", enableESI=" + enableESI + "\n" +
+ ", maxCacheableBinarySize=" + maxCacheableBinarySize + "\n" +
+ ", maxHttpClientThreads=" + maxHttpClientThreads + "\n" +
+ ", numberOfAttempts=" + numberOfAttempts + "\n" +
+ ", connectionTimeout=" + connectionTimeout + "\n" +
+ ", username='" + username + "'" + "\n" +
+ ", password='" + password + "'" + "\n" +
"}";
}
}