up: HTTP     index Zimbu documentation

CLASS HTTP.Servlet @abstract @public

summary

     

Base class for all Servlets.

$setAllPaths(allPaths) @public  Set whether this Servlet handles all paths.
$addPath(path) @public  Add a path that this servlet will serve for.
$handle(context) bool @public  Check if this servlet wants to serve context.request.
$setMimeType(type) @public  Set the MIME type to be used in the response for this Servlet.
$serve(context) bool @public  Serve context.request, put the reply in context.response.
$filter(context) bool @public  Filter context.request, possibly changing context.
 
Known subclasses:
     
 

members (alphabetically)

     

PROC $addPath(string path) @public

     

Add a path that this servlet will serve for.

FUNC $filter(HTTP.Context context) bool @default @public

     

Filter context.request, possibly changing context.

Return TRUE when the request was filtered. In that case $serve() will not be evoked.

This is invoked from the handle() method.

Servlet implementations usually only need to implement this method or $serve().

FUNC $handle(HTTP.Context context) bool @public

     

Check if this servlet wants to serve context.request.

If so, put the result in context.response and return TRUE.

If not return FALSE.

It is also possible to change context and return FALSE, so that the Servlet functions as a filter.

FUNC $serve(HTTP.Context context) bool @default @public

     

Serve context.request, put the reply in context.response.

Return TRUE when the request was handled.

This is invoked from the handle() method.

Servlet implementations usually only need to implement this method or $filter().

PROC $setAllPaths(bool allPaths) @public

     

Set whether this Servlet handles all paths.

This overrules any paths set with $addPath().

PROC $setMimeType(string type) @public

     

Set the MIME type to be used in the response for this Servlet.

This is set after $serve() returns TRUE.

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0