Class DefaultUrlMappingData

  • All Implemented Interfaces:
    UrlMappingData

    public class DefaultUrlMappingData
    extends java.lang.Object
    implements UrlMappingData
    Default implementating of the UrlMappingData interface.
    Since:
    0.4
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultUrlMappingData​(java.lang.String urlPattern)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UrlMappingData createRelative​(java.lang.String path)
      Creates a new UrlMappingData instance relative to this one for the given path
      java.lang.String[] getLogicalUrls()
      Obtains the logical URLs for this URL
      java.lang.String[] getTokens()
      Retrieves the tokens that make up a URL.
      java.lang.String getUrlPattern()
      Retrieves the URL pattern for this UrlMappingData instance
      boolean hasOptionalExtension()  
      boolean isOptional​(int index)
      Returns whether the given token in the URL is optional.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultUrlMappingData

        public DefaultUrlMappingData​(java.lang.String urlPattern)
    • Method Detail

      • hasOptionalExtension

        public boolean hasOptionalExtension()
        Specified by:
        hasOptionalExtension in interface UrlMappingData
        Returns:
        Whether the pattern has an optional extension
      • getTokens

        public java.lang.String[] getTokens()
        Description copied from interface: UrlMappingData

        Retrieves the tokens that make up a URL. For example the tokens for the URL /blog/2007/* would be "blog", "2007" and "*"

        Specified by:
        getTokens in interface UrlMappingData
        Returns:
        The tokens as a string array
      • getLogicalUrls

        public java.lang.String[] getLogicalUrls()
        Description copied from interface: UrlMappingData

        Obtains the logical URLs for this URL

        Specified by:
        getLogicalUrls in interface UrlMappingData
        Returns:
        The logical URLs as a string array
      • getUrlPattern

        public java.lang.String getUrlPattern()
        Description copied from interface: UrlMappingData
        Retrieves the URL pattern for this UrlMappingData instance
        Specified by:
        getUrlPattern in interface UrlMappingData
        Returns:
        The URL pattern
      • isOptional

        public boolean isOptional​(int index)
        Description copied from interface: UrlMappingData
        Returns whether the given token in the URL is optional. The index takes into account matching groups so for example the URL /blog/(*)/(*) has two entries for the two (*) matching groups with the index 0 relating to the the first entry
        Specified by:
        isOptional in interface UrlMappingData
        Parameters:
        index - The index of the matching token
        Returns:
        True if it is optional
      • createRelative

        public UrlMappingData createRelative​(java.lang.String path)
        Description copied from interface: UrlMappingData
        Creates a new UrlMappingData instance relative to this one for the given path
        Specified by:
        createRelative in interface UrlMappingData
        Parameters:
        path - The path
        Returns:
        The new instance