[Seaside] WAResponse and XML

Jay Hardesty jayh at panix.com
Thu Aug 4 00:01:46 UTC 2011


In fact I assume I really need to push this functionality down to the purely HTTP level.

Situation arose because I've been reusing my Seaside apps to serve data to other sorts of clients as well - overkill I guess since I'm not using any generated html in such cases 


On Aug 4, 2011, at 1:53 AM, Jay Hardesty wrote:

> Thank you for the response, James.   
> 
> For me, the problem is that I need the XML to be processed automatically (with no dialog).
> 
> Whereas my response from Seaside used to return XML - that is something starting with:
> 	<?xml version="1.0" encoding="UTF-8"?...  (because that's how my xmlString starts)
> 
> I instead now see something starting:
> 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ...
> 
> For instance the response returned from the code fragment in your response ultimately arrives as the same (html) result 
> 
> I should mention that this particular request is being sent to my Seaside app from a non-Seaside client; perhaps a Seaside app simply can't be used in such a way anymore(?)  
> 
> Thanks again,
> Jay
> 
> 
> On Aug 4, 2011, at 1:27 AM, James Foster wrote:
> 
>> Jay,
>> 
>> With the following code, clicking on a link will open a dialog asking what application to use to open the document or offering to save the document. This looks close to what you are doing. (I'm using Seaside 3.0.5 in GemStone/S.)
>> 
>> James
>> 
>> 	self requestContext respond: [:response |
>> 		| document |
>> 		document := myXmlString seasideMimeDocument
>> 			mimeType: (WAFileLibrary mimetypeFor: 'xml');
>> 			fileName: 'myNewFile.xml';
>> 			yourself.
>> 		response 
>> 			document: document;
>> 			doNotCache;
>> 			yourself.
>> 	].
>> 
>> On Aug 3, 2011, at 4:09 PM, Jay Hardesty wrote:
>> 
>>> 
>>> Hi - I'm having a problem returning XML as a response from within a Seaside app, after moving to 3.0.
>>> 
>>> I used to return XML by:
>>> 
>>> 	self session returnResponse: 
>>> 		(WAResponse new
>>> 			contentType: 'text/xml';
>>> 			nextPutAll: xmlString;
>>> 			yourself)
>>> 
>>> but t in Seaside 3.0 I get: 
>>> 	'You can no longer return a new WAResponse instance. You must instead modify the Response contained in the active RequestContext. Look for senders of #respond: and #response for examples.'
>>> 
>>> 
>>> Following the nearest examples I can find I tried:
>>> 
>>> 	self requestContext respond: [:response |
>>> 		| document |
>>> 		document := MIMEDocument 
>>> 			contentType: 'text/xml';
>>> 			content: xmlString.
>>> 		response document: document]
>>> 
>>> and:
>>> 
>>> 	self requestContext respond: [:response |
>>> 		response
>>> 			contentType: 'text/xml';
>>> 			nextPutAll: xmlString]
>>> 
>>> but in both cases an html document arrives downstream (with XML in the body) rather than the XML itself as previously
>>> 
>>> Think I'm missing something basic here... Thanks very much for any pointers,
>>> Jay
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> 
>> 
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110804/49cdf7b5/attachment-0001.htm


More information about the seaside mailing list