jon 01/08/09 13:44:20
Modified: lib commons-util-0.1-dev.jar
src/java/org/apache/turbine Turbine.java
Removed: src/adapter/org/apache/turbine/util HttpUtils.java
Log:
moved HttpUtils out of adapter and into commons-sandbox-util
moved a method that depended on RunData into Turbine.java...jason, if you
have a better place, please suggest and i will move it.
Revision Changes Path
1.3 +46 -41 jakarta-turbine/lib/commons-util-0.1-dev.jar
<<Binary file>>
1.84 +36 -1 jakarta-turbine/src/java/org/apache/turbine/Turbine.java
Index: Turbine.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- Turbine.java 2001/08/09 14:22:52 1.83
+++ Turbine.java 2001/08/09 20:44:20 1.84
@@ -58,6 +58,7 @@
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.util.Enumeration;
+import java.util.Date;
import java.util.Properties;
import java.util.Vector;
import java.util.Iterator;
@@ -72,6 +73,7 @@
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunDataFactory;
import org.apache.commons.util.StringUtils;
+import org.apache.commons.util.HttpUtils;
import org.apache.fulcrum.ServiceManager;
import org.apache.fulcrum.TurbineServices;
import org.apache.log4j.Category;
@@ -108,7 +110,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Turbine.java,v 1.83 2001/08/09 14:22:52 jvanzyl Exp $
+ * @version $Id: Turbine.java,v 1.84 2001/08/09 20:44:20 jon Exp $
*/
public class Turbine
extends HttpServlet
@@ -736,5 +738,38 @@
public static Configuration getConfiguration()
{
return configuration;
+ }
+
+ // New module stuff
+
+ public static String getDefaultModule(String moduleType)
+ {
+ return (String) defaultModules.get(moduleType);
+ }
+
+ /**
+ * This method sets the required expiration headers in the response
+ * for a given RunData object. This method attempts to set all
+ * relevant headers, both for HTTP 1.0 and HTTP 1.1.
+ *
+ * @param data The RunData object we are setting cache information for.
+ * @param expiry The number of seconds untill the document should expire,
+ * <code>0</code> indicating immediate expiration (i.e. no caching).
+ */
+ public static void setCacheHeaders(RunData data, int expiry)
+ {
+ if ( expiry == 0 )
+ {
+ data.getResponse().setHeader("Pragma", "no-cache");
+ data.getResponse().setHeader("Cache-Control", "no-cache");
+ data.getResponse().setHeader(
+ "Expires", HttpUtils.formatHttpDate(new Date()));
+ }
+ else
+ {
+ Date expiryDate = new Date( System.currentTimeMillis() + expiry );
+ data.getResponse().setHeader(
+ "Expires", HttpUtils.formatHttpDate(expiryDate));
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]