Re: SSIResource and PostableResource

> In 1.0alpha3 I noticed the new SSIResource which indeed seems a good
> alternative to hard coding HTML in a java class.
> 
> Now I am wondering how to combine the Postable and SSI resources to 
> basically get SSI with parameters coming from an HTML form. 
> 
> Does it make sense ? Any suggestion on how to do that ?

Yes, it makes a lot of sense, and is possible, though I think not
documented.

Since SSIResource is not currently a subclass of PostableResource (and
I'm not sure how that could be accomplished in a very straightforward
way), you can only get data from a form by the following somewhat
hackish procedure.

The DefaultCommandRegistry initializes an SSI variable called formData
whenever that it detects that a query or it detects a POST method
with an appropriate content type. formData is an URLDecoder.

So one of the commands you define could do this:

Reply execute(....., Dictionary variables, ...) {

    URLDecoder formData = (URLDecoder) variables.get("formData") ;

    if(formData != null) {
        // This means there is form data to use
    } else {
        // This means there isn't
    }

}

Does this make sense?

I have to admit that this "feature" was a sort of midnight hack and is
not thoroughly tested (initially it didn't cross my mind that poeple
would want to use the POST method on SSIResources...). If you have any
problems with it, let me know and I'll fix it.

Also, maybe this mechanism doesn't suit your needs at all.  In that
case, please tell me what you need to do and I'll try to incorporate
that into the SSIResource.

Antonio.

--
======================================================================
Antonio Ramirez / 450 Memorial Dr. / Cambridge, MA 02139
anto@mit.edu, anto@w3.org

Received on Friday, 18 October 1996 23:58:36 UTC