Web.xml

From Plex-XML
Jump to: navigation, search

The web.xml file contains general information about an application for the Java Application Server
Here we describe only the elements used by Plex-XML applications

Contents

Context

Context Listener

to share handlers when using more than one servlet some initialization is done in the servlet context. (REQUIRED)

 <listener>
   <listener-class>de.bodow.web.AppInitializer</listener-class>
 </listener>

Controller

This parameter describes the location of the Controller Configuration. (REQUIRED)

   <context-param>
     <param-name>de.bodow.controller.config</param-name>
     <param-value>/WEB-INF/controller-config.xml</param-value>
   </context-param>

Compilation of XSLT

This parameter will force the compilations of the XSLT before they will be processed. This will increase the performance of repeated processings. (OPTIONAL)

  • Since JDK 1.5 it is not necessary to set this parameter because the JDK includes an XSLTC processor
   <context-param>
     <param-name>javax.xml.transform.TransformerFactory</param-name>
     <param-value>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</param-value>
   </context-param>

while using Saxon it has to look like

   <context-param>
     <param-name>javax.xml.transform.TransformerFactory</param-name>
     <param-value>net.sf.saxon.TransformerFactoryImpl</param-value>
   </context-param>


BeanPool Configuration

these parameters were designed to configure a BeanPool to reduce the number of objects created

  • Number of beans of one class that can be open at the same time
  • If zero no pool is created and each bean will be cleaned up after use
  • Att: Changes expected due to something like usePool=true/false
  • Att: SHOULD BE 0 since in transactional environments there could be problems
  <context-param>
     <param-name>de.bodow.plex.BeanFactory.pool.MAX_ACTIVE</param-name> 
     <param-value>10</param-value> 
  <context-param>

... a few more optional parameters to configure the pool

Transformer

Type of temporary sources/results to be used within XSLT transformations. (OPTIONAL)

  • legal values are "dom","stream","writer", where "dom" is the default and the only type we know it works ;)
 <context-param>
   <param-name>de.bodow.helper.xslutils.transformer</param-name>
   <param-value>dom</param-value>
 </context-param>

OpenOfficeServer

Host/Portnumber of a running OpenOfficeServer Instance to use

 <context-param>
   <param-name>de.bodow.ooo.connect</param-name> 
   <param-value>socket,host=localhost,port=9000</param-value> 
 </context-param>

Filters

some Servlet Filters we use

Charset Filter

this filter ensures that Tomcat can handle UTF-encoded data properly. (OPTIONAL)

 <filter>
   <filter-name>Charset Filter</filter-name>
   <filter-class>de.bodow.web.filters.CharsetFilter</filter-class>
   <init-param>
     <param-name>requestEncoding</param-name>
     <param-value>UTF-8</param-value>
   </init-param>
 </filter>

Compression Filter

the PJL Compressing Filter can be used to decrease the traffic over the line and improve performance. (OPTIONAL)

 <filter>
   <filter-name>CompressionFilter</filter-name>
   <filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
   <init-param>
     <param-name>excludeContentTypes</param-name>
     <param-value>image/bmp,image/jpeg,image/gif,image/png,application/x-pdf,application/pdf,application/x-msexcel,application/msword,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/zip</param-value>
   </init-param>
 </filter>

Comment Filter

can be used to generate a comment as first part of Text responses. (OPTIONAL)

  • ONLY RECOMMENDED IF YOU LIKE TO PUT THE INTERNET EXPLORER INTO QUIRKS MODE
<!-- This comment will put IE 6 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">

See http://en.wikipedia.org/wiki/Quirks_mode for quirks mode.

 <filter>
   <filter-name>Comment Filter</filter-name>
   <filter-class>de.bodow.web.filters.CommentFilter</filter-class>
     <init-param>
       <param-name>comment</param-name>
       <param-value>This comment will put IE 6 in quirks mode</param-value>
     </init-param>
 </filter>

DataSource Check Filter

a Filter to check the DataSource(s) of the app, if they are avaiable. if not an error page is displayed instead of executing the request.

 <filter>
   <filter-name>DataSourceCheckFilter</filter-name>
   <filter-class>de.bodow.webadmin.CheckDataSourceFilter</filter-class>
   <init-param>
     <param-name>idleTime</param-name>
     <param-value>2</param-value>
   </init-param>
   <init-param>
     <param-name>errorPage</param-name>
     <param-value>/serverError.html</param-value>
   </init-param>
     <init-param>
       <param-name>jndi-prefix</param-name>
       <param-value>@jdbc-jndi-ref@</param-value>
     </init-param>
 </filter>

the @jdbc-jndi-ref@ is a deployment-parameter and depends on the App Server, For standalone Toncat it should be "java:comp/env/" , for Glassfish or other J2EE Servers it should be empty.

Servlet

Servlet Classes

there are two Servlet Classes provided by PleXML.

  • de.bodow.web.ControlServlet  : the normally used Controller servlet which can handle <webrequest>'s configured in a Request Configuration
  • de.bodow.web.SchedulerServlet : this servlet can be used to schedule <jobrequest>'s configured in a Request Configuration, it is not necessary to declare if you do not use <jobrequest>'s

Request Configuration

this parameter describes the location of the Request Configuration. (REQUIRED)

  • used in both Servlet Classes
 <init-param>
   <param-name>de.bodow.web.config</param-name>
   <param-value>/WEB-INF/request-config.xml</param-value>
 </init-param>

CacheCleaner

idle time in minutes for the CacheCleaner run if >= 0 no Cleaner Thread will be started. (OPTIONAL)

  • defaults to 10 minutes
<init-param>
   <param-name>de.bodow.web.CacheCleaner.waittime</param-name>
   <param-value>5</param-value>
 </init-param>

Delete DOM nodes

You can switch off the explicit deletion of DOM nodes in order to save processing time

  • for some DOM implementations it may be necessary to set to true to avoid memory leaks
  • defaults to true
<init-param>
  <param-name>de.bodow.helper.XMLUtils.deleteNodes</param-name>
  <param-value>false</param-value>
</init-param>

File Upload

some parameters configure the FileUpload feature of the ControlServlet. All of these are optional since defaults are provided.

Temporary Directory

used to store large uploaded files

  • defaults to the value of the System-Property java.io.tmpdir
 <init-param>
   <param-name>de.bodow.upload.directory</param-name> 
   <param-value>C://Temp</param-value> 
 </init-param>

Max File Size

the maximum size an uploaded file can have ( in Bytes )

  • defaults to 100 MB
 <init-param>
   <param-name>de.bodow.upload.maxfilesize</param-name>
   <param-value>104857600</param-value>
 </init-param>

Max Memory File Size

the maximum size of an uploaded file cached in memory

  • defauts to 1 MB
 <init-param>
   <param-name>de.bodow.upload.maxmemory</param-name>
   <param-value>1048576</param-value>
 </init-param>

Security Hash Fix Part

the fix part of Hashcode generation

 <init-param>
   <param-name>de.bodow.web.fixhash</param-name>
   <param-value>a fix part for Hash generation</param-value>
 </init-param>
Personal tools