Java Web App Context
Table of Contents
URI | Location | Servlet Engine | Enable Expires | Expires Default | Expires By Type | Extra Headers | Auto Index | Index Files | Allow Override | Realm | Authentication Name | Require (Authorized Users/Groups) | Access Allowed | Access Denied | Authorizer | Add Default Charset | Customized Default Charset | Cache Stale Age (seconds) | Publicly Cache All | Cache Expire Time (seconds) | Privately Cache All | Private Cache Expire Time (seconds) | Enable GeoLocation Lookup | Enable PageSpeed Optimization | PageSpeed Settings
Java Web App Context⇑
Description
Many people running Java applications use the servlet engine to serve static content as well. But no servlet engine is nearly as efficient as LiteSpeed Web Server for these processes. In order to improve the overall performance, LiteSpeed Web Server can be configured as a gateway server, which serves static content and forwards dynamic Java page requests to the servlet engine.
LiteSpeed Web Server requires certain contexts to be defined in order to run a Java application. A Java Web App Context automatically creates all required contexts based on the Java web application's configuration file (WEB-INF/web.xml).
There are a few points you need to keep in mind when setting up a Java Web App Context:
- A Servlet Engine external application must be set up in External Application before Java Web App Context can be set up.
- A Script Handler for .jsp files should be defined as well.
- If the web application is packed into a .war file, the .war file must be expanded. The server cannot access compressed archive files.
- For the same resources, the same URL should be used no matter whether it is accessed through LiteSpeed Web Server or through the servlet engine's built-in HTTP server.
For example, Tomcat 4.1 is installed under /opt/tomcat. Files for the "examples" web application are located at /opt/tomcat/webapps/examples/. Through Tomcat's built-in HTTP server, the "examples" web application is thus accessed with a URI like "/examples/***". The corresponding Java Web App Context should thus be configured: URI = /examples/, Location = /opt/tomcat/webapps/examples/.
URI⇑
Description
Specifies the URI for this context. The URI should start with a "/". If a URI ends with a "/", then this context will include all sub-URIs under this URI.
Syntax
URI
Location⇑
Description
Specifies the directory that contains the files for this web application. This is the directory containing "WEB-INF/web.xml".
Syntax
path
Servlet Engine⇑
Description
Specifies the name of the servlet engine that serves this web application. Servlet engines must be defined in the External Application section at the server or virtual host level.
Syntax
Select from drop down list
Enable Expires⇑
Description
Specifies whether to generate an Expires header for static files. If enabled, an Expires header will be generated based on Expires Default and Expires By Type.
This can be set at server, virtual host and context level. Lower level settings will override higher level ones, i.e. context settings will override virtual host settings and virtual host settings will override server settings.
Syntax
Select from radio box
Expires Default⇑
Description
Specifies default settings for Expires header generation. This setting takes effect when Enable Expires is set to "Yes". It can be overridden by Expires By Type. Do not set this default at the server or virtual host level unless you have to, since it will generate Expires headers for all pages. Most of time this should be set at the context level for certain directories that do not change often. If there is no default setting, no Expires header will be generated for types not specified in Expires By Type.
Syntax
A|Mseconds
The file will expire after base time(A|M) plus specified seconds. Base time "A" sets the value to the client's access time and "M" to the file's last modified time.
Expires By Type⇑
Description
Specifies Expires header settings for individual MIME types.
Syntax
Comma delimited list of "MIME-type=A|Mseconds". The file will expire after base time (A|M) plus specified seconds.
Base time "A" sets the value to the client's access time and "M" to the file's last modified time. MIME-type accepts wildcard "*", like image/*.
Extra Headers⇑
Description
Specifies extra response headers to be added. Multiple headers can be added, one header per line. Put "NONE" to disable headers inherited from parent content.
Syntax
"[HeaderName]: [HeaderValue]" in each line.
Example
My-header: Custom header value
Auto Index⇑
Description
Specifies whether to generate a directory index on the fly when index files listed in Index Files are not available in a directory. This option is customizable at the virtual host and context level, and is inherited along the directory tree until it is explicitly overridden. You can customize the generated index page. Please check online wiki How-tos.
Syntax
Select from radio box
Tips
It is recommended to turn off Auto Index wherever possible to prevent revealing confidential data.
See Also
Index Files⇑
Description
Specifies names of index files that will be searched sequentially when a URL is mapped to a directory. You can customize it at the server, virtual host, and context level.
Syntax
Comma-delimited list of index filenames.
Tips
Only set index files that you need.
Allow Override⇑
Description
Specifies what directives in an access control file are allowed. An access control file can be placed in a directory to control the accessibility of files under that directory.
- When nothing is checked, inherited default settings will be used.
- When None is checked, access control files will be ignored.
- When Limit is checked, directives "Order", "Allow from" and "Deny from" are allowed.
- When Auth is checked, directives "AuthGroupFile", "AuthName", "AuthType", "AuthUserFile", and "Require" are allowed.
- When FileInfo is checked, directives "Satisfy", "AddDefaultCharset", "AddType", "DefaultType", "ForceType", "ExpiresActive", "ExpiresDefault", "ExpiresByType", "Redirect", "RedirectTemp", "RedirectPermanent", "RewriteEngine", "RewriteOptions", "RewriteBase", "RewriteCond" and "RewriteRule" are allowed
- When Indexes is checked, directive "DirectoryIndex" is allowed
- When Options is checked, directive "Options" is allowed
Allow Override configuration is available at three levels: server, virtual host and context. If a configuration is not checked at the server level, the controlled directives will be disabled for the whole server whether or not it is enabled at lower levels. If something is enabled at the server level, virtual hosts will inherit same settings by default. Similarly context level settings will be inherited from virtual host settings. Lower levels can disable a setting that is enabled at an upper level, but cannot enable a setting that is disabled at an upper level.
Syntax
Select from checkbox
Tips
If there is no need for directory level configuration customization, check None.
Realm⇑
Description
Specifies the authorization realm for this context. When specified, a valid username and password must be provided in order to access this context. Authorization Realms are set up in the Virtual Host Security section. This setting uses each realm's Realm Name.
Syntax
Select from drop down list
Authentication Name⇑
Description
Specifies an alternative name for the authorization realm for the current context. If not specified, the original realm name will be used. The authentication name is displayed on the browser's login pop-up.
Require (Authorized Users/Groups)⇑
Description
Specifies which user/group can access this context. This allows you to use one user/group database (specified in Realm) across a number of contexts, but only allow certain users/groups from that database to access this context.
Syntax
Syntax is compatible with Apache's Require directive. For example:
- user username [username ...]
Only listed users can access this context. - group groupid [groupid ...]
Only users belonging to the listed groups can access this context.
Access Allowed⇑
Description
Specifies which IPs or sub-networks are allowed to access resources under this context. Together with Access Denied and server/virtual host level access control, accessibility is determined by the smallest scope that a client's IP address falls into.
Syntax
Comma-delimited list of IPs/sub-networks.
Example
Access Denied⇑
Description
Specifies which IPs or sub-networks are NOT allowed to access resources under this context. Together with Access Allowed and server/virtual host-level access control, accessibility is determined by the smallest scope that a client's IP address falls into.
Syntax
Comma-delimited list of IPs/sub-networks.
Example
Authorizer⇑
Description
Specifies an external application that can be used to generate authorized/unauthorized decisions. Currently, only the FastCGI Authorizer is available. For more details about the FastCGI Authorizer role, please visit http://www.fastcgi.com.
Syntax
Select from drop down list
Add Default Charset⇑
Description
Specifies whether to add a character set tag to the "Content-Type" response header, when content type is either "text/html" or "text/plain" without any parameters. When set to Off, this function is disabled. When set to On, either the character set specified by Customized Default Charset or the default "iso-8859-1" will be added.
Syntax
Select from radio box
Customized Default Charset⇑
Description
Specifies a character set to be used when Add Default Charset is On. This is optional. The default value is iso-8859-1. This entry has no effect when Add Default Charset is Off.
Syntax
Name of a character set.
Example
Cache Stale Age (seconds)⇑
Description
Specifies how long an object will continue to be served from cache after it has expired but before a new cached copy is available. The default is "10" seconds.
Syntax
Integer number
Publicly Cache All⇑
Description
Publicly cache all URLs served under the current context (server, virtual host, or context level).
Virtual hosts configured through Apache's httpd.conf can use the "CacheEnable" and "CacheDisable" directives at the server, virtual host, context, file, and location level or in .htaccess. "CacheEnable" and "CacheDisable" directives are compatible with Apache mod_cache directives. However, when used at the context, file, or location level, or in .htaccess, "CacheEnable" and "CacheDisable" will only be applied to directories below the current level. URL parameters will be ignored.
Syntax
Select from radio box
Tips
Disabled by default. Do not enabled this setting if you are using any LSCache plugins.
Cache Expire Time (seconds)⇑
Description
Specifies how long an object will be cached. The default is "86400" seconds (one day).
Syntax
Integer number
Privately Cache All⇑
Description
Privately cache all URLs served under the current context (server, virtual host, or context level).
A separate cached copy will be made per user based on their IP and set cookies.
Virtual hosts configured through Apache's httpd.conf can use the "CacheEnable private /url" and "CacheDisable private /url" directives at server, virtual host, directory, file, and location levels or in a .htaccess file. "CacheEnable private" and "CacheDisable private" are compatible with Apache's mod_cache directives and will be applied to all directories below the current level. However, when used at the directory, file, or location level, or in a .htaccess file, "CacheEnable private" and "CacheDisable private" will only be applied to directories below the current level. URL parameters will be ignored.
Syntax
Select from radio box
Tips
Disabled by default. Do not enabled this setting if you are using any LSCache plugins.
Private Cache Expire Time (seconds)⇑
Description
Specifies how long an object will be cached in private cache. The default is "60" seconds.
Syntax
Integer number
Enable GeoLocation Lookup⇑
Description
Enterprise Edition Only Specifies whether to enable/disable IP Geolocation lookup. Can be set at server, virtual host, or context level. IP Geolocation is disabled by default when using value "Not Set".
Syntax
Select from radio box
See Also
Enable PageSpeed Optimization⇑
Description
Choose whether or not to enable PageSpeed optimization.
Syntax
Select from radio box
Tips
This can be set at the Server Level and overridden at the Virtual Host and Context Levels. Context Level settings will override Virtual Host Level settings.
PageSpeed Settings⇑
Description
Set parameters using Google default filter sets.
Example
pagespeed FileCachePath /tmp/lshttpd/pagespeed;
pagespeed RewriteLevel CoreFilters;