[Seaside] WAResponse and XML

Jay Hardesty jayh at panix.com
Sat Aug 6 17:28:43 UTC 2011


Thanks Bob - 

I used your suggestion to revamp the Seaside application for my Second-Life-based client, as an example of subclassing WARequestHandler.
Following your example worked perfectly.  

Thanks again,
Jay


On Aug 5, 2011, at 3:55 PM, Bob N. wrote:

> We interface with an IVR system by answering VXML. I ended up subclassing WARequestHandler and implemented #handleFiltered: as indicated in the class comments.
> 
> Here is a simplified version of the method...
> handleFiltered: aRequestContext
> 	| response result request | 
> 	request := aRequestContext request.
> 	result := self processCall: request.
> 	response := aRequestContext response. 
> 	response 
> 		contentType: self contentType; 
> 		nextPutAll: result.
> 	aRequestContext respond.
> 
> ...where #processCall: answers a VXML string based on the request contents (using #aRequest>>at:ifPresent:)
> 
> That, plus a class initialize method...
> 	^WAAdmin register: self at: 'IVR'
> ...was all that was needed to get started. 
> 
> The same image also serves a full Seaside interface for the IVR application. 
> 
> Bob Nemec
> 
> 
> 
> On Wed, Aug 3, 2011 at 8:01 PM, Jay Hardesty <jayh at panix.com> wrote:
> 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
> 
> 
> _______________________________________________
> 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/20110806/661528b4/attachment.htm


More information about the seaside mailing list