WebXmlConfig

  • Tags : performance, utility
  • Latest : 1.4.1
  • Last Updated: 27 February 2012
  • Grails version : 1.2 > *
  • Authors : Roger Cass
0 vote

87% of Grails users

Dependency :
compile ":webxml:1.4.1"

Documentation Source Issues

Summary

Add additional Features to your web.xml, such as Filters, Config Listeners or Context Parameter definitions

Description

WebXML Plugin

2011.12.02: Version 1.4

The plugin no longer auto-generates grails-app/conf/WebXmlConfig.groovy on install. To create it run the new 'create-web-xml-config' script, e.g. grails create-web-xml-config

This release includes support for specifying the HTTP session timeout.

2011.11.23: Version 1.3/1.3.1

A new feature was added in this release to let other plugins specify a particular order of filters in web.xml. This is only necessary if your plugin's filters need to be in a particular position relative to those added by Grails or other plugins. To keep from explicitly linking plugins, this plugin defines a default position and position values for the filters added by Grails:

static final int DEFAULT_POSITION = 500
static final int GRAILS_WEB_REQUEST_POSITION = 1000
static final int RELOAD_POSITION = 2000
static final int SITEMESH_POSITION = 3000
static final int URL_MAPPING_POSITION = 4000

and you can reference those in your plugin descriptor ("<pluginname>GrailsPlugin.groovy"). Define a getWebXmlFilterOrder() method that returns a Map where the keys are the names of filters, and the values are positions.Load the grails.plugin.webxml.FilterManager class dynamically inside this method to avoid plugin compilation order issues (the method is called after all of the plugins have been compiled).

For example the Spring Security Core plugin defines

def getWebXmlFilterOrder() {
   def FilterManager = getClass().getClassLoader().loadClass('grails.plugin.webxml.FilterManager')
   [springSecurityFilterChain: FilterManager.GRAILS_WEB_REQUEST_POSITION + 100]
}

and the resources plugin defines

def getWebXmlFilterOrder() {
    def FilterManager = getClass().getClassLoader().loadClass('grails.plugin.webxml.FilterManager')
    [DeclaredResourcesPluginFilter: FilterManager.DEFAULT_POSITION - 300,
     AdHocResourcesPluginFilter:    FilterManager.DEFAULT_POSITION - 250,
     ResourcesDevModeFilter:        FilterManager.RELOAD_POSITION + 100]
}

2008.12.09: Version 1.2

This plugin enables a Grails application to control certain aspects of the web.xml file generated by Grails without having to resort to editing the web.xml template file or having to write a plugin in order to use the plugin doWithWebDescriptor closure.

This plugin provides a set of features that can be enabled to add items to the web.xml file. It installs a File WebXmlConfig to your conf directory with samples in it.

This list of supported features include:

  • FilterChainProxy Delegator: this features installs a org.springframework.web.filter.DelegatingFilterProxy pointing to a FilterChainProxy bean. The bean can then be configured by the application's resources.groovy file.
  • Add Config Listeners
  • Add Context Parameters

2008.03.11: Version 1.0