Class WMTSHelper


  • public class WMTSHelper
    extends Object
    Some useful functions that was used within gt-wmts.

    Might have their substitution elsewhere

    Author:
    Roar Brænden
    • Constructor Detail

      • WMTSHelper

        public WMTSHelper()
    • Method Detail

      • replaceToken

        public static String replaceToken​(String baseUrl,
                                          String dimName,
                                          String dimValue)
        Performs a case-insensitive replacement of the first occurrence of {dimName} with dimValue within the baseUrl. The curly braces are added by this function so dimName should not contain them. dimValue should be encoded using encodeParameter(String) before passing into this function
        Parameters:
        baseUrl - the string which contains {dimName}
        dimName - the value in baseurl that needs to be replaced. Should NOT have the curly braces around it
        dimValue - the encoded value to replace {dimName} with. If this is null then a blank string is used
        Returns:
        baseUrl with {dimName} substituted with dimValue
      • appendQueryString

        public static String appendQueryString​(String baseUrl,
                                               Map<String,​String> params)
        Append the parameters to the baseUrl.

        Add a ? mark if baseUrl doesn't have it.

        Does not add existing parameters

        If a value starts with {, it will avoid url-encoding

      • encodeParameter

        public static String encodeParameter​(String name)
        Encodes a parameter using UTF-8 encoding (suitable for URLs). It will also replace spaces with %20 instead of + (as raised in GEOT-4317) so that the encoded parameter can be used in any part of a URL
        Parameters:
        name - The parameter to be encoded
        Returns:
        the encoded parameter