Class WithLazyParams.LazyParamInjector

java.lang.Object
org.apache.struts2.interceptor.WithLazyParams.LazyParamInjector
Enclosing interface:
WithLazyParams<P extends InterceptorParams>

public static class WithLazyParams.LazyParamInjector extends Object
  • Field Details

  • Constructor Details

    • LazyParamInjector

      public LazyParamInjector(ValueStack valueStack)
  • Method Details

    • setTextParser

      public void setTextParser(TextParser textParser)
    • setReflectionProvider

      public void setReflectionProvider(ReflectionProvider reflectionProvider)
    • setOgnlUtil

      public void setOgnlUtil(OgnlUtil ognlUtil)
    • resolveInto

      public <P extends InterceptorParams> P resolveInto(P target, Map<String,String> params, ActionContext invocationContext)
      Resolves configured params into a per-invocation holder, leaving the interceptor untouched.

      Every path that skips a write notifies the holder via InterceptorParams.unresolved(String), so the holder can fail closed rather than silently validating against a dimension that was dropped. Two such paths exist:

      • a ${...} expression that resolves to null or an empty value (see isUnresolved(java.lang.String, java.lang.Object))
      • a resolved value the holder's setter cannot accept, e.g. a non-numeric string for a Long property, which OGNL reports as a ReflectionException during conversion
      In both cases the injector does nothing beyond skipping the write, notifying the holder and logging a WARN; what that means for the invocation is the holder's decision, since unresolved is a no-op by default. Whatever the holder was seeded with is left in place, but for a ${...} param that is not a usable default: the seed comes from applying the raw configuration string at build time, so it is either the unevaluated ${...} literal or, when the literal could not be converted to the property's type, nothing at all.

      The empty-value rule also catches an expression that legitimately evaluates to an empty string, which is indistinguishable from a failed resolution; for a fail-closed policy such as an allowlist, treating both as unusable is the safe reading, so a broken expression cannot silently relax a validation policy.

      Since:
      7.3.0