Class ActionExtensions

java.lang.Object
org.apache.struts2.dispatcher.mapper.ActionExtensions

public final class ActionExtensions extends Object
Helpers for the ordered extension lists accepted by struts.action.extension and the per-package / per-action extension attribute. The first entry is the default and an empty entry stands for "no extension".
Since:
7.5.0
  • Method Details

    • parse

      public static List<String> parse(String value)
      Parses a comma separated extension list; a trailing comma adds an empty entry.
      Parameters:
      value - the raw value, may be null
      Returns:
      an unmodifiable list in declared order, or an empty list when value is null
      Since:
      7.5.0
    • allows

      public static boolean allows(List<String> allowed, String extension)
      Parameters:
      allowed - the allowed extensions
      extension - the extension to check, null counts as an empty one
      Returns:
      whether extension is in allowed
      Since:
      7.5.0
    • select

      public static String select(List<String> allowed, String current)
      Parameters:
      allowed - the allowed extensions, must not be empty
      current - the preferred extension, null counts as an empty one
      Returns:
      current when allowed, otherwise the first allowed extension
      Since:
      7.5.0