Uploaded image for project: 'Stripes'
  1. STS-810

Make StripesFilter more subclass-friendly

    Details

    • Sprint:

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              bengunter BenB
              Reporter:
              skitching Simon Kitching
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: