[Seaside] Rendering Component in a WAPragmaBasedRestfulHandler

Julian Fitzell jfitzell at gmail.com
Wed Apr 13 18:16:42 UTC 2011


Oh I see... you're trying to define nice URL entry points that take
the user into full sessions/applications? I'm not sure if that's quite
what Philippe had in mind with Seaside-REST (though he may correct me
on that).

I think I can begin to imagine how something like that might look. But
perhaps you could give a high-level description of the various pieces
you imagine and how they interact with and link to each other... in
other words, what "dispatch logic" do you want to specify?

Julian

On Wed, Apr 13, 2011 at 5:36 PM, Camillo Bruni <camillo.bruni at inria.fr> wrote:
> Well I think its currently quite hard to do a nice transition from a normal seaside application using the default, non-readable url to an application with nice urls.
>
> Since extracting the state from the URL is pretty straight forward, though much nicer with the pragma-based approach in REST. However, since I come from the Django world, I expect some simple dispatch logic to map from the URLs to the existing components.
>
> But lets try and figure out if it will work ;)
>
> camillo
>
>
> On 2011-04-13, at 18:28, Julian Fitzell wrote:
>
>> Unless, you're re-using some of the rendering code in multiple places,
>> you might find it cleaner to simply subclass
>> WAPragmaBasedRestfulHandler to provide a renderer. It could even be
>> implemented with an additional pragma instead of hardcoding:
>>
>> MyFilter>>#listingOfProject: projectName on: html
>>       <GET>
>>       <Path: '/{projectName}'>
>>       <Renderer: #WARenderCanvas>
>>       "Or, alternatively just: <Canvas>"
>>
>>       html text: 'hello world'
>>
>> You could of course then "html render: anObject", though I'd suggest
>> that you don't really want to use components here, because you have no
>> session and thus no state for them to maintain. You would probably be
>> better to subclass WAPainter if you want to re-use some rendering code
>> in several places.
>>
>> Julian
>>
>> On Wed, Apr 13, 2011 at 5:10 PM, Tobias Pape <Das.Linux at gmx.de> 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.
>>>
>>> So Long,
>>>        -Tobias_______________________________________________
>>> 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
>


More information about the seaside mailing list