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

Lukas Renggli renggli at gmail.com
Thu Jun 19 17:10:23 UTC 2008


I replayed this:

---------- Forwarded message ----------
From: Lukas Renggli <renggli at gmail.com>
Date: Jun 18, 2008 6:25 PM
Subject: Re: [vwnc] [Seaside] WAHtmlRoot>>writeHeadOn: broken when
there is no request
To: Boris Popov <boris at deepcovelabs.com>


> 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.


Have a look at Scriptaculous (SUDocument) and how this is handled there.

 Cheers,
 Lukas



 >
 >  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
 >



--
 Lukas Renggli
 http://www.lukas-renggli.ch


-- 
Lukas Renggli
http://www.lukas-renggli.ch



On 6/19/08, Boris Popov <boris at deepcovelabs.com> wrote:
> [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
>  _______________________________________________
>  seaside mailing list
>  seaside at lists.squeakfoundation.org
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list