Class HttpURLResourceName

  • All Implemented Interfaces:
    ResourceName, BaseResourceName<ResourceMatch,​MalformedURLException>

    public class HttpURLResourceName
    extends URLResourceName
    This implementation of ResourceName extends URLResourceName to add special handling of resources which end in delimiter (BaseURLResourceName) followed by a multi level wildcard. Wildcard card at the end matches across levels. so http://abc.com/b/c/d/* matches http://abc.com/b/c/d/e/f/g.html while http://abc.com/"*"/d matches only string of type http://abc.com/a/d. So embedded wildcard matches only at that level where specified, while wildcard at the end, matches across levels. Behaviour of existing URLResourceName was not changed to maintain backward compatibility.
    • Constructor Detail

      • HttpURLResourceName

        public HttpURLResourceName()
    • Method Detail

      • compare

        public ResourceMatch compare​(String requestResource,
                                     String targetResource,
                                     boolean wildcardCompare)
        Compares two resources. Description: The targetResource may contain wildcard '*' which matches zero or more characters. The wildcard character can show up anywhere within the string. The targetResource can contain any number of wildcard characters. One of the five possible match types is returned based on how the two resource strings are related. The comparison starts from the beginning of the reource strings. ResourceMatch.NO_MATCH means two resources don't match. ResourceMatch.EXACT_MATCH means two resources match. ResourceMatch.SUB_RESOURCE_MATCH means targetResource is a sub resource of the requestResource. ResourceMatch.SUPER_RESOURCE_MATCH means targetResource is a super resource of the requestResource. ResourceMatch.WILDCARD_MATCH means two resources match with respect to the wildcard.
        Specified by:
        compare in interface BaseResourceName<ResourceMatch,​MalformedURLException>
        Overrides:
        compare in class BaseURLResourceName<ResourceMatch,​MalformedURLException>
        Parameters:
        requestResource - name of the resource which will be compared
        targetResource - name of the resource which will be compared with
        wildcardCompare - flag for wildcard comparison
        Returns:
        returns ResourceMatch that specifies if the resources are exact match, or otherwise.