Uploaded image for project: 'Blossom'
  1. Blossom
  2. BLOSSOM-195

Performance improvements for forward and include wrappers

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 2.0.7, 3.0.5
    • None
    • None

      The forward and include wrappers simulate servlet container dispatch operations by overriding path element getters and adding the appropriate request attributes. To properly implement these they need to adapt when a real dispatch is performed. When the servlet container performs a dispatch it doesn't add a wrapper at the front of the request chain, instead it changes the original request at the back of the chain (or inserts a wrapper inside the chain just after the original one). To detect this the Blossom wrappers probes the chain behind them to figure out if something has changed. They need to know this in order to decide whether they should override attributes and path elements.

      While these calls are quick and simple they're called very frequently and need to be as fast as possible.

      With this issue we should take the same approach for the forward wrapper. Other possible performance improvements should be investigated as well.

      • ForwardRequestWrapper should stop overriding path elements when it sees a forward dispatch. This will remove the need to probe backwards for all path elements.
      • SpecialAttributeRequestWrapper should not probe backwards to test for changed attributes since this is no longer necessary.

      In the unusual situation where a forward is performed after an include, which is supported by containers, no include attributes should be visible

      • When applied ForwardRequestWrapper should disable all IncludeRequestWrappers already in chain to hide their attributes (bugfix).
      • IncludeRequestWrapper should stop exposing attributes when it sees a forward dispatch, they must not be visible (bugfix).

      In BLOSSOM-130 a major improvement was made by letting the include wrapper switch itself off when a real include dispatch happens. This works as long as a real dispatch is performed between additions of IncludeRequestWrappers. This is the case when using JSPs but not for Freemarker or Thymeleaf. We should therefor do the same thing explicitly when adding an IncludeRequestWrapper.

      • When applied IncludeRequestWrapper should disable all other IncludeRequestWrappers already in chain since they will have no effect anyway.

      In addition these performance enhancements should be done.

      • When applied ForwardRequestWrapper should disable all other ForwardRequestWrappers already in chain since they will have no effect anyway.
      • SpecialAttributeRequestWrapper should have slots only for attributes that are actually overridden.
      • SpecialAttributeRequestWrapper should test with a prefix on attribute name before testing its overrides.
      • SpecialAttributeRequestWrapper should skip wrapping attribute name enumeration when disabled.
      • SpecialAttributeRequestWrapper should have attribute name enumeration methods inlined.

        Acceptance criteria

              tmattsson Tobias Mattsson
              tmattsson Tobias Mattsson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD