HttpHandler

The qbo.Application.HttpHandler serves as the base class for most QBO3 .ashx file. It provides late binding between URL requests and class operations, including methods, statements, and IService connectors. It's main method, ProcessRequest, serves as a wrapper around calls to the application tier, and provide some generic functionality:
  • Track execution time of the request, and emits an HTTP header so one may measure the time the server spent processing a request 
  • Traces performance, logging to a performance log if a listener is configured
  • Queues operations
  • Handles errors

Error Handling

When an error is encountered in HttpHandler, the RaiseError method is called. This error handler will:
  • Serialize the error as XML, and 
  • Transform the error against Properties.Settings.Default.HttpErrorTransform (which by default is Templates/Application/Error.Detailed.xslt)
Error messages can be customized in two ways:
  1. From Design > Configuration > Modules > Business Rule > Settings, edit the Http Error Transform setting to point to a custom XSLT
  2. Modify the error handling XSLT to transform errors any way you want
For example, the standard Error.Details.xslt includes a HeaderMessage template with an xsl:choose statement that checks for specific expressions in the serialized error xml, and displays an appropriate message:
  • 'statement conflicted with the REFERENCE constraint' translated to 'Other records depend on this record; it cannot be deleted.'
  • 'Cannot insert the value NULL into column' translates to 'You are missing required fields.'
The easiest way to extend error handling is to simply override the standard Error.Detailed.xslt's xsl:choose statement.

Comments