Sun Java System Web Server 6.1 SP9 Administrator's Configuration File Reference

Error

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

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.

Parameters

The following table describes parameters for the error-j2ee function.

Table 4–74 error-j2ee Parameters

Parameter  

Description  

bucket

(Optional) Common to all obj.conf functions.

See Also

ntrans-j2ee, service-j2ee

match-browser

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.

qos-error

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 SP9 Performance Tuning, Sizing, and Scaling Guide.

Parameters

The following table describes parameters for the qos-error function.

Table 4–75 qos-error Parameters

Parameter  

Description  

code

(Optional) Three-digit number representing the HTTP response status code, such as 401 or 407. The recommended value is 503.

This can be any HTTP response status code or reason phrase according to the HTTP specification. 

The following is a list of common HTTP response status codes and reason strings:

  • 401 Unauthorized

  • 403 Forbidden

  • 404 Not Found

  • 500 Server Error

bucket

(Optional) Common to all obj.conf functions.

Example


Error fn=qos-error code=503

         

See Also

qos-handler

query-handler

Applicable in Service- and Error-class directives.


Note –

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.

Parameters

The following table describes parameters for the query-handler function.

Table 4–76 query-handler Parameters

Parameter  

Description  

path

Full path and file name of the CGI program to run. 

reason

(Optional) Text of one of the reason strings (such as “Unauthorized” or “Forbidden”). The string is not case-sensitive. 

code

(Optional) Three-digit number representing the HTTP response status code, such as 401 or 407.

This can be any HTTP response status code or reason phrase according to the HTTP specification. 

The following is a list of common HTTP response status codes and reason strings:

  • 401 Unauthorized

  • 403 Forbidden

  • 404 Not Found

  • 500 Server Error

bucket

(Optional) Common to all obj.conf functions.

Examples


Error query=* fn=query-handler path=/http/cgi/do-grep
Error query=* fn=query-handler path=/http/cgi/proc-info

         

remove-filter

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

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.

Parameters

The following table describes parameters for the remove-filter function.

Table 4–77 remove-filter Parameters

Parameter  

Description  

filter

Specifies the name of the filter to remove. 

bucket

(Optional) Common to all obj.conf functions.

Example


Error fn="remove-filter" filter="http-compression"

         

send-error

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.

Parameters

The following table describes parameters for the send-error function.

Table 4–78 send-error Parameters

Parameter  

Description  

path

Specifies the full file system path of an HTML file to send to the client. The file is sent as text/html regardless of its name or actual type. If the file does not exist, the server sends a simple default error page.

reason

(Optional) Text of one of the reason strings (such as “Unauthorized” or “Forbidden”). The string is not case-sensitive. 

code

(Optional) Three-digit number representing the HTTP response status code, such as 401 or 407.

This can be any HTTP response status code or reason phrase according to the HTTP specification. 

The following is a list of common HTTP response status codes and reason strings:

  • 401 Unauthorized

  • 403 Forbidden

  • 404 Not Found

  • 500 Server Error

bucket

(Optional) Common to all obj.conf functions.

Example

Error fn=send-error code=401 path=/sun/server61/docs/errors/401.html

         

set-variable

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

Example

<Client code="302">
Output fn="set-variable" error="301 Moved Permanently" noaction="true"
</Client>