Java Code Examples for

The following examples show how to use These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: BaiduPanApi-Java   Author: xm0625   File:    License: MIT License 6 votes vote down vote up
protected CloseableHttpResponse checkLogin(CloseableHttpResponse closeableHttpResponse) throws IOException {
    HttpEntity bufferedHttpEntity = closeableHttpResponse.getEntity();
    String mimeString = ContentType.getOrDefault(bufferedHttpEntity).getMimeType();
    if(mimeString.contains("application/json") || mimeString.contains("text/html")) {
        String content = HttpClientHelper.getResponseString(closeableHttpResponse);
        System.out.println("checkLogin() content:"+content);
        try {
            JSONObject jsonObject = (JSONObject) JSON.parse(content);
            if (jsonObject.containsKey("errno") && String.valueOf(jsonObject.get("errno")).equals("-6")) {
        } catch (Exception e) {
    return closeableHttpResponse;
Example #2
Source Project: Overchan-Android   Author: miku-nyan   File:    License: GNU General Public License v3.0 2 votes vote down vote up
 * Добавить строку в кодировке UTF-8
 * @param key имя (ключ)
 * @param value строка
 * @return этот объект
public ExtendedMultipartBuilder addString(String key, String value) {
    return addPart(key, new StringBody(value, ContentType.create("text/plain", "UTF-8")));