Sun Java System Web Server 7.0 Update 4 Developer's Guide to Java Web Applications

file Session Manager

The file is another file-system-based session manager provided with Web Server. For session persistence, file can use a file to which each session is serialized. You can also create your own persistence mechanism.

Enabling the file Session Manager

You can specify file explicitly to change its default parameters. To do so, edit the sun-web.xml file for the web application as in the following example. Note that persistence-type must be set to file.

           <session-manager persistence-type=”file”>
                 <property name=reapIntervalSeconds value=20 />
                 <property name=directory value=sessions />

For more information about the sun-web.xml file, see Chapter 9, Deploying Web Applications.

Manager Properties for file

The following table describes manager-properties properties for the file session manager.

Table 6–5 manager-properties for file

Property Name  

Default Value  




Specifies the number of seconds between checks for expired sessions. 

Setting this value lower than the frequency at which session data changes is recommended. For example, this value should be as low as possible (1 second) for a hit counter servlet on a frequently accessed web site, or you could lose the last few hits each time you restart the server. 



Specifies the maximum number of active sessions, or -1 (the default) for no limit.