[Seaside] Rendering Component in a WAPragmaBasedRestfulHandler

Camillo Bruni camillo.bruni at inria.fr
Wed Apr 13 16:21:30 UTC 2011


On 2011-04-13, at 18:10, Tobias Pape wrote:

> 
> Am 2011-04-13 um 17:38 schrieb Camillo Bruni:
> 
>> Hi,
>> 
>> I am onto building test website in seaside which should have nice urls. I stumbled upon the Seaside-REST package, which seems like a nice solution to map the urls onto state and components.
>> 
>> However so far I could not figure out how I should render a component from within a WAPragmaBasedRestfulHandler method.
>> 
>> This is how I imagine it should work: 
>> request -> stateful request handler -> choose component and initialize state -> render component
>> 
>> What is the proper way to do this?
> 
> Think of this:
> 
> MyFilter>>#listingOfProject: projectName
> 	<GET>
> 	<Path: '/{projectName}'>
> 	MyComponent new respondRendered
> 
> with 
> 
> MyComponent>>#respondRendered
> 	self requestContext respond: [:response |
> 		response
> 			contentType: WAMimeType textHtml;
> 			nextPutAll: (	WARenderCanvas builder
> 				fullDocument: true;
> 				rootBlock: [ :root | 
> 					self updateRoot:root ];
> 				render: [ :canvas |
> 					self renderContentOn: canvas ])].
> 
> This merely emulates a normal seaside run.
> But more elaborate versions are possible.

Thanks, this is what I was looking for.

camillo

> 
> So Long,
> 	-Tobias_______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list