public String removeProtocol(String url) {
   if (url.startsWith(Http.HTTP_WITH_SLASH)) {
     return url.substring(Http.HTTP_WITH_SLASH.length(), url.length());
   } else if (url.startsWith(Http.HTTPS_WITH_SLASH)) {
     return url.substring(Http.HTTPS_WITH_SLASH.length(), url.length());
   } else {
     return url;
   }
 }
  protected String getScreenName(String openId) {
    String screenName = normalize(openId);

    if (screenName.startsWith(Http.HTTP_WITH_SLASH)) {
      screenName = screenName.substring(Http.HTTP_WITH_SLASH.length());
    }

    if (screenName.startsWith(Http.HTTPS_WITH_SLASH)) {
      screenName = screenName.substring(Http.HTTPS_WITH_SLASH.length());
    }

    screenName =
        StringUtil.replace(
            screenName,
            new char[] {CharPool.SLASH, CharPool.UNDERLINE},
            new char[] {CharPool.PERIOD, CharPool.PERIOD});

    return screenName;
  }
Exemplo n.º 3
0
  public static String getScreenName(String openId) {
    String result = normalize(openId);

    if (result.startsWith(Http.HTTP_WITH_SLASH)) {
      result = result.substring(Http.HTTP_WITH_SLASH.length());
    }

    if (result.startsWith(Http.HTTPS_WITH_SLASH)) {
      result = result.substring(Http.HTTPS_WITH_SLASH.length());
    }

    result =
        StringUtil.replace(
            result,
            new String[] {StringPool.SLASH, StringPool.UNDERLINE},
            new String[] {StringPool.PERIOD, StringPool.PERIOD});

    return result;
  }