[Seaside] Seaside text/plain output problems
David Goehrig
dave at nexttolast.com
Sat Jun 2 00:13:00 UTC 2007
Hi everybody!
I'm working on a project using Seaside for the first time, and for
various reasons it needs to output Content-Type: "text/plain"
documents. So having no idea, how Seaside's internals work I started
sticking in random 'self break' statements, until I found a place that
the Content-Type was set. What I did so far was:
WAHtmlRoot<<contentType
^ mimeType ifNil: ['text/html'] ifNotNil: [mimeType]
WAHtmlRoot<<mimeType
^ mimeType
WAHtmlRoot<<mimeType: aString
^ mimeType := aString
This at least allows me to change what was previously a hardcoded
content type, but it wasn't enough to allow access from the viewer as I
couldn't find an obvious way to access the response object through the
html one so:
WAHtmlDocument<<response
^response
WAHtmlDocument<<response: aResponse
^response := aResponse
WARender<<buildResponse
| response document |
self updateUrl: url.
context actionUrl: url.
response := self newResponse.
response headerAt: 'Cache-Control' put: 'No-cache'.
document := self session outputDocumentClass root: self buildDocRoot.
document stream: response stream.
* document response: response.*
context document: document.
root decorationChainDo: [:ea | ea renderWithContext: context].
self writeOnLoadOn: document.
document close.
^ response
At this point I could now alter the response within my View class:
TestView<<renderContentOn: html
html context document response contentType: 'text/plain'.
html text: 'Testing 1 2 3'
Generates a page of type 'text/plain' but the page is just the
javascript load preamble:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
lang="en" xml:lang="en"
xmlns="http://www.w3.org/1999/xhtml"><head><title>Seaside</title><meta
content="text/html; charset=utf-8" http-equiv="Content-Type" /><link
type="text/css" href="/seaside/files/WAStandardFiles/basics.css"
rel="stylesheet" /><link type="text/css"
href="/seaside/files/WAStandardFiles/kalseyTabs.css" rel="stylesheet"
/><link type="text/css"
href="/seaside/files/WAStandardFiles/sourceStyle.css" rel="stylesheet"
/><script type="text/javascript"
src="/seaside/files/WAStandardFiles/externalAnchors.js"></script><script
type="text/javascript"
src="/seaside/files/WAStandardFiles/misc.js"></script><script
type="text/javascript"
src="/seaside/files/WAStandardFiles/shortcuts.js"></script><link
type="text/css" href="/seaside/Test?_s=UbxOBKHRLUulbtSV"
rel="stylesheet" /></head><body onkeydown="onKeyDown(event)"
onload="onLoad()"><div id="frameContent">testing 1 2
3</div><div> </div><p></p><div id="toolbar"><a
href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&1">New
Session</a> <a
href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&2">Configure</a> <a
href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&3">Toggle
Halos</a> <a href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&4">Spot
Profiler</a> <a
href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&5">Memory</a> <a
href="?_k=zekhIJre&_s=VkiqJeuwtxwWVIAM&6">Profiler</a> <a
href="http://localhost:3900/seaside/Test?terminate=1&_s=VkiqJeuwtxwWVIAM&_k=zekhIJre">Terminate</a> <a
title="Validate XHTML"
href="http://validator.w3.org/check/referer">XHTML</a> <span
title="Render Time">0</span>/<span title="Callback Time">0</span>
ms</div><script type="text/javascript">/*<![CDATA[*/function
onLoad(){}/*]]>*/</script></body></html>
So my question is how do I override this!
I noticed that I can override the response stream in my View object, but
there's a continuation which gets called which will overwrite whatever I
put in the stream. Am I going about this totally the wrong way?
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070601/8d2fb508/attachment-0001.htm
More information about the Seaside
mailing list