Class AbstractMapper

java.lang.Object
org.apache.wicket.request.mapper.AbstractMapper
All Implemented Interfaces:
IRequestMapper
Direct Known Subclasses:
AbstractComponentMapper, ReportCSPViolationMapper

public abstract class AbstractMapper extends Object implements IRequestMapper
  • Constructor Details

  • Method Details

    • getPlaceholder

      protected String getPlaceholder(String s)
      If the string is in a placeholder format ${key} this method returns the key.
      Parameters:
      s -
      Returns:
      placeholder key or null if string is not in right format
    • getOptionalPlaceholder

      If the string is in an optional parameter placeholder format #{key} this method returns the key.
      Parameters:
      s -
      Returns:
      placeholder key or null if string is not in right format
    • getPlaceholder

      protected String getPlaceholder(String s, char startChar)
      If the string is in a placeholder format x{key}, where 'x' can be specified, this method returns the key.
      Parameters:
      s -
      startChar - the character used to indicate the start of the placeholder
      Returns:
      placeholder key or null if string is not in right format
    • urlStartsWith

      protected boolean urlStartsWith(Url url, String... segments)
      Returns true if the given url starts with specified segments.
      Parameters:
      url -
      segments -
      Returns:
      true if the URL starts with the specified segments, false otherwise
    • safeSegmentGetter

      protected String safeSegmentGetter(List<String> segments, int index, String defaultValue)
      Utility method to safely get an element from a list of String. If the specified index is bigger than the size of the list the default value is returned.
      Parameters:
      segments -
      index -
      defaultValue -
      Returns:
      the element at the specified position or the default value if the list size is smaller.
    • extractPageParameters

      protected PageParameters extractPageParameters(Request request, int segmentsToSkip, IPageParametersEncoder encoder)
      Extracts PageParameters from the URL using the given IPageParametersEncoder .
      Parameters:
      request -
      segmentsToSkip - how many URL segments should be skipped because they "belong" to the IRequestMapper
      encoder -
      Returns:
      PageParameters instance
    • removeMetaParameter

      protected void removeMetaParameter(Url urlCopy)
      The new IRequestMappers use the first query parameter to hold meta information about the request like page version, component version, locale, ... The actual IRequestMapper implementation can decide whether the this parameter should be removed before creating PageParameters from the current query parameters
      Parameters:
      urlCopy - the Url that first query parameter has no value
    • encodePageParameters

      protected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder)
      Encodes the given PageParameters to the URL using the given IPageParametersEncoder. The original URL object is unchanged.
      Parameters:
      url -
      pageParameters -
      encoder -
      Returns:
      URL with encoded parameters
    • getMountSegments

      protected String[] getMountSegments(String mountPath)
      Convenience method for representing mountPath as array of segments
      Parameters:
      mountPath -
      Returns:
      array of path segments
    • resolveLocale

      protected Locale resolveLocale()
      Returns:
      the locale to use for parsing any numbers in the request parameters