Frontier Tutorials / Writing an ObjectNotFoundHandler

Writing an ObjectNotFoundHandler

Tutorial Contents
Writing an ObjectNotFoundHandler
ONFH Overview
ONFH Modes of Operation
About The Examples
Mode 1 Example
Mode 2 Example
Mode 3 Example
Mixing Modes
Misdirected URLs
ONFH Summary
ONFH Applications
ONFH Resources
Bonus: The "Penultimate" Master Script
Bonus: Mode 3 Utility Script
About the Author

You want to add new capabilities to your MainResponder dynamic website. For example, you want to be able to respond to requests for JavaScript source files (xxx.js) or some other type of data that MainResponder doesn't understand, and that doesn't readily fit into the website hierarchy. Or perhaps you want to serve up a large amount of data as individual pages, but you don't particularly want to create separate entries for all the data. Or perhaps you simply want to redirect unrecognized URLs to a "File-not-found" page with a search form.

In a site served via Frontier's MainResponder dynamic website framework, you can do any or all of the above. You create a single entry called an objectNotFoundHandler; it can return any data you like in response to any URL within your website.

Why Do You Need It?

You've seen the default result of requesting an unknown URL from a MainResponder site:

Sorry! There was an error: Can't process the request because there is no object named "x".

Wouldn't you rather see:

404withsearch picture

What You'll Learn

By the end of this tutorial, you will be able to create an ObjectNotFound handler to return anything you want in response to a request for an unknown URL, including a more user-friendly Page-Not-Found page like the example above.

This tutorial is intended for experienced Frontier scripters. It requires familiarity with Frontier's UserTalk scripting language and with the MainResponder dynamic website framework.

Before You Start

Before continuing this tutorial, you should read and be familiar with the following mainResponder articles from Dr. Matt:

Let's look at an overview of an objectNotFoundHandler.

Author: Samuel Reynolds
Email: sam@spinwardstars.com
First Published: 2000/01/19
Last Revision: 2002/07/29
Keywords: tutorial, mainResponder, 404, 404-NOT FOUND, objectNotFoundHandler
Level of Difficulty: Moderate

Tutorial Contents
Writing an ObjectNotFoundHandler
ONFH Overview
ONFH Modes of Operation
About The Examples
Mode 1 Example
Mode 2 Example
Mode 3 Example
Mixing Modes
Misdirected URLs
ONFH Summary
ONFH Applications
ONFH Resources
Bonus: The "Penultimate" Master Script
Bonus: Mode 3 Utility Script
About the Author