[Seaside] WAResponse and XML

James Foster Smalltalk at JGFoster.net
Wed Aug 3 23:27:19 UTC 2011


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
> 



More information about the seaside mailing list