[Seaside] WAHtmlRoot>>writeHeadOn: broken when there is no request

Boris Popov boris at deepcovelabs.com
Thu Jun 19 16:40:10 UTC 2008


[I'm not sure if this is VisualWorks specific, but here goes anyway]

The fix to avoid writing extra head elements for Ajax requests assumes
that rendering happens in response to a request, which might not always
be the case, especially if you use seaside rendering facilities for any
kind of report generation and such on the server.

Current,

writeHeadOn: aDocument
	aDocument nextPutAll: docType.
	aDocument openTag: 'html' attributes: htmlAttrs.
	aDocument openTag: 'head' attributes: headAttrs.
	WACurrentSession value currentRequest isXmlHttpRequest ifFalse:
[
		self
			writeElementsOn: aDocument;
			writeStylesOn: aDocument;
			writeScriptsOn: aDocument ].
	aDocument closeTag: 'head'.
	aDocument openTag: 'body' attributes: bodyAttrs
	

Workaround,
	
writeHeadOn: aDocument
	| req |
	aDocument nextPutAll: docType.
	aDocument openTag: 'html' attributes: htmlAttrs.
	aDocument openTag: 'head' attributes: headAttrs.
	req := WACurrentSession value currentRequest.
	(req isNil or: [req isXmlHttpRequest not])
		ifTrue:
			[self
				writeElementsOn: aDocument;
				writeStylesOn: aDocument;
				writeScriptsOn: aDocument].
	aDocument closeTag: 'head'.
	aDocument openTag: 'body' attributes: bodyAttrs.

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris at deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

_______________________________________________
vwnc mailing list
vwnc at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


More information about the seaside mailing list