sunlabs.brazil.handler
Class NotFoundHandler
public
class
NotFoundHandler
extends Object
implements Handler
Handler for returning "file not found" errors back to the client.
Look for the file "NotFound.html" in the current directory, and return it
if it exists. Otherwise, return the "NotFound.html" file in the document
root directory. If neither can be found, then punt, and let someone else
deal with it.
If more sophisticated processing is desired, then the
{@link UrlMapperHandler}
may be used in combination with the
{@link sunlabs.brazil.template.TemplateHandler}.
Configuration parameters understood by this handler
- root
- The location of the document root for locating the
default "not found" file (also looks using prefix of "").
- prefix, suffix, glob, match
- Specify the URL that triggers this handler.
(See {@link MatchString}).
- fileName
- The name of the file to send for missing files.
Defaults to "notfound.html"
- type
- The file type, defaults to text/html
Version: 2.3, 06/11/13
Author: Stephen Uhler
Method Summary |
boolean | init(Server server, String prefix)
Extract the handler properties.
|
boolean | respond(Request request)
Look for and deliver the "not found" file
Look in the current directory first, then in the doc root.
|
public boolean init(
Server server, String prefix)
Extract the handler properties.
Get the URL prefix and default "missing" file name.
public boolean respond(
Request request)
Look for and deliver the "not found" file
Look in the current directory first, then in the doc root.
Only files whose suffixes have valid mime types are delivered.