[Web-SIG] middleware example

Terrel Shumway terrel at terrelshumway.com
Fri Nov 19 05:07:55 CET 2004


>
>
>Or maybe we need to find other middleware examples besides 
>authentication and session handling, which are the two things most often 
>"pre-decided" with many servers and almost any web programming framework 
>in any language (because they're such a pain). Maybe they are special 
>cases that need to be considered separately anyway?
>

This is a special case of authentication and sessions:

I have an app that runs in http://myserver.dom/
I have a shopping cart that needs to collect
payment information through a secure connection
https://secure.server.dom/cgi-bin/order

I want the payment page to match the look and feel
of the unsecured site, so I make the templates
available on the secure site. Now: How do I choose
which set of templates to use?

1. The merchant passes a cookie to the secure site
2. The middleware decodes the cookie and adds the
  appropriate merchant-specific directory to the
  template search path 

   e.g. env["cheetah.templatepath"].insert(0,merchantdir)

3. The application code is totally agnostic to
  the use of a different set of templates -- all it
  knows is that a new variable "whizcart.merchant"
  is added to the environment, and it doesn't care
  how it got there.




More information about the Web-SIG mailing list