If a Server Application Function results in an error, it sets the HTTP response status code and returns the value REQ_ABORTED. When this happens, the server stops processing the request. Instead, it searches for an Error directive matching the HTTP response status code or its associated reason phrase, and executes the directive’s function. If the server does not find a matching Error directive, it returns the response status code to the client.
The following Error-class functions are described in detail in this section:
error-j2ee handles errors that occur during execution of Java™ 2 Platform, Standard Edition (J2SE platform) applications and modules deployed to the Sun Java System Web Server.
match-browser matches specific strings in the User-Agent string supplied by the browser, and then modifies the behavior of Sun Java System Web Server based upon the results by setting values for specified variables.
qos-error returns an error page stating which quality of service limits caused the error and what the value of the QOS statistic was.
query-handler runs a CGI program instead of referencing the path requested.
remove-filter removes a filter from the filter stack.
send-error sends an HTML file to the client in place of a specific HTTP response status.
set-variable enables you to change server settings based upon conditional information in a request, and to manipulate variables in parameter blocks by using specific commands.
Applicable in Error-class directives.
The error-j2ee function handles errors that occur during execution of web applications deployed to the Sun Java System Web Server individually or as part of full J2SE applications.file name.
The following table describes parameters for the error-j2ee function.
Table 4–75 error-j2ee Parameters
Parameter |
Description |
---|---|
bucket |
(Optional) Common to all obj.conf functions. |
Applicable in all stage directives. The match-browser SAF matches specific strings in the User-Agent string supplied by the browser, and then modifies the behavior of Sun Java System Web Server based upon the results by setting values for specified variables. See match-browser.
Applicable in Error-class directives.
The qos-error function returns an error page stating which quality of service limits caused the error, and what the value of the QOS statistic was.
The code for this SAF is one of the examples in the Sun Java System Web Server 6.1 NSAPI Programmer’s Guide.
For more information, see the Sun Java System Web Server 6.1 SP10 Performance Tuning, Sizing, and Scaling Guide.
The following table describes parameters for the qos-error function.
Table 4–76 qos-error Parameters
Error fn=qos-error code=503 |
Applicable in Service- and Error-class directives.
This function is provided for backward compatibility only and is used mainly to support the obsolete ISINDEX tag. If possible, use an HTML form instead.
The query-handler function runs a CGI program instead of referencing the path requested.
The following table describes parameters for the query-handler function.
Table 4–77 query-handler Parameters
Error query=* fn=query-handler path=/http/cgi/do-grep Error query=* fn=query-handler path=/http/cgi/proc-info |
Applicable in Input-, Output-, Service-, and Error-class directives.
The remove-filter SAF is used to remove a filter from the filter stack. If the filter has been inserted multiple times, only the topmost instance is removed. In general, it is not necessary to remove filters with remove-filter, as they will be removed automatically at the end of the request.
Returns REQ_PROCEED if the specified filter was removed successfully, or REQ_NOACTION if the specified filter was not part of the filter stack. Any other return value indicates an error.
The following table describes parameters for the remove-filter function.
Table 4–78 remove-filter Parameters
Parameter |
Description |
---|---|
filter |
Specifies the name of the filter to remove. |
bucket |
(Optional) Common to all obj.conf functions. |
Error fn="remove-filter" filter="http-compression" |
Applicable in Error-class directives.
The send-error function sends an HTML file to the client in place of a specific HTTP response status. This allows the server to present a friendly message describing the problem. The HTML page may contain images and links to the server’s home page or other pages.
The following table describes parameters for the send-error function.
Table 4–79 send-error Parameters
Error fn=send-error code=401 path=/sun/server61/docs/errors/401.html
Applicable in all stage directives. The set-variable SAF sets the HTTP status code and aborts the request by returning REQ_ABORTED. To set the HTTP status code without aborting the request, use the error parameter in conjunction with the noaction parameter.
To rewrite a HTTP status code, use a <Client> tag to match the original status code and an Output directive to set the new status code. The following example would rewrite all 302 Moved Temporarily responses to 301 Moved Permanently responses
<Client code="302"> Output fn="set-variable" error="301 Moved Permanently" noaction="true" </Client>