cz.msebera.android.httpclient.entity.ContentType Java Examples
The following examples show how to use
cz.msebera.android.httpclient.entity.ContentType.
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 File: BaseClass.java From BaiduPanApi-Java with MIT License | 6 votes |
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")) { clearCookies(); initiate(); } } catch (Exception e) { } } return closeableHttpResponse; }
Example #2
Source File: ExtendedMultipartBuilder.java From Overchan-Android with GNU General Public License v3.0 | 2 votes |
/** * Добавить строку в кодировке 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"))); }