WAHtmlRoot>>writeHeadOn: broken when there is no request

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WAHtmlRoot>>writeHeadOn: broken when there is no request

Boris Popov, DeepCove Labs (SNN)
[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

[hidden email]

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
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WAHtmlRoot>>writeHeadOn: broken when there is no request

Philippe Marschall
2008/6/19, Boris Popov <[hidden email]>:
> [I'm not sure if this is VisualWorks specific, but here goes anyway]
>
>  The fix to avoid writing extra head elements for Ajax requests

Where is this fix coming from? What version of Seaside do you run? It
is not in my code base.

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

http://code.google.com/p/seaside/issues/list?ts=1213894023&thanks=77

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WAHtmlRoot>>writeHeadOn: broken when there is no request

Lukas Renggli
In reply to this post by Boris Popov, DeepCove Labs (SNN)
I replayed this:

---------- Forwarded message ----------
From: Lukas Renggli <[hidden email]>
Date: Jun 18, 2008 6:25 PM
Subject: Re: [vwnc] [Seaside] WAHtmlRoot>>writeHeadOn: broken when
there is no request
To: Boris Popov <[hidden email]>


> 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
 >
 >  [hidden email]
 >
 >  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
 >  [hidden email]
 >  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 <[hidden email]> 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
>
>  [hidden email]
>
>  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
>  [hidden email]
>  http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  _______________________________________________
>  seaside mailing list
>  [hidden email]
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside