[Seaside] Re: HTTP Post

Yanni Chiu yanni at rogers.com
Wed Jun 22 06:57:55 CEST 2005


Daniel Salama wrote:
> 
> I asked a question a while ago about how to go to a Seaside URL and
> pass arguments in the URL as URL parameters. The answer was to "play"
> with #start and #updateURL. Now, I need to expand on this issue. I
> have a need to POST a form from an external application into a
> Seaside application. The reason being is that the size of the
> information and the type of information to be posted is too
> cumbersome to do so using GET. So, the question now is how can I do
> that in Seaside? How can I post to a Seaside app since, from my
> understanding, Seaside forms post to a callback and not to a
> particular URL, as in conventional non-Seaside apps?

I answered a very similar question just a few days
ago on comp.lang.smalltalk. Here's a slight variation
for POST instead of GET.

Subclass WARenderLoopMain and override the #start: method.
I've included the source for the subclass below.
You'll also need to configure your component to use the
new subclass. Also, I added a #count: setter method to WACounter.

Use a browser to view the html file included below.
You may need to change the POST action. What should
happen is that the sample counter app. will be intialized
with the count value you submit from the form.

--yanni

====
<html>
<head></head>
<body>
<form method="post" action="http://localhost:9090/seaside/counter">
    Initial Count:
    <input name="count" value="" type="text" />
    <input value="Submit" type="submit" />
</form>
</body>

====
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 17 June
2005 at 12:19:18 pm'!
WARenderLoopMain subclass: #WARenderLoopCounterMain
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Sandbox'!

!WARenderLoopCounterMain methodsFor: 'as yet unclassified' stamp: 'yj
6/17/2005 12:15'!
start: aRequest
        | root |

        root := self createRoot.
        root count: (aRequest at: 'count' ifAbsent: [99]).
        (WARenderLoop new root: root) run! !



More information about the Seaside mailing list