View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide


SwikiCachingFix is now available as a package at SqueakMap. Thank you, Mr. Marcus Denker, for maintaining the package. –shr

On Tue, Nov 19, 2002 at 01:40:04PM +0100, Marcus Denker wrote:
> Hi!
> I started to really use Swiki... works great, but I have some small
> problems:
> I think there is something wrong with how images are handeld: They are
> reloaded on *every* pageview.
> Is this behaviour intended or a bug? This is really annoying when using
> slow dialup-connections.


I just made a small changeset to support HTTP response
tags like 'Last-Modified:', and 'Expires:' for some responses.
I think this will help your situation.

To update your Swiki server, you should apply one changeset to
your running image, and then modify at least two Swiki
templates using SwikiBrowser.

(1) File-in the

You may want to patch the newely-added TimeStamp>>asHttpDate method to adapt to your own time-zone.

Find the line looks like:

ts _ self minusSeconds: 32400.

and change the number 32400 to your time-zone shift in unit of seconds.

I live in Korea and my shift is 9 hour ahead of GMT. So I put 9 * 3600 = 32400 for my shift. If you are at 5 hours behind GMT, the value should become -5 * 3600 = -18000.

Note: After filing in this code, the method SwikiModule>>responseFrom: changes the charset type to Korean in the line:

response contentType: (dict at: 'contentType' ifAbsent: [(MIMEDocument contentTypeHtml), '; charset=euc-kr']).

The current Swiki implementation uses:

	"content type"
	response contentType: (dict at: 'contentType' ifAbsent: [(MIMEDocument contentTypeHtml), '; charset=iso-8859-1']).

You probably want to change the method to reflect your character set.

(2) Launch SwikiBrowser to edit the templates.

Select [shelf] -> addresses(priv) -> –all– -> initFileServer,

and change:

fileServer serveFileBlock: [:file :dir :options | (options at: 'response') at: 'cacheing' put: true; at: 'contentType' put: (file mimeType). dir readOnlyFile: file].


fileServer serveFileBlock: [:file :dir :options | (options at: 'request') raw header at: 'if-modified-since' ifPresent: [ :value | (file isNotModifiedSinceHttpDate: value) ifTrue: [ (options at: 'response') at: 'headerStatus' put: #notModified ] ]. (options at: 'response') at: 'modified' put: file modificationTimeStamp; at: 'cacheing' put: true; at: 'contentType' put: (file mimeType). dir readOnlyFile: file].

Then Select refs -> addresses(priv) -> –all– –>
initUploadServer, and do the same change for this entry.

At last, you must stop and then re-start your Swiki to this
templates are applied. (Since these are some kind of initialization templates, they are never called again while running). contains pre-modified templates. Just for references.