@Test public void testGenerateEncodedRedirectURL() { String result = "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "/domain/", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "domain", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "/domain", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "domain/", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "/domain/", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "domain", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "/domain", "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "domain/", "http: result = "http: assertEquals(result, StringUtil.generateEncodedRedirectURL("中国.cn", "/domain/", "http: }
public static String generateEncodedRedirectURL(String param, String servicePartUri, String baseUrl) { LOGGER.debug(" redirect found,baseUrl:{},return 301.", baseUrl); if (StringUtils.endsWith(baseUrl, URL_SEPARATOR)) { baseUrl = StringUtils.removeEnd(baseUrl, URL_SEPARATOR); } if (StringUtils.startsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeStart(servicePartUri, URL_SEPARATOR); } if (StringUtils.endsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeEnd(servicePartUri, URL_SEPARATOR); } String absoluteUrl = baseUrl + URL_SEPARATOR + servicePartUri + URL_SEPARATOR + param; absoluteUrl = StringUtil.urlEncode(absoluteUrl); LOGGER.debug(" redirect URL:{}", absoluteUrl); return absoluteUrl; }
StringUtil { public static String generateEncodedRedirectURL(String param, String servicePartUri, String baseUrl) { LOGGER.debug(" redirect found,baseUrl:{},return 301.", baseUrl); if (StringUtils.endsWith(baseUrl, URL_SEPARATOR)) { baseUrl = StringUtils.removeEnd(baseUrl, URL_SEPARATOR); } if (StringUtils.startsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeStart(servicePartUri, URL_SEPARATOR); } if (StringUtils.endsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeEnd(servicePartUri, URL_SEPARATOR); } String absoluteUrl = baseUrl + URL_SEPARATOR + servicePartUri + URL_SEPARATOR + param; absoluteUrl = StringUtil.urlEncode(absoluteUrl); LOGGER.debug(" redirect URL:{}", absoluteUrl); return absoluteUrl; } }
StringUtil { public static String generateEncodedRedirectURL(String param, String servicePartUri, String baseUrl) { LOGGER.debug(" redirect found,baseUrl:{},return 301.", baseUrl); if (StringUtils.endsWith(baseUrl, URL_SEPARATOR)) { baseUrl = StringUtils.removeEnd(baseUrl, URL_SEPARATOR); } if (StringUtils.startsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeStart(servicePartUri, URL_SEPARATOR); } if (StringUtils.endsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeEnd(servicePartUri, URL_SEPARATOR); } String absoluteUrl = baseUrl + URL_SEPARATOR + servicePartUri + URL_SEPARATOR + param; absoluteUrl = StringUtil.urlEncode(absoluteUrl); LOGGER.debug(" redirect URL:{}", absoluteUrl); return absoluteUrl; } private  StringUtil(); }
StringUtil { public static String generateEncodedRedirectURL(String param, String servicePartUri, String baseUrl) { LOGGER.debug(" redirect found,baseUrl:{},return 301.", baseUrl); if (StringUtils.endsWith(baseUrl, URL_SEPARATOR)) { baseUrl = StringUtils.removeEnd(baseUrl, URL_SEPARATOR); } if (StringUtils.startsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeStart(servicePartUri, URL_SEPARATOR); } if (StringUtils.endsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeEnd(servicePartUri, URL_SEPARATOR); } String absoluteUrl = baseUrl + URL_SEPARATOR + servicePartUri + URL_SEPARATOR + param; absoluteUrl = StringUtil.urlEncode(absoluteUrl); LOGGER.debug(" redirect URL:{}", absoluteUrl); return absoluteUrl; } private  StringUtil(); static List<MediaType> parseMediaTypes(String mediaTypesStr); static MediaType parseMediaType(String mediaTypeStr); static boolean containNonAsciiPrintableChars(String decodeUri); static String generateEncodedRedirectURL(String param,
            String servicePartUri, String baseUrl); static List<String> parseSeparatedStringToListIfListIsNull(
            String separatedStr, List<String> list); static String addQuotas(String str); static boolean checkIsValidSearchPattern(String str); static boolean containsAtMostOnce(String str, String searchStr); static boolean isValidEntityHandleOrName(String handle); static String urlEncode(String str); static String getNormalization(String str); static long parseUnsignedLong(String s); static String foldCase(String strParam); static String foldCaseAndNormalization(String strParam); static List<String> getNotEmptyStringList(List<String> stringList); }
StringUtil { public static String generateEncodedRedirectURL(String param, String servicePartUri, String baseUrl) { LOGGER.debug(" redirect found,baseUrl:{},return 301.", baseUrl); if (StringUtils.endsWith(baseUrl, URL_SEPARATOR)) { baseUrl = StringUtils.removeEnd(baseUrl, URL_SEPARATOR); } if (StringUtils.startsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeStart(servicePartUri, URL_SEPARATOR); } if (StringUtils.endsWith(servicePartUri, URL_SEPARATOR)) { servicePartUri = StringUtils.removeEnd(servicePartUri, URL_SEPARATOR); } String absoluteUrl = baseUrl + URL_SEPARATOR + servicePartUri + URL_SEPARATOR + param; absoluteUrl = StringUtil.urlEncode(absoluteUrl); LOGGER.debug(" redirect URL:{}", absoluteUrl); return absoluteUrl; } private  StringUtil(); static List<MediaType> parseMediaTypes(String mediaTypesStr); static MediaType parseMediaType(String mediaTypeStr); static boolean containNonAsciiPrintableChars(String decodeUri); static String generateEncodedRedirectURL(String param,
            String servicePartUri, String baseUrl); static List<String> parseSeparatedStringToListIfListIsNull(
            String separatedStr, List<String> list); static String addQuotas(String str); static boolean checkIsValidSearchPattern(String str); static boolean containsAtMostOnce(String str, String searchStr); static boolean isValidEntityHandleOrName(String handle); static String urlEncode(String str); static String getNormalization(String str); static long parseUnsignedLong(String s); static String foldCase(String strParam); static String foldCaseAndNormalization(String strParam); static List<String> getNotEmptyStringList(List<String> stringList); static final String SPACE; static final String TLD_SPLITOR; static final String ASTERISK; static final String CHAR_SET_UTF8; static final String CHAR_SET_ISO8859; static final int MAX_ENTITY_HANDLE_LENGTH; }