About Sessions

 <  Day Day Up  >  

If you've read Chapter 21, "Instant Web Publishing," you've already read some discussion of the concept of sessions . To recap briefly : The connection between a Web browser and the Web Publishing Engine is very much unlike the connection between a client copy of FileMaker and the FileMaker Server. FileMaker Server can at any time reach out and "push" data to any connected client. It knows at all times what its connected clients are, where they are in the system, and at what network address they can be found. A Web server, by contrast, retains no memory of a client from one connection to the next .

This is not a good thing for database work! I need my Web site to remember the contents of my shopping cart as I shop around the site. This is possible only with session management . Session management is generally a middleware feature. Web programming languages such as PHP and JSP offer the programmer different means of managing sessions. In general, under session management, each incoming Web request is associated with a key of some kind. The key may be passed in the URL (if you've ever seen a long ugly string like ?jsession=A9238Ajasdj9mAEd in a Web URL, odds are you're looking at a session key), or it may be passed behind the scenes in an HTTP cookie. (FileMaker's Custom Web Publishing session implementation lets you choose between these two methods .)

Whatever the means, the middleware on the Web server has a way of associating that key to other information about the client. In the shopping cart example, the key might hook up to a database record that stores the actual contents of your cart as you navigate around the site.

FileMaker's Custom Web Publishing, like other middleware solutions, enables you to manage sessions for your users behind the scenes. You would use this capability any time you wanted to store important information about the user that would be carried from screen to screen. An experienced HTML programmer could get away with passing a lot of data from page to page via the URL, or via an HTML form. But there are limits to the amount of data than can be passed by URL, and there are limits to the type of data that can be passed by either method ”generally just plain text strings.

FileMaker's session implementation is quite elegant because it allows you to pass around XML fragments behind the scenes. This allows for much richer data structures than you could pass with regular HTML.

In addition to passing around XML information by means of sessions, FileMaker's session implementation allows you to keep track of the state of the FileMaker client session as well. This is the distinction described previously in the "Setting Up the Server-side Components for CWP" section: The XSLT configuration screen allows you to enable or disable database sessions. Database sessions are an additional capability on top of regular session management. In addition to "sessionizing" user information of your choice, they enable you to also keep track of FileMaker-specific information such as global fields or the current "script state."

So, for example, if your stylesheets modify a global field, and you have database sessions enabled, the global field retains its new value, for the specific current user, as that user navigates from page to page. Or, if you used a script to change some aspect of the user's state (for example, by using the Relogin script step to change the user's privileges), this state is maintained across sequential requests .

Session management is a large topic and we don't have space to do it justice . The FileMaker documentation helps you get a better grip on the specific functions and commands that Custom Web Publishing uses for session management. As for the issue of whether to configure the Custom Web Publishing to use database sessions, your decision will depend on how you construct your XSLT-CWP solution. If you intend to make heavy use of global variables , or call scripts from your stylesheets that would change the state of a user's privileges, you should configure the Web Publishing Engine to enable database sessions.

 <  Day Day Up  >  


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net