Sun Java System Web Server 6.1 SP12 NSAPI Programmer's Guide

Default Service Directive

There is usually a Service directive that does the default task (sends a file) if no other Service directive matches a request sent by a browser. This default directive should come last in the list of Service directives in the default object, to ensure it only gets called if no other Service directives have succeeded. The default Service directive is usually:


Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"

            

This directive matches requests whose method is GET, HEAD, or POST, which covers nearly virtually all requests sent by browsers. The value of the type argument uses special pattern-matching characters. For complete information about the special pattern-matching characters, seeChapter 9, Using Wildcard Patterns

The characters “*~” mean “anything that doesn’t match the following characters,” so the expression *~magnus-internal/ means “anything that doesn’t match magnus-internal/.” An asterisk by itself matches anything, so the whole expression *~magnus-internal/* matches anything that does not begin with magnus-internal/.

So if the server has not already executed a Service directive when it reaches this directive, it executes the directive so long as the request method is GET, HEAD or POST, and the value of the type attribute does not begin with magnus-internal/. The invoked function is send-file, which simply sends the contents of the requested file to the client.