Skip to main content
Version: 8.2411.x.x RR

DefaultServlet

The DefaultServlet implements the same request URI to filename mapping as the servlet container. There are two primary reasons to use the DefaultServlet:

  • You can map the DefaultServlet to / to ensure that servlet mapping is always activated and there is a filter chain.
  • The attribute NoMatchFile ensures that a file is always sent to the browser.

The example below clarifies these two items.

Security policy

For security reasons, never put a file containing secret information (like a secret key or some Lua code) into the directory configured as "<docBase>" in the navajo.xml file. This is because the DefaultFilter can easily access such a file. An exception is the WEB-INF directory inside the "<docBase>" directory. The WEB-INF directory is protected against the DefaultFilter and cannot be accessed.

If you plan to share the same file(s) between several instances, use the FileReaderServlet instead. That way it is possible to place files outside the instances directory and make them accessible to multiple instances.

Classname
ch::nevis::isiweb4::servlet::defaults::DefaultServlet
Library
libDefaultServlets.so.1

Configuration

EntryURI

Type: string
Usage Constraints: optional, must start with /

If no matching file is found and the path info of the request is empty, a redirect with the configured value is sent to the browser.

NoMatchFile

Type: string
Usage Constraints: optional, must start with /

If there is no matching file found, the file with the configured value will be sent.

NoMatchFile.StatusCode

Type: integer
Range: min: 100, max: 599
Usage Constraints: optional
Default: 200

Defines the HTTP status of the response, if no matching file is sent to the frontend.

StatusCode

Type: integer
Range: min: 100, max: 600
Usage Constraints: optional
Default: 200

Permits configuration of the HTTP status code of the response.

MappingType

Type: Enum
Possible Values: requestURI, pathinfo
Usage Constraints: optional
Default: requestURI

Enables mapping of request URIs to file names:

  • requestURI: Mapping plays no role
  • pathinfo: The file name is the pathinfo part of the requestURI

SupportIfModifiedSinceHeader

Type: boolean
Usage Constraints: optional
Default: false

If this flag is set, then the DefaultServlet can be further controlled by setting the If-Modified-Since header. This can be used for optimization. A document will only be served if it has been modified later than the time specified in the header. See RFC2616, section 14.25 for more details.