[Seaside] Rendering Component in a WAPragmaBasedRestfulHandler

Tobias Pape Das.Linux at gmx.de
Wed Apr 13 16:10:24 UTC 2011


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.

So Long,
	-Tobias


More information about the seaside mailing list