java类org.apache.http.util.TextUtils的实例源码

SetPackageFilter.java 文件源码 项目:Dependency-Injection-Graph 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getProject();

    if (project != null) {

        String packageName = Messages.showInputDialog(
                Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
                Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
                Messages.getQuestionIcon(),
                PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
                new NonEmptyInputValidator());

        if (!TextUtils.isEmpty(packageName)) {
            PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
        }
    }
}
ClassEntity.java 文件源码 项目:GitHub 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void setValueAt(int column, String text) {
    switch (column) {
        case 2:
            break;
        case 3:
            String result;
            if (!TextUtils.isEmpty(fieldTypeSuffix)) {
                result = fieldTypeSuffix + "." + text;
            } else {
                result = text;
            }
            if (CheckUtil.getInstant().containsDeclareClassName(result)) {
                return;
            }
            CheckUtil.getInstant().removeDeclareClassName(getQualifiedName());
            setClassName(text);
            break;
    }
}
ConvertBridge.java 文件源码 项目:GitHub 阅读 19 收藏 0 点赞 0 评论 0
private String createSubClassName(String key, Object o) {
    String name = "";
    if (o instanceof JSONObject) {
        if (TextUtils.isEmpty(key)) {
            return key;
        }
        String[] strings = key.split("_");
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < strings.length; i++) {
            stringBuilder.append(StringUtils.captureName(strings[i]));
        }
        name = stringBuilder.toString() + Config.getInstant().getSuffixStr();
    }
    return name;

}
LombokProcessor.java 文件源码 项目:GitHub 阅读 24 收藏 0 点赞 0 评论 0
private String generateLombokFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
    fixme = fixme == null ? "" : fixme;

    StringBuilder fieldSb = new StringBuilder();
    String filedName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }

    if (Config.getInstant().isFieldPrivateMode()) {
        fieldSb.append("private  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    } else {
        fieldSb.append("public  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    }
    return fieldSb.append(fixme).toString();
}
AutoValueProcessor.java 文件源码 项目:GitHub 阅读 25 收藏 0 点赞 0 评论 0
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
    fixme = fixme == null ? "" : fixme;
    StringBuilder fieldSb = new StringBuilder();
    String fieldName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (!fieldName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
        fieldSb.append(Constant.gsonFullNameAnnotation.replaceAll("\\{filed\\}", fieldEntity.getKey()));
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }
    return fieldSb.append(String.format("public abstract %s %s(); " + fixme, fieldEntity.getFullNameType(), fieldName)).toString();
}
Processor.java 文件源码 项目:GitHub 阅读 28 收藏 0 点赞 0 评论 0
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
    fixme = fixme == null ? "" : fixme;
    StringBuilder fieldSb = new StringBuilder();
    String filedName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }
    if (!filedName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
        fieldSb.append(Config.getInstant().geFullNameAnnotation().replaceAll("\\{filed\\}", fieldEntity.getKey()));
    }

    if (Config.getInstant().isFieldPrivateMode()) {
        fieldSb.append("private  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    } else {
        fieldSb.append("public  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    }
    return fieldSb.append(fixme).toString();
}
JsonDialog.java 文件源码 项目:GitHub 阅读 26 收藏 0 点赞 0 评论 0
private void onOK() {

        this.setAlwaysOnTop(false);
        String jsonSTR = editTP.getText().trim();
        if (TextUtils.isEmpty(jsonSTR)) {
            return;
        }
        String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", "");
        if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) {
            Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
            return;
        }
        PsiClass generateClass = null;
        if (!currentClass.equals(generateClassName)) {
            generateClass = PsiClassUtil.exist(file, generateClassTF.getText());
        } else {
            generateClass = cls;
        }

        new ConvertBridge(this, jsonSTR, file, project, generateClass,
                cls, generateClassName).run();
    }
StringUtils.java 文件源码 项目:GitHub 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 转成驼峰
 *
 * @param text
 * @return
 */
public static String captureStringLeaveUnderscore(String text) {
    if (TextUtils.isEmpty(text)) {
        return text;
    }
    String temp = text.replaceAll("^_+", "");

    if (!TextUtils.isEmpty(temp)) {
        text = temp;
    }
    String[] strings = text.split("_");
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        stringBuilder.append(captureName(strings[i]));
    }
    return stringBuilder.toString();
}
HttpUtil.java 文件源码 项目:Webhook_server 阅读 23 收藏 0 点赞 0 评论 0
private <T> T postNormal(String actionName, Class<T> tClass, Object linkBean) {
    RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(linkBean));
    Request request = new Request.Builder().url(getFullUrl(actionName)).post(body).build();
    T ret = null;
    String result = null;
    try {
        Response response = getOkHttp().newCall(request).execute();
        result = response.body().string();
        if (!TextUtils.isEmpty(result)) {
            //                if (result.contains("error_code")) {
            //                    mLogger.error("postForm result error ,actionName = " + actionName + " ,detail : " + result);
            //                } else {
            ret = gson.fromJson(result, tClass);
            //                }
        }
        System.out.println("post成功 result = " + result);
    } catch (Exception e) {
        mLogger.error("postForm IOException1 action: " + actionName + " ," + tClass.getName() + " ,detail: " + e.getMessage() + ",resultStr = " + result);
        e.printStackTrace();
    }
    return ret;
}
HttpUtil.java 文件源码 项目:Webhook_server 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 生成get方法完整url地址:  https://www.okcoin.com/api/v1/future_index.do?symbol=btc_usd
 *
 * @param actionName 请求动作名称:future_index.do
 * @param contents   查询参数:  symbol,btc_usd
 */
private String getFullUrl(String actionName, String... contents) {
    if (TextUtils.isEmpty(Params.accessToken)) {
        System.out.println("access_token非法 " + Params.accessToken);
    }
    // 这个是钉钉要加的,都统一加上吧,暂时没发现问题,就不做特殊处理了
    String result = "?access_token=" + Params.accessToken + "&";
    if (contents != null && contents.length > 0 && contents.length % 2 == 0) {
        for (int i = 0; i < contents.length - 1; i += 2) {
            result += contents[i] + "=" + contents[i + 1] + "&";
        }
    }
    if (!TextUtils.isEmpty(result)) {
        result = result.substring(0, result.length() - 1);
    }
    return Params.getDingTalkServerUrl() + actionName + result;
}
HttpUtil.java 文件源码 项目:Webhook_server 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 发送简单的文本通知给部门所有人
 * 目前用于merge请求通过的时候通知所有人员的时候
 *
 * @param toSpecialUser 是否只是发给单个用户,若非empty,则发给指定用户,否则发给部门所有人
 * @param content       要发送的文本内容
 */
public void sendTextMsg(@Nullable String toSpecialUser, String content) {
    if (Params.userlist != null) {
        Params.userlist.stream()
                .filter(bean -> TextUtils.isEmpty(toSpecialUser) || bean.getName().equalsIgnoreCase(toSpecialUser))
                .forEach(bean -> {
                    String userId = bean.getUserid();

                    MessageTextBean textBean = new MessageTextBean();
                    textBean.setTouser(userId);
                    textBean.setAgentid(Params.agentId);
                    textBean.setMsgtype(MessageType.TEXT);

                    MessageTextBean.TextBean subTextBean = new MessageTextBean.TextBean();
                    subTextBean.setContent(content);

                    textBean.setText(subTextBean);
                    postNormal("message/send", MessageResponseBean.class, textBean);
                });
    } else {
        getDepartmentMenberList();
    }
}
ClassEntity.java 文件源码 项目:CodeGenerate 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void setValueAt(int column, String text) {
    switch (column) {
        case 2:
            break;
        case 3:
            String result;
            if (!TextUtils.isEmpty(fieldTypeSuffix)) {
                result = fieldTypeSuffix + "." + text;
            } else {
                result = text;
            }
            if (CheckUtil.getInstant().containsDeclareClassName(result)) {
                return;
            }
            CheckUtil.getInstant().removeDeclareClassName(getQualifiedName());
            setClassName(text);
            break;
    }
}
ConvertBridge.java 文件源码 项目:CodeGenerate 阅读 20 收藏 0 点赞 0 评论 0
private String createSubClassName(String key, Object o) {
    String name = "";
    if (o instanceof JSONObject) {
        if (TextUtils.isEmpty(key)) {
            return key;
        }
        String[] strings = key.split("_");
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < strings.length; i++) {
            stringBuilder.append(StringUtils.captureName(strings[i]));
        }
        name = stringBuilder.toString() + Config.getInstant().getSuffixStr();
    }
    return name;

}
LombokProcessor.java 文件源码 项目:CodeGenerate 阅读 20 收藏 0 点赞 0 评论 0
private String generateLombokFieldText(ClassEntity classEntity, FieldEntity fieldEntity,String fixme) {
    fixme = fixme == null ? "" : fixme;

    StringBuilder fieldSb = new StringBuilder();
    String filedName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }

    if (Config.getInstant().isFieldPrivateMode()) {
        fieldSb.append("private  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    } else {
        fieldSb.append("public  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    }
    return fieldSb.append(fixme).toString();
}
AutoValueProcessor.java 文件源码 项目:CodeGenerate 阅读 21 收藏 0 点赞 0 评论 0
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
    fixme = fixme == null ? "" : fixme;
    StringBuilder fieldSb = new StringBuilder();
    String fieldName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (!fieldName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
        fieldSb.append(Constant.gsonFullNameAnnotation.replaceAll("\\{filed\\}", fieldEntity.getKey()));
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }
    return fieldSb.append(String.format("public abstract %s %s(); " + fixme, fieldEntity.getFullNameType(), fieldName)).toString();
}
Processor.java 文件源码 项目:CodeGenerate 阅读 25 收藏 0 点赞 0 评论 0
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
    fixme = fixme == null ? "" : fixme;
    StringBuilder fieldSb = new StringBuilder();
    String filedName = fieldEntity.getGenerateFieldName();
    if (!TextUtils.isEmpty(classEntity.getExtra())) {
        fieldSb.append(classEntity.getExtra()).append("\n");
        classEntity.setExtra(null);
    }
    if (fieldEntity.getTargetClass() != null) {
        fieldEntity.getTargetClass().setGenerate(true);
    }
    if (!filedName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
        fieldSb.append(Config.getInstant().geFullNameAnnotation().replaceAll("\\{filed\\}", fieldEntity.getKey()));
    }

    if (Config.getInstant().isFieldPrivateMode()) {
        fieldSb.append("private  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    } else {
        fieldSb.append("public  ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
    }
    return fieldSb.append(fixme).toString();
}
JsonDialog.java 文件源码 项目:CodeGenerate 阅读 31 收藏 0 点赞 0 评论 0
private void onOK() {

        this.setAlwaysOnTop(false);
        String jsonSTR = editTP.getText().trim();
        if (TextUtils.isEmpty(jsonSTR)) {
            return;
        }
        String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", "");
        if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) {
            Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
            return;
        }
        PsiClass generateClass = null;
        if (!currentClass.equals(generateClassName)) {
            generateClass = PsiClassUtil.exist(file, generateClassTF.getText());
        } else {
            generateClass = cls;
        }

        new ConvertBridge(this, jsonSTR, file, project, generateClass,
                cls, generateClassName).run();
    }
StringUtils.java 文件源码 项目:CodeGenerate 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 转成驼峰
 *
 * @param text
 * @return
 */
public static String captureStringLeaveUnderscore(String text) {
    if (TextUtils.isEmpty(text)) {
        return text;
    }
    String temp = text.replaceAll("^_+", "");

    if (!TextUtils.isEmpty(temp)) {
        text = temp;
    }
    String[] strings = text.split("_");
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        stringBuilder.append(captureName(strings[i]));
    }
    return stringBuilder.toString();
}
GoogleTranslation.java 文件源码 项目:GoogleTranslation 阅读 22 收藏 0 点赞 0 评论 0
private void getTranslation(AnActionEvent event) {
    Editor editor = event.getData(PlatformDataKeys.EDITOR);
    if (editor == null) {
        return;
    }
    SelectionModel model = editor.getSelectionModel();
    String selectedText = model.getSelectedText();
    if (TextUtils.isEmpty(selectedText)) {
        selectedText = getCurrentWords(editor);
        if (TextUtils.isEmpty(selectedText)) {
            return;
        }
    }
    String queryText = strip(addBlanks(selectedText));
    new Thread(new RequestRunnable(mTranslator, editor, queryText)).start();
}
SafeRedirectStrategy.java 文件源码 项目:CurseSync 阅读 23 收藏 0 点赞 0 评论 0
@Override
protected URI createLocationURI(String location) throws ProtocolException
{
    try
    {
        final URIBuilder b = new URIBuilder(new URI(encode(location)).normalize());
        final String host = b.getHost();
        if (host != null)
        {
            b.setHost(host.toLowerCase(Locale.ROOT));
        }
        final String path = b.getPath();
        if (TextUtils.isEmpty(path))
        {
            b.setPath("/");
        }
        return b.build();
    }
    catch (final URISyntaxException ex)
    {
        throw new ProtocolException("Invalid redirect URI: " + location, ex);
    }
}
ReciteWords.java 文件源码 项目:ReciteWords 阅读 19 收藏 0 点赞 0 评论 0
private void getTranslation(AnActionEvent event) {
    Editor mEditor = event.getData(PlatformDataKeys.EDITOR);
    Project project = event.getData(PlatformDataKeys.PROJECT);
    String basePath = project.getBasePath();

    if (null == mEditor) {
        return;
    }
    SelectionModel model = mEditor.getSelectionModel();
    String selectedText = model.getSelectedText();
    if (TextUtils.isEmpty(selectedText)) {
        selectedText = getCurrentWords(mEditor);
        if (TextUtils.isEmpty(selectedText)) {
            return;
        }
    }
    String queryText = strip(addBlanks(selectedText));
    new Thread(new RequestRunnable(mEditor, queryText,basePath)).start();
}
SetApkPathAction.java 文件源码 项目:Dependency-Injection-Graph 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getProject();
    if (project != null) {
        String currentApkPath = PropertiesManager.getData(project, PropertyKeys.APK_PATH);

        VirtualFile fileToSelectOnCreate =
                TextUtils.isEmpty(currentApkPath)
                        ? project.getBaseDir()
                        : LocalFileSystem.getInstance().findFileByPath(currentApkPath);

        VirtualFile apkFile = new FileChooserDialogManager.Builder(project, fileToSelectOnCreate)
                .setFileTypes(FileTypes.FILE)
                .setTitle(Strings.TITLE_ASK_APK_FILE)
                .setDescription(Strings.MESSAGE_ASK_APK_FILE)
                .withFileFilter("apk")
                .create()
                .getSelectedFile();

        if (apkFile != null) {
            PropertiesManager.putData(project, PropertyKeys.APK_PATH, apkFile.getPath());
        }
    }
}
ResourceUsageCountUtils.java 文件源码 项目:Android-Resource-Usage-Count 阅读 24 收藏 0 点赞 0 评论 0
/**
 * valid tag to count
 */
static boolean isTargetTagToCount(PsiElement tag) {
    if (tag == null || !(tag instanceof XmlTag) || TextUtils.isEmpty(((XmlTag)tag).getName())) {
        return false;
    }
    String name = ((XmlTag)tag).getName();
    return name.equals("array")
            || name.equals("attr")
            || name.equals("bool")
            || name.equals("color")
            || name.equals("declare-styleable")
            || name.equals("dimen")
            || name.equals("drawable")
            || name.equals("eat-comment")
            || name.equals("fraction")
            || name.equals("integer")
            || name.equals("integer-array")
            || name.equals("item")
            || name.equals("plurals")
            || name.equals("string")
            || name.equals("string-array")
            || name.equals("style");
}
ResourceUsageCountUtils.java 文件源码 项目:Android-Resource-Usage-Count 阅读 26 收藏 0 点赞 0 评论 0
/**
 * valid tag to count
 */
static boolean isTargetTagToCount(PsiElement tag) {
    if (tag == null || !(tag instanceof XmlTag) || TextUtils.isEmpty(((XmlTag)tag).getName())) {
        return false;
    }
    String name = ((XmlTag)tag).getName();
    return name.equals("array")
            || name.equals("attr")
            || name.equals("bool")
            || name.equals("color")
            || name.equals("declare-styleable")
            || name.equals("dimen")
            || name.equals("drawable")
            || name.equals("eat-comment")
            || name.equals("fraction")
            || name.equals("integer")
            || name.equals("integer-array")
            || name.equals("item")
            || name.equals("plurals")
            || name.equals("string")
            || name.equals("string-array")
            || name.equals("style");
}
Settings.java 文件源码 项目:weex-language-support 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void apply() throws ConfigurationException {
    try {
        PropertiesComponent.getInstance().setValue(KEY_RULES_PATH, rulesPath.getText());
        if (!TextUtils.isEmpty(rulesPath.getText())) {
            load(rulesPath.getText());
            DirectiveLint.prepare();
        } else {
            DirectiveLint.reset();
        }
    } catch (Exception e) {
        ProjectUtil.guessCurrentProject(select).getMessageBus().syncPublisher(Notifications.TOPIC).notify(
                new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                        "Weex language support - bad rules",
                        e.toString(),
                        NotificationType.ERROR));
    }
    savePaths();
}
Attribute.java 文件源码 项目:weex-language-support 阅读 27 收藏 0 点赞 0 评论 0
public boolean match(String value) {
    if (TextUtils.isEmpty(valuePattern)) {
        return false;
    }
    if (valuePattern.toLowerCase().equals("mustache")) {
        return Pattern.compile("\\{\\{.*\\}\\}").matcher(value).matches();
    }  else if (valuePattern.toLowerCase().equals("number")) {
        return Pattern.compile("[0-9]+([.][0-9]+)?$").matcher(value).matches();
    } else if (valuePattern.toLowerCase().equals("boolean")) {
        return Pattern.compile("(true|false)$").matcher(value).matches();
    }  else {
        try {
            return Pattern.compile(valuePattern).matcher(value).matches();
        } catch (Exception e) {
            return false;
        }
    }
}
RootWindow.java 文件源码 项目:WIFIADB 阅读 25 收藏 0 点赞 0 评论 0
private boolean verifyPortText(){
    final String text = mPort.getText();

    if(TextUtils.isBlank(text)){
        return false;
    }

    try {
        int port = Integer.valueOf(text);

        if(port >= 0 && port < 65535){
            return true;
        }
    }catch (Exception e){
        e.printStackTrace();

    }

    return false;
}
RootWindow.java 文件源码 项目:WIFIADB 阅读 25 收藏 0 点赞 0 评论 0
private boolean verifyIpText(){
    for (JTextField field : mIPTextFields){
        final String text = field.getText();

        if(TextUtils.isBlank(text)){
            return false;
        }

        try{
            int ip = Integer.valueOf(text);
            if(ip < 0 || ip > 255){
                return false;
            }
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }

    return true;
}
URIUtilsHC4.java 文件源码 项目:remote-files-sync 阅读 24 收藏 0 点赞 0 评论 0
/**
 * A convenience method that creates a new {@link URI} whose scheme, host, port, path,
 * query are taken from the existing URI, dropping any fragment or user-information.
 * The path is set to "/" if not explicitly specified. The existing URI is returned
 * unmodified if it has no fragment or user-information and has a path.
 *
 * @param uri
 *            original URI.
 * @throws URISyntaxException
 *             If the resulting URI is invalid.
 */
public static URI rewriteURI(final URI uri) throws URISyntaxException {
    Args.notNull(uri, "URI");
    if (uri.isOpaque()) {
        return uri;
    }
    final URIBuilder uribuilder = new URIBuilder(uri);
    if (uribuilder.getUserInfo() != null) {
        uribuilder.setUserInfo(null);
    }
    if (TextUtils.isEmpty(uribuilder.getPath())) {
        uribuilder.setPath("/");
    }
    if (uribuilder.getHost() != null) {
        uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ENGLISH));
    }
    uribuilder.setFragment(null);
    return uribuilder.build();
}
DefaultRedirectStrategy.java 文件源码 项目:remote-files-sync 阅读 25 收藏 0 点赞 0 评论 0
/**
 * @since 4.1
 */
protected URI createLocationURI(final String location) throws ProtocolException {
    try {
        final URIBuilder b = new URIBuilder(new URI(location).normalize());
        final String host = b.getHost();
        if (host != null) {
            b.setHost(host.toLowerCase(Locale.ENGLISH));
        }
        final String path = b.getPath();
        if (TextUtils.isEmpty(path)) {
            b.setPath("/");
        }
        return b.build();
    } catch (final URISyntaxException ex) {
        throw new ProtocolException("Invalid redirect URI: " + location, ex);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号