Sample 26180: Terminating a Request Using SAS/IntrNet
The final example uses the INIT program to terminate a request based on some criteria. In a real example, such criteria might include:
- the user not being authorized for the requested program. Such requirements are revisited in Chapter 12.
- redirecting a request (using the Location header as discussed in Section 8.2.1.1) to a specific HTML page based on some criteria.
- terminating or redirecting a request because an expiration date might have passed (e.g., online registration is not available after a specified cut-off date).
- disabling an application because of maintenance or update requirements.
The simple example below demonstrates how a request can be rejected by including logic in the INIT program. The example disables the Hello World example that ships with SAS/IntrNet software.
- The Call Execute facility is invoked conditionally to execute macro calls and SAS statements when the condition is met. Call Execute is a convenient technique to execute small pieces of SAS code.
The logic is straightforward. If the program to be executed is the Hello World example, then the following actions occur:
- The externalHTML macro (discussed in Section 7.5) is invoked to generate the HTML that indicates that the requested program is not available.
- An ENDSAS statement is generated. The ENDSAS statement ends the Request Executive and not the Application Server itself (as discussed in Section 4.2). Thus, the ENDSAS statement generated in the INIT program prevents the requested program from running.
The conditional logic is specific to the Hello World example (i.e., the value for program is sample.webhello.sas). To demonstrate this capability, go to the sample environment located at http://hcsbi.com/IntrNetAppDev/ and select Chapter 9. Then select Terminating a Request (see Figure 9.5) to demonstrate this. In an actual implementation, the logic to determine whether a program is allowed can be metadata driven.
Note: Additional examples, including metadata-driven ones, that use the INIT and TERM programs, are included throughout the remainder of this book.
Figure 9.5 Terminating a Request
About the Author
Don Henderson is the Owner and Principal of Henderson Consulting Services, a SAS Affiliate Partner. Don has used SAS software since 1975, designing and developing business applications with a focus on data warehouse, business intelligence, and analytic applications. Don was one of the primary architects in the initial development and release of SAS/IntrNet software in 1996, and he was one of the original developers for the SAS/IntrNet Application Dispatcher. Don has presented numerous papers at SUGI and regional SAS user group meetings, and continues to be a great supporter of SAS and its products.
His book is available from the online bookstore.
This simple example demonstrates how a request can be rejected by including logic in the INIT program. The example disables the Hello World example that ships with SAS/IntrNet software.
| Type: | Sample |
| Topic: | Internal Administration ==> BBU
|
| Date Modified: | 2007-07-17 03:24:48 |
| Date Created: | 2007-07-17 03:24:48 |
Operating System and Release Information
| SAS System | SAS/IntrNet | All | 8 TS M0 | n/a |