[Seaside] HTTP Post

David Shaffer cdshaffer at acm.org
Wed Jun 22 13:56:51 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?
>
> Hope I was clear in my question.
>
> Thanks,
> Daniel
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside

Is the POST the first interaction your external application is going to
have with the application?  If so then Yanni's reply is appropriate.  If
not then consider that it is no big deal to pull down the form generated
by Seaside, pull out the hidden _s and _k variable (session and
continuation tags) and then submit the POST including those variables. 
Then your external app acts just like a user (remember to deal with
Seaside's redirects).  Since Seaside generates XHTML any language with
an XML parser will work and it doesn't have to be complicated.  If you
have a SAX-based parser (like Java and many Smalltalks) you can easily
write a handler than finds the appropriate elements in a few lines of
code.  Well, I guess if it were too easy I'd be providing code examples ;-)

Another thing to think about...does your external agent really need to
interact with Seaside, per se?  I find Comanche modules (basically
"Servlets") quicker to write for applications that _only_ deal with
automated agents.  The control flow is much more constrained than an
interactive app.  You can have the same Squeak/Comanche server serving
out Seaside and non-Seaside applications.  They can even share most of
their code.  There are examples of Comanche modules all over your image
(look for implementers of processHttp).  Learning to configure Comanche
and be a bit of a headache but once you've got it it seems quite simple
:-)  I can provide a more complex example that elaborates on this if
you're interested.

David



More information about the Seaside mailing list