[Seaside] CSS URLs

Michel Bany michel.bany at gmail.com
Wed Oct 4 10:16:19 UTC 2006


Hi Ron,

> To do this I would need to be able to support a URL in css.  I've  
> got this
> working "IF" I translate the url to a seaside url.

I have done something similar in VW as part of parcel  
"SeasideWebDesignerTool".
The idea is to use a subclass of WARequestHandler that is designed to  
serve
graphic files. This subclass is named WAPictureServer and is registered
as 'images' in the default dispatcher. As a result, any url in the form
/seaside/images/foo/bar/... is dispatched to this handler via  
#handleRequest:
The corresponding method delegates the request handling to an instance
of WAPictureHandler. It parses the url like that :
	/seaside/images/AAA/BBB.CCC
where
AAA is the name of a class
BBB is the name of an annotated method that answers a byte array
.CCC is optional and ignored
Typically, AAA is a subclass of WAStyleLibrary and method BBB is  
annotated like this :

bg
	<objectNamed: 'bg.gif'
		contentType: 'image/gif'
		uploadDate: 'April 13, 2005 12:00:00.002'
		creationDate: 'April 13, 2005 12:00:00.003'
		modificationDate: 'April 13, 2005 12:00:00.004'
		by: 'Douglas Bowman'>

	^ ByteArray fromPackedString:
'Q4%FNC%!E@@- at LP@@M7#5]/!4?;>?/K4;.[)8M+ 4/3<?OW7</''9=>+-9NC$5.W 
(7.;1:.70:^?2:>K%6/#8=/_7=_O5<N'',8?+:>O/;>>/.97]&U^O&6>S''7_7=?^3/:NG 
$6_G3;.C#6N#+8"G9A@@@@@@@K@@@@@@T at B4@@@W XBFNYF&^JA&,[N.>\B3OK&C_^J;/ 
_N?''"*A0RB0ZO\"$D&%T\I;P:OMA+U*/U8162>56L>B0^C1^&L?(]I*0XK/[!K!<S*? 
[;?#8Y?>Y>O>@ XDI!HVF!8"I" $V#AZO$IFR$!.U%)^XF06[''I6^'' 2!(*N$) 
ZHN*J&**:,C+*>0,[D]-KV4,*:6.K.1D+:?0LGAA<SE1,_H2\+FD\7N3=CPDMOT5] 
[VBM''Z6=3]7-?[ENK#9NW%E^#):./+A.;/<OG2<?S0F/_8>_+:@/7>?0 at CB!1H,BC at B0  
SJ%28L at P@N0 at a'

The above sample answers a ByteArray built from a constant. It could
also answer a Byte Array read from a file and cached.

With the above in place you can now have things like this in your css:
	url("/seaside/images/SlidingDoors/bg.gif")

Not sure if this has been done in Squeak.

HTH
Michel.



More information about the Seaside mailing list