Make StripesFilter more subclass-friendly
-----------------------------------------

                 Key: STS-810
                 URL: http://www.stripesframework.org/jira/browse/STS-810
             Project: Stripes
          Issue Type: Improvement
          Components: ActionBean Dispatching
    Affects Versions: Release 1.5.5
            Reporter: Simon Kitching


Class StripesFilter has private members "configuration" and "configurations" 
which have no corresponding getters/setters. It is therefore currently 
impossible for a subclass of StripesFilter to access these fields.

Being able to customise the configuration instance is very useful - 
particularly when using a dependency-injection framework that can be used to 
instantiate and configure a custom Configuration instance.

Property "RuntimeConfiguration.ACTION_RESOLVER" can be used to specify which 
class to use for the Configuration member, but the object will be created via 
newInstance(), not via any dependency-injection framework.

Suggestion: In method StripesFilter.init(FilterConfig), factor out the code 
that creates the configuration instance into a separate protected-scope method:
 
public void init(FilterConfig filterConfig) throws ServletException {
  BootstrapPropertyResolver bootstrap = new 
BootstrapPropertyResolver(filterConfig);
 
  this.configuration = createConfiguration(filterConfig, bootstrap);
  .. rest of method as before ..
}
 
/**
 * Create an instance of the Configuration interface which this
 * filter instance will use.
 */
protected Configuration createConfiguration(
  FilterConfig filterConfig, BootstrapPropertyResolver bootstrap)
      throws StripesServletException {
  .. code factored out from init method
}
 
I've provided the createConfiguration method with the filterConfig param
because some customisations of this method might want to use data from
this object to select or configure the created Configuration object.


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to