Configuration

The following configurations are available:

The setInstance method of the Config class can be used to set the WFNM framework configuration singleton.

The instance of the Config class can be created in different ways, for example the Config(InputStream) constructor can be used to create a configuration given an input stream like the following:

net.sf.wfnm.ENABLED=true
net.sf.wfnm.CLEANER_ENABLED=true
net.sf.wfnm.STATS_ENABLED=false
net.sf.wfnm.NO_CACHE_ENABLED=true
net.sf.wfnm.DEFAULT_OWNERSHIP=webflow
net.sf.wfnm.URL_REWRITER=
net.sf.wfnm.URL_CALCULATOR=net.sf.wfnm.web.PageUrlCalculator
net.sf.wfnm.MANAGER=net.sf.wfnm.NavigationManagerImpl
net.sf.wfnm.CONTEXT=net.sf.wfnm.NavigationContextImpl
net.sf.wfnm.PAGE_CHANGED_LISTENER=
net.sf.wfnm.WEBFLOW_CHANGED_LISTENER=

Enabling/disabling the framework

The framework can be centrally enabled/disabled using the "enabled" property of the Config class.

When the framework is disabled, it does not keep track of visited pages, webflow and owned objects.

The default for this property is "true".

Enabling/disabling the cleaner subsystem

The WFNM framework cleaner subsystem can be centrally enabled/disabled by using the "cleanerEnabled" property of the Config class.

When the cleaning subsystem is disabled, the framework keeps track of visited pages and webflows, but it does not keep track of owned objects.

The default for this property is "true".

Enabling/disabling statistics

The WFNM framework includes a little http session size statistic subsystem that can be used to monitor the size of the user http session.

Statistics are written to a jakarta commons logging category called "stats", that in the sample is redirected in a file called "wfnm-sample-stats.csv" created inside the temporary directory defined by the JVM system property "java.io.tmpdir" (%CATALINA_HOME%/temp for Tomcat 5).

The "statsEnabled" property enable/disable statistics.

The default for this property is "false".

Enabling/disabling the 'no cache' option

The WFNM framework allows to transparently add a "no cache" header directive to all pages.

The property that enable/disable this feature is called "noCacheEnabled".

The default for this option is "true".

Setting the default ownership

An important configuration for the framework is the default ownership for webflows: by setting a default ownership every webflow, which does not specify a different ownership, is created with the ownership specified by this configuration.

The property for this configuration is called "defaultOwnership".

The possible values of this property are "page","webflow","previous","working","global" and "none" (see here).

The default for this property is "webflow".

Setting the url rewriter

When the NoMultipleSubmitFilter recognize that multiple requests are issued by the browser, it executes only the first request and reload the reached page for the others.

For such that reload mecchanism, it should be necessary to rewrite the URL; for example JavaServer Faces needs a prefix which is tipically something like "/faces" or needs a different extension like ".jsf".

The rewriter class that can be configured must implements the UrlRewriter interface.

The property for this configuration is called "urlRewriter".

By default there is no URL rewriter configured: the NoMultipleSubmitFilter does not rewrite the URLs.

Setting the url calculator

The function used by the NotifyFactory in order to calculate the URL to be notified to the WFNM framework is plugable.

Any class that implements the UrlCalculator interface can be configured. By default, the PageUrlCalculator is used.

The QueryStringUrlCalculator can be configured as well if needed.

Setting the manager

The navigation manager implementation is a class that implements the NavigationManager interface which store and manage the state of the framework: webflows, pages for each webflow and object owner by them.

An instance of the configured navigation manager implementation is stored in the user http session with key ".wfnm" by the NavigationManagerFactory.

The property for this configuration is called "manager".

The default implementation of the manager class is the NavigationManagerImpl class that can be extended or replaced as needed.

Setting the context

The navigation context implementation is a class that implements the NavigationContext interface which harvest information during the navigation and the visualization of web pages. This information is necessary to the navigation manager implementation in order to work properly.

Instances of the configured navigation context implementation are handled by the NavigationContextFactory that uses a ThreadLocal design pattern to collect them. Each instance is strictly tied the http request sent by a browser.

The property for this configuration is called "context".

The default implementation of the context class is the NavigationContextImpl class that can be extended or replaced as needed.

Setting the page changed listener

The framework allows to set a listener that is invoked when a page is opened (i.e. added to the page stack) or closed (i.e. removed from the page stack).

A page listener have to implement the PageChangedListener interface.

The property for this configuration is called "pageChangedListener".

By default no listener is setted.

Setting the webflow changed listener

The framework allows to set a listener that is invoked when a webflow is opened (i.e. added to the webflow stack) or closed (i.e. removed from the webflow stack).

A webflow listener have to implement the WebflowChangedListener interface.

The property for this configuration is called "webflowChangedListener".

By default no listener is setted.