List Info

Thread: Patch for header info for caches and proxys




Patch for header info for caches and proxys
user name
2006-10-27 02:20:59
On Thu, Oct 26, 2006 at 09:31:41AM +1000, Alexander Samad
wrote:
> On Wed, Oct 25, 2006 at 07:55:09PM +1000, Alexander
Samad wrote:
> > On Wed, Oct 25, 2006 at 12:44:19PM +0300, Janne
Jalkanen wrote:
> > > > > Also, which URL provider are you
using?
> > > > using shortview
> > > 
> > > Figures.  Because it does not have a
parameter string, the proxy will
> > > probably keep it in the cache for a while,
until it is refreshed,
> > > because it can't know it has changed.
> > > 
> > > A temporary solution is to modify Wiki.jsp to
include the relevant
> > > cache-control headers...  But HTTP caching is
a big mystery to me in
> > > general, so if anyone has any practical
advice, that would be a great
> > > help... 
> > 
> > 
<snip>

I have attached a patch to add information for proxy's using
last-modified and etag.



> > 
> > 
> > > 
> > > /Janne
> > > 
> > >
_______________________________________________
> > > Jspwiki-users mailing list
> > > Jspwiki-usersecyrd.com
> > > http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
> > > 
> 
> 
> > _______________________________________________
> > Jspwiki-users mailing list
> > Jspwiki-usersecyrd.com
> > http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
> 


> _______________________________________________
> Jspwiki-users mailing list
> Jspwiki-usersecyrd.com
> http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users

### Eclipse Workspace Patch 1.0
#P JSPWiki
Index: src/webdocs/Wiki.jsp
============================================================
=======
RCS file: /p/cvs/JSPWiki/src/webdocs/Wiki.jsp,v
retrieving revision 1.64
diff -u -r1.64 Wiki.jsp
--- src/webdocs/Wiki.jsp	29 Jul 2006 19:27:18 -0000	1.64
+++ src/webdocs/Wiki.jsp	27 Oct 2006 02:07:01 -0000
 -1,8
+1,11 
-<% page import="org.apache.log4j.*" %>
-<% page import="com.ecyrd.jspwiki.*" %>
-<% page
import="org.apache.commons.lang.time.StopWatch"
%>
-<% page errorPage="/Error.jsp" %>
-<% taglib uri="/WEB-INF/jspwiki.tld"
prefix="wiki" %>
+<% page import="org.apache.log4j.*"%>
+<% page import="com.ecyrd.jspwiki.*"%>
+<% page
import="java.text.SimpleDateFormat"%>
+<% page import="java.text.DateFormat"%>
+<% page import="java.util.Date"%>
+<% page
import="org.apache.commons.lang.time.StopWatch"%&g
t;
+<% page errorPage="/Error.jsp"%>
+<% taglib uri="/WEB-INF/jspwiki.tld"
prefix="wiki"%>
 <%! 
     public void jspInit()
     {
 -29,6
+32,14 
     
     StopWatch sw = new StopWatch();
     sw.start();
+
+    // Date format for last-modified field has to follow
RFC 822 (RFC2822)
+    DateFormat df= new SimpleDateFormat("EEE', 'dd'
'MMM' 'yyyy' 'HH:mm:ss' 'Z");
+    Date dt= wikiContext.getPage().getLastModified();
+    
+    // Insert 2 headers 
+   
response.addHeader("Last-Modified",df.format(dt));
+    response.addHeader("ETag",new
Integer(wikiContext.getPage().getVersion()).toString());
     
     // Set the content type and include the response
content
     response.setContentType("text/html;
charset="+wiki.getContentEncoding() );
 -36,8
+47,12 
                                                            
wikiContext.getTemplate(),
                                                            
"ViewTemplate.jsp" );
 
-%><wiki:Include
page="<%=contentPage%>" /><%
-    sw.stop();
-    if( log.isDebugEnabled() ) log.debug("Total
response time from server on page "+pagereq+":
"+sw);
+%>
+<wiki:Include page="<%=contentPage%>"
/>
+<%
+	sw.stop();
+	if (log.isDebugEnabled())
+		log.debug("Total response time from server on page
" + pagereq
+		+ ": " + sw);
 %>
 
_______________________________________________
Jspwiki-users mailing list
Jspwiki-usersecyrd.com
http://ecyrd.com/cgi-bin/mailman/listinfo/jspwiki-users
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )