Chapter 3: Request Handlers


Overview

WITH SRF FILES, YOU HAVE the first half of the solution for creating complete a Web application (the HTML UI, design, and layout or front-end aspects). Request handlers are the part of ATL Server that completes the solution. They re classes that provide the back-end for your HTML front-end. They re where your application processing and logic reside. You should be familiar with the material presented in Chapter 2 before you read this chapter.

Like SRF files, request handlers are designed to be lightweight, powerful, efficient, extensible, and flexible. But what exactly is a request handler? A request handler is simply a class in your application that implements the IRequestHandler interface (or, more commonly, a class that derives from CRequestHandlerT or IRequestHandlerImpl ) and is exposed via a handler map.

The handler map is simply a mapping between text strings and the name of a class. Because all HTML requests are text, ATL Server requires a way to convert a text string into a request for a specific class (i.e., the class that will handle this request or request handler). You can easily see the mapping in a simple example:

 {{handler MyHandler.dll/Default}} 

You need a way to get the string Default to map to an actual class in your request handler (which resides in MyHandler.dll). You can do this by using the appropriate macros as follows :

 BEGIN_HANDLER_MAP()    HANDLER_ENTRY("Default", CMyHandler)  END_HANDLER_MAP() 

In this case, you see that the CMyHandler class will handle requests for this page. Thus, CMyHandler is the request handler for the given page.

Request handlers aren t limited to use via SRF files, however. Request handlers can be accessed directly via HTTP (by default), as is seen with ATL Server Web services.




ATL Server. High Performance C++ on. NET
Observing the User Experience: A Practitioners Guide to User Research
ISBN: B006Z372QQ
EAN: 2147483647
Year: 2002
Pages: 181

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