What Is ATL Server?


ATL Server is a set of extensions to the Active Template Library (ATL) included with Microsoft Visual Studio .NET. These extensions are provided to let you develop Web-based code using unmanaged C++. The ATL Server library is different from the original ATL because the new code in ATL Server has little to do with COM and instead concentrates on Web development.

The ATL Server library provides a lot of functionality and contains classes for:

  • Writing ISAPI extensions

  • Writing Web services

  • Writing filters and CGI servers

  • Handling cookie-based sessions

  • Caching session state in memory or to database tables

  • Working with sockets and HTTP

  • Working with SMTP

  • Writing SOAP clients and servers

  • Handling MIME types and encoding/decoding using various schemes, such as Base64

  • Formatting HTML

  • Monitoring performance

  • Working with files, memory-mapped files, and IStream-like access to files

  • Manipulating paths

  • Using crypto and security API wrappers

In addition, ATL Server offers many utility classes, including classes for image and date manipulation, and a number of new container classes, including red/ black trees, hashes, lists, and maps.

ATL Server is designed to be used with ASP.NET to provide parts of a Web application when performance is critical and when you need fine-grained control over areas such as threading and caching. However, you probably won’t need ATL Server in the majority of cases, in which normal ASP.NET applications and Web services offer enough performance.

There’s far too much in ATL Server to cover in this chapter, so I’ll
concentrate on how you can use ATL Server to build two types of projects:

  • ISAPI Web applications, in which fixed HTML content is modified by active content supplied by an ATL Server dynamic link library (DLL). These Web applications are ATL-based alternatives to ASP.NET Web-based applications.

  • XML Web services, in which clients can talk to ATL services using HTTP.

In the past, ISAPI programming has often been difficult and tedious. ATL Server was developed to make the task simpler and more intuitive, using minimalist classes built in the ATL style with support from wizards in the development environment. Visual C++ also supports ATL Server projects, including project deployment functionality and debugging support.

start sidebar
What Is ISAPI?

The Internet Server API (ISAPI) lets Microsoft Windows programmers write extensions to Microsoft Internet Information Services (IIS) to generate HTML pages dynamically. ISAPI extensions are implemented as DLLs that implement a set of entry points. When you request the DLL as part of a URL, IIS chooses a pooled thread, loads the DLL, and passes the extension information about the page request by calling these entry points. The extension code can then get access to data passed through POST, GET, or HTTP headers. IIS also passes the extension a function pointer that the extension can use to “write” the output page.

ISAPI is flexible, produces fast code, and is relatively easy to use. If your application is simple, ISAPI works well because all you need to do is read the data that is passed to the ISAPI extension, process it, and write a response back to the client. When applications get more complicated, ISAPI doesn’t offer much more functionality; for example, it has no database access, nor can it handle session information or cookies, or help with encryption or the generation of
e-mail messages. This means that complex ISAPI applications entail a lot of “housekeeping” programming on the part of the developer.

end sidebar

Coding with ATL Server

If you’ve coded with ATL, you’ll know that ATL is not for the faint-hearted. It demands a good level of familiarity with fairly advanced C++ template techniques as well as an in-depth knowledge of COM. Many C++ developers have put off using ATL for these reasons.

ATL Server takes a different approach and uses some of the new features introduced in Visual C++ .NET to make coding ATL simpler. Instead of having to deal with complex implementation details, you do most of the work in an ATL Server project using attributes. You add attributes to classes to mark them as ATL Server classes and to set properties for the classes. The compiler then processes the attributes at compile time and generates the required implementation code. This means that if you’re using Visual Studio .NET to write ATL Server applications, you’ll seldom see the sort of template code you’re used to in ATL.




Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
EAN: N/A
Year: 2003
Pages: 208

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