Java Code Examples for org.apache.http.message.BasicNameValuePair
The following are top voted examples for showing how to use
org.apache.http.message.BasicNameValuePair. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to generate
more good examples.
Example 1
Project: letv File: PlayRecordApi.java View source code | 6 votes |
@Deprecated public String s_sendMobile(int updataId, String mobile, String ver, String Cookid) { String requestUrl; if (PreferencesManager.getInstance().isTestApi() && LetvConfig.isForTest()) { requestUrl = "http://test2.m.letv.com/android/dynamic.php"; } else { requestUrl = "http://dynamic.user.app.m.letv.com/android/dynamic.php"; } String str = MD5.toMd5("action=reg&mobile=" + mobile + "&pcode=" + LetvConfig.getPcode() + "&plat=mobile_tv" + "&version=" + LetvUtils.getClientVersionName() + "&poi345"); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("mod", MODIFYPWD_PARAMETERS.MOD_VALUE)); list.add(new BasicNameValuePair("ctl", "clientSendMsg")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("mobile", mobile)); list.add(new BasicNameValuePair(MODIFYPWD_PARAMETERS.PLAT_KEY, "mobile_tv")); list.add(new BasicNameValuePair(MODIFYPWD_PARAMETERS.APISIGN_KEY, str)); list.add(new BasicNameValuePair("action", "reg")); list.add(new BasicNameValuePair("captchaValue", ver)); list.add(new BasicNameValuePair("captchaId", Cookid)); list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); Log.e("ZSM", "s_sendMobile url == " + ParameterBuilder.getQueryUrl(list, requestUrl)); return ParameterBuilder.getQueryUrl(list, requestUrl); }
Example 2
Project: Higher-Cloud-Computing-Project File: ServerUtil.java View source code | 6 votes |
public static String register(String email_addr, String nick_name, String pwd) throws Exception { HttpClient task_post = new DefaultHttpClient(); HttpPost post = new HttpPost(url + "/Register"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("email_addr", email_addr)); params.add(new BasicNameValuePair("nick_name", nick_name)); params.add(new BasicNameValuePair("pwd", pwd)); post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = task_post.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { String result = null; HttpEntity httpEntity = response.getEntity(); if (httpEntity != null) { result = EntityUtils.toString(httpEntity); } JSONObject jsonObject = new JSONObject(result); int register_status = jsonObject.getInt("register_status"); int user_id = jsonObject.getInt("user_id"); if (register_status == 1) return "SUCCESS,your user_id is " + String.valueOf(user_id); else return "FAIL"; } return "401 UNAUTHORIZED"; }
Example 3
Project: publicProject File: HttpClientStack.java View source code | 6 votes |
@SuppressWarnings("unused") private static List<NameValuePair> getPostParameterPairs(Map<String, String> postParams) { List<NameValuePair> result = new ArrayList<NameValuePair>(postParams.size()); for (String key : postParams.keySet()) { result.add(new BasicNameValuePair(key, postParams.get(key))); } return result; }
Example 4
Project: letv File: UserCenterApi.java View source code | 6 votes |
public String getChatRecords(String roomId, boolean server, String tm, int mode) { String keyb = roomId + "," + tm + "," + LetvConstant.CHAT_KEY; ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("luamod", "main")); params.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); params.add(new BasicNameValuePair("ctl", "chatGethistory")); params.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); params.add(new BasicNameValuePair("roomId", roomId)); params.add(new BasicNameValuePair("server", String.valueOf(server))); params.add(new BasicNameValuePair("tm", tm)); params.add(new BasicNameValuePair("key", MD5.toMd5(keyb))); params.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); if (mode == 0) { params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); } else { params.add(new BasicNameValuePair("version", "6.0")); } LogInfo.log("clf", "获取历史聊天记录requestChatRecords..url=" + ParameterBuilder.getQueryUrl(params, getDynamicUrl())); return ParameterBuilder.getQueryUrl(params, getDynamicUrl()); }
Example 5
Project: elasticjob-stock-push File: HttpUtils.java View source code | 6 votes |
/** * post form * * @param host * @param path * @param method * @param headers * @param querys * @param bodys * @return * @throws Exception */ public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, Map<String, String> bodys) throws Exception { HttpClient httpClient = wrapClient(host); HttpPost request = new HttpPost(buildUrl(host, path, querys)); for (Map.Entry<String, String> e : headers.entrySet()) { request.addHeader(e.getKey(), e.getValue()); } if (bodys != null) { List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>(); for (String key : bodys.keySet()) { nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); } UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); formEntity.setContentType("application/x-www-form-urlencoded"); request.setEntity(formEntity); } return httpClient.execute(request); }
Example 6
Project: mxisd File: SessionMananger.java View source code | 6 votes |
private void submitRemote(ThreePidSession session, String token) { UrlEncodedFormEntity entity = new UrlEncodedFormEntity( Arrays.asList( new BasicNameValuePair("sid", session.getRemoteId()), new BasicNameValuePair("client_secret", session.getRemoteSecret()), new BasicNameValuePair("token", token) ), StandardCharsets.UTF_8); HttpPost submitReq = new HttpPost(session.getRemoteServer() + "/_matrix/identity/api/v1/submitToken"); submitReq.setEntity(entity); try (CloseableHttpResponse response = client.execute(submitReq)) { JsonObject o = new GsonParser().parse(response.getEntity().getContent()); if (!o.has("success") || !o.get("success").getAsBoolean()) { String errcode = o.get("errcode").getAsString(); throw new RemoteIdentityServerException(errcode + ": " + o.get("error").getAsString()); } log.info("Successfully submitted validation token for {} to {}", session.getThreePid(), session.getRemoteServer()); } catch (IOException e) { throw new RemoteIdentityServerException(e.getMessage()); } }
Example 7
Project: letv File: PlayRecordApi.java View source code | 6 votes |
public static String requestPraiseInfo(int updataId) { String baseUrl = getUserDynamicUrl(); String uid = LetvUtils.getUID(); String userName = LetvUtils.getLoginUserName(); String deviceId = LetvUtils.generateDeviceId(BaseApplication.getInstance()); StringBuilder md5Sb = new StringBuilder(); md5Sb.append("uid=" + uid + "&"); md5Sb.append("username=" + userName + "&"); md5Sb.append("devid=" + deviceId + "&"); md5Sb.append("pcode=" + LetvConfig.getPcode() + "&"); md5Sb.append("version=" + LetvUtils.getClientVersionName() + "&"); md5Sb.append("letvpraise2014"); String md5Sign = MD5.toMd5(md5Sb.toString()); ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("mod", "passport")); params.add(new BasicNameValuePair("ctl", "index")); params.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "praiseactivity")); params.add(new BasicNameValuePair("uid", uid)); params.add(new BasicNameValuePair("username", userName)); params.add(new BasicNameValuePair(HOME_RECOMMEND_PARAMETERS.DEVICEID_KEY, deviceId)); params.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); params.add(new BasicNameValuePair(TradeInfo.SIGN, md5Sign)); return ParameterBuilder.getQueryUrl(params, baseUrl); }
Example 8
Project: letv File: PlayRecordApi.java View source code | 6 votes |
public String deletePlayTraces(int updataId, String pid, String vid, String uid, String idstr, String flush, String backdata, String sso_tk) { String baseUrl = UrlConstdata.getDynamicUrl(); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("mod", "minfo")); list.add(new BasicNameValuePair("ctl", "cloud")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "del")); list.add(new BasicNameValuePair("pid", pid)); list.add(new BasicNameValuePair("vid", vid)); list.add(new BasicNameValuePair("uid", uid)); list.add(new BasicNameValuePair("idstr", idstr)); list.add(new BasicNameValuePair("flush", flush)); list.add(new BasicNameValuePair("backdata", backdata)); list.add(new BasicNameValuePair("sso_tk", sso_tk)); list.add(new BasicNameValuePair("pcode", LetvHttpApiConfig.PCODE)); list.add(new BasicNameValuePair("version", LetvHttpApiConfig.VERSION)); return ParameterBuilder.getQueryUrl(list, baseUrl); }
Example 9
Project: Equella File: MyResourcesApiTest.java View source code | 6 votes |
private JsonNode doMyResourcesSearch(String query, String subsearch, Map<?, ?> otherParams, String token) throws Exception { List<NameValuePair> params = Lists.newArrayList(); if( query != null ) { params.add(new BasicNameValuePair("q", query)); } for( Entry<?, ?> entry : otherParams.entrySet() ) { params.add(new BasicNameValuePair(entry.getKey().toString(), entry.getValue().toString())); } // params.add(new BasicNameValuePair("token", // TokenSecurity.createSecureToken(username, "token", "token", null))); String paramString = URLEncodedUtils.format(params, "UTF-8"); HttpGet get = new HttpGet(context.getBaseUrl() + "api/search/myresources/" + subsearch + "?" + paramString); HttpResponse response = execute(get, false, token); return mapper.readTree(response.getEntity().getContent()); }
Example 10
Project: Higher-Cloud-Computing-Project File: ServerUtil.java View source code | 6 votes |
/** * send current ip to server */ private String ipSend() throws Exception { HttpClient ip_send = new DefaultHttpClient(); HttpPost post = new HttpPost(url + "/UploadIP"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("machine_id", String.valueOf(machine_id))); params.add(new BasicNameValuePair("ip", ip)); post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse httpResponse = ip_send.execute(post); if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { String result = null; HttpEntity httpEntity = httpResponse.getEntity(); if (httpEntity != null) { result = EntityUtils.toString(httpEntity); } JSONObject jsonObject = new JSONObject(result); int ip_save = jsonObject.getInt("ip_save"); if (ip_save == 1) { return "SUCCESS"; } else return "FAIL"; } return "401 UNAUTHORIZED"; }
Example 11
Project: letv File: PlayRecordApi.java View source code | 6 votes |
public String loginWeixin(int updataId, String accessToken, String openId, String plat, String equipType, String equipID, String softID, String pcode, String version) { String baseUrl = UrlConstdata.getDynamicUrl(); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("luamod", "main")); list.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); list.add(new BasicNameValuePair("ctl", "appssoweixin")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("access_token", accessToken)); list.add(new BasicNameValuePair("openid", openId)); list.add(new BasicNameValuePair(MODIFYPWD_PARAMETERS.PLAT_KEY, plat)); list.add(new BasicNameValuePair("equipID", equipID)); list.add(new BasicNameValuePair("softID", softID)); list.add(new BasicNameValuePair("pcode", pcode)); list.add(new BasicNameValuePair("version", version)); list.add(new BasicNameValuePair("imei", LetvUtils.getIMEI())); list.add(new BasicNameValuePair("mac", LetvUtils.getMacAddressForLogin())); return ParameterBuilder.getQueryUrl(list, baseUrl); }
Example 12
Project: letv File: LetvUrlMaker.java View source code | 6 votes |
public static String getAlbumByTimeUrl(String year, String month, String id, String videoType) { String head = getStaticHead() + "/mod/mob/ctl/videolistbydate/act/detail"; String end = LetvHttpApiConfig.getStaticEnd(); ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); params.add(new BasicNameValuePair("pcode", LetvUtils.getPcode())); if (!TextUtils.isEmpty(year)) { params.add(new BasicNameValuePair("year", year)); } if (!TextUtils.isEmpty(month)) { params.add(new BasicNameValuePair("month", month)); } params.add(new BasicNameValuePair("id", id)); if (!TextUtils.isEmpty(videoType)) { params.add(new BasicNameValuePair(PlayConstant.VIDEO_TYPE, videoType)); } return ParameterBuilder.getPathUrl(params, head, end); }
Example 13
Project: Higher-Cloud-Computing-Project File: ServerUtil.java View source code | 6 votes |
public static String resetPwd(int user_id, String pwd) throws Exception { HttpClient task_post = new DefaultHttpClient(); HttpPost post = new HttpPost(url + "/ResetPwd"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("user_id", String.valueOf(user_id))); params.add(new BasicNameValuePair("pwd", pwd)); post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = task_post.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { String result = null; HttpEntity httpEntity = response.getEntity(); if (httpEntity != null) { result = EntityUtils.toString(httpEntity); } JSONObject jsonObject = new JSONObject(result); int pwd_reset = jsonObject.getInt("pwd_reset"); if (pwd_reset == 1) return "SUCCESS"; else return "FAIL"; } return "401 UNAUTHORIZED"; }
Example 14
Project: boohee_v5.6 File: HTTPClient.java View source code | 6 votes |
public String PostConnect(String httpUrl, String str) { String resultData = ""; HttpPost httpPost = new HttpPost(httpUrl); List<NameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("data", str)); try { httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); HttpResponse httpResponse = new DefaultHttpClient().execute(httpPost); if (httpResponse.getStatusLine().getStatusCode() == 200) { resultData = EntityUtils.toString(httpResponse.getEntity()); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e2) { e2.printStackTrace(); } catch (IOException e3) { e3.printStackTrace(); } return resultData; }
Example 15
Project: letv File: LetvUrlMaker.java View source code | 6 votes |
public static String getAlbumByTimeUrl(String year, String month, String id, String videoType) { String head = getStaticHead() + "/mod/mob/ctl/videolistbydate/act/detail"; String end = LetvHttpApiConfig.getStaticEnd(); ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); params.add(new BasicNameValuePair("pcode", LetvUtils.getPcode())); if (!TextUtils.isEmpty(year)) { params.add(new BasicNameValuePair("year", year)); } if (!TextUtils.isEmpty(month)) { params.add(new BasicNameValuePair("month", month)); } params.add(new BasicNameValuePair("id", id)); if (!TextUtils.isEmpty(videoType)) { params.add(new BasicNameValuePair(PlayConstant.VIDEO_TYPE, videoType)); } return ParameterBuilder.getPathUrl(params, head, end); }
Example 16
Project: rest-client File: FormEncodedBody.java View source code | 6 votes |
private List<NameValuePair> getList(Map<String, List<Object>> parameters) { List<NameValuePair> result = new ArrayList<NameValuePair>(); if (parameters != null) { TreeMap<String, List<Object>> sortedParameters = new TreeMap<String, List<Object>>(parameters); for (Map.Entry<String, List<Object>> entry : sortedParameters.entrySet()) { List<Object> entryValue = entry.getValue(); if (entryValue != null) { for (Object cur : entryValue) { if (cur != null) { result.add(new BasicNameValuePair(entry.getKey(), cur.toString())); } } } } } return result; }
Example 17
Project: Huochexing12306 File: A6OrderAty.java View source code | 6 votes |
private List<OrderDBInfo> queryMyOrderNoComplete(BookingInfo bInfo) { String url = "https://kyfw.12306.cn/otn/queryOrder/queryMyOrderNoComplete"; List<NameValuePair> lstParams = new ArrayList<NameValuePair>(); lstParams.add(new BasicNameValuePair("_json_att", "")); try { A6Info a6Json = A6Util .post(bInfo, A6Util.makeRefererColl("https://kyfw.12306.cn/otn/queryOrder/initNoComplete"), url, lstParams); if ("".equals(a6Json.getData())) { return (new ArrayList<OrderDBInfo>()); } else { int index1 = a6Json.getData().indexOf("["); int index2 = a6Json.getData().lastIndexOf("]") + 1; String strOrderDBList = a6Json.getData().substring(index1, index2); List<OrderDBInfo> lstODBInfos = A6Util.getGson().fromJson( strOrderDBList, new TypeToken<List<OrderDBInfo>>() { }.getType()); return lstODBInfos; } } catch (Exception e) { e.printStackTrace(); } return null; }
Example 18
Project: Higher-Cloud-Computing-Project File: ServerUtil.java View source code | 6 votes |
public static String active(int user_id, String verification_code) throws Exception { HttpClient task_post = new DefaultHttpClient(); HttpPost post = new HttpPost(url + "/Active"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("user_id", String.valueOf(user_id))); params.add(new BasicNameValuePair("verification_code", verification_code)); post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = task_post.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { String result = null; HttpEntity httpEntity = response.getEntity(); if (httpEntity != null) { result = EntityUtils.toString(httpEntity); } JSONObject jsonObject = new JSONObject(result); int email_verification = jsonObject.getInt("email_verification"); if (email_verification == 1) return "SUCCESS"; else return "FAIL"; } return "401 UNAUTHORIZED"; }
Example 19
Project: android-advanced-light File: MainActivity.java View source code | 6 votes |
private void useHttpClientPost(String url) { HttpPost mHttpPost = new HttpPost(url); mHttpPost.addHeader("Connection", "Keep-Alive"); try { HttpClient mHttpClient = createHttpClient(); List<NameValuePair> postParams = new ArrayList<>(); //要传递的参数 postParams.add(new BasicNameValuePair("ip", "59.108.54.37")); mHttpPost.setEntity(new UrlEncodedFormEntity(postParams)); HttpResponse mHttpResponse = mHttpClient.execute(mHttpPost); HttpEntity mHttpEntity = mHttpResponse.getEntity(); int code = mHttpResponse.getStatusLine().getStatusCode(); if (null != mHttpEntity) { InputStream mInputStream = mHttpEntity.getContent(); String respose = converStreamToString(mInputStream); Log.d(TAG, "请求状态码:" + code + "\n请求结果:\n" + respose); mInputStream.close(); } } catch (IOException e) { e.printStackTrace(); } }
Example 20
Project: httpclient File: RestClient.java View source code | 6 votes |
@SuppressWarnings("unchecked") private HttpEntity createDataEntity(Object data) { try { if (data instanceof Map) { List<NameValuePair> params = new ArrayList<NameValuePair>(0); for (Entry<String, Object> entry : ((Map<String, Object>) data).entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString())); } return new UrlEncodedFormEntity(params, "UTF-8"); } else { return new StringEntity(data.toString(), "UTF-8"); } } catch (UnsupportedEncodingException e) { throw new RuntimeException("Unsupported encoding noticed. Error message: " + e.getMessage()); } }
Example 21
Project: letv File: PlayRecordApi.java View source code | 6 votes |
public String loginSina(int updataId, String accessToken, String openId, String plat, String equipType, String equipID, String softID, String pcode, String version) { String baseUrl = UrlConstdata.getDynamicUrl(); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("luamod", "main")); list.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); list.add(new BasicNameValuePair("ctl", "appssosina")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("access_token", accessToken)); list.add(new BasicNameValuePair("uid", openId)); list.add(new BasicNameValuePair(MODIFYPWD_PARAMETERS.PLAT_KEY, plat)); list.add(new BasicNameValuePair("equipType", equipType)); list.add(new BasicNameValuePair("equipID", equipID)); list.add(new BasicNameValuePair("pcode", pcode)); list.add(new BasicNameValuePair("softID", softID)); list.add(new BasicNameValuePair("version", version)); list.add(new BasicNameValuePair("imei", LetvUtils.getIMEI())); list.add(new BasicNameValuePair("mac", LetvUtils.getMacAddressForLogin())); return ParameterBuilder.getQueryUrl(list, baseUrl); }
Example 22
Project: elasticjob-oray-client File: HttpUtils.java View source code | 6 votes |
/** * post form * * @param host * @param path * @param method * @param headers * @param querys * @param bodys * @return * @throws Exception */ public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, Map<String, String> bodys) throws Exception { HttpClient httpClient = wrapClient(host); HttpPost request = new HttpPost(buildUrl(host, path, querys)); for (Map.Entry<String, String> e : headers.entrySet()) { request.addHeader(e.getKey(), e.getValue()); } if (bodys != null) { List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>(); for (String key : bodys.keySet()) { nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); } UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); request.setEntity(formEntity); } return httpClient.execute(request); }
Example 23
Project: letv File: PlayRecordApi.java View source code | 6 votes |
public String requestTicketUrl(int updataId, String userId, String days) { String baseUrl; if (PreferencesManager.getInstance().isTestApi() && LetvConfig.isForTest()) { baseUrl = "http://t.api.mob.app.letv.com/yuanxian/myTickets?"; } else { baseUrl = "http://api.mob.app.letv.com/yuanxian/myTickets?"; } List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("uid", userId)); list.add(new BasicNameValuePair("days", days)); list.add(new BasicNameValuePair("mac", LetvUtils.getMacAddress())); list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); Log.e("ZSM", "requestTicketUrl url == " + ParameterBuilder.getQueryUrl(list, baseUrl)); return ParameterBuilder.getQueryUrl(list, baseUrl); }
Example 24
Project: android-project-gallery File: RequestParams.java View source code | 6 votes |
protected List<BasicNameValuePair> getParamsList() { List<BasicNameValuePair> lparams = new LinkedList<BasicNameValuePair>(); for (ConcurrentHashMap.Entry<String, String> entry : urlParams.entrySet()) { lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } lparams.addAll(getParamsList(null, urlParamsWithObjects)); return lparams; }
Example 25
Project: Higher-Cloud-Computing-Project File: ServerUtil.java View source code | 6 votes |
public String update_online_time(int machine_id, int user_id, int delta) throws Exception { HttpClient task_post = new DefaultHttpClient(); HttpPost post = new HttpPost(url + "/update_online_time"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("machine_id", String.valueOf(machine_id))); params.add(new BasicNameValuePair("user_id", String.valueOf(user_id))); params.add(new BasicNameValuePair("delta", String.valueOf(delta))); post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = task_post.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { // 权限通过 return "AUTHORIZED"; } return "401 UNAUTHORIZED"; }
Example 26
Project: Huochexing12306 File: A6OrderAty.java View source code | 6 votes |
private boolean returnTicket(BookingInfo bInfo) { String url = "https://kyfw.12306.cn/otn/queryOrder/returnTicket"; List<NameValuePair> lstParams = new ArrayList<NameValuePair>(); lstParams.add(new BasicNameValuePair("_json_att", "")); try { String strHtml = bInfo .getHttpHelper() .post(A6Util .makeRefererColl("https://kyfw.12306.cn/otn/queryOrder/init"), url, lstParams); if (strHtml != null && strHtml.indexOf("退票成功") > 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; }
Example 27
Project: ts-benchmark File: InfluxDB2.java View source code | 6 votes |
private void createTestDB() { HttpClient hc = getHttpClient(); HttpPost post = new HttpPost(QUERY_URL); HttpResponse response = null; try { List<NameValuePair> nameValues = new ArrayList<NameValuePair>(); String createSql = "CREATE DATABASE " + DB_NAME; NameValuePair nameValue = new BasicNameValuePair("q", createSql); nameValues.add(nameValue); HttpEntity entity = new UrlEncodedFormEntity(nameValues, "utf-8"); post.setEntity(entity); response = hc.execute(post); closeHttpClient(hc); // System.out.println(response); } catch (Exception e) { e.printStackTrace(); }finally{ closeResponse(response); closeHttpClient(hc); } }
Example 28
Project: letv File: PayCenterApi.java View source code | 6 votes |
public String requestHongkongOrder(String productid, String pid, String price, String product_name, String product_desc, String merchant_business_id, String callBackUrl) { String head = getNormalDynamicUrl(); ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("mod", "iappay")); params.add(new BasicNameValuePair("ctl", "index")); params.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "orderId")); params.add(new BasicNameValuePair("productid", productid)); params.add(new BasicNameValuePair("username", PreferencesManager.getInstance().getUserName())); params.add(new BasicNameValuePair("pid", pid)); params.add(new BasicNameValuePair("uid", PreferencesManager.getInstance().getUserId())); params.add(new BasicNameValuePair("price", price)); params.add(new BasicNameValuePair("itemamt", price)); params.add(new BasicNameValuePair("product_name", product_name)); params.add(new BasicNameValuePair("product_desc", product_desc)); params.add(new BasicNameValuePair("merchant_business_id", merchant_business_id)); params.add(new BasicNameValuePair("my_order_type", "WAP")); params.add(new BasicNameValuePair("call_back_url", callBackUrl)); params.add(new BasicNameValuePair("channel_ids", "")); params.add(new BasicNameValuePair("companyurl", "")); params.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); params.add(new BasicNameValuePair("markid", "")); return ParameterBuilder.getQueryUrl(params, head); }
Example 29
Project: letv File: UserCenterApi.java View source code | 6 votes |
public String getSendChatBarrageMessage(String roomId, String message, String tk, boolean forhost, String tm, String color, String font, String position, String from) { String keyb = roomId + "," + tm + "," + LetvConstant.CHAT_KEY; ArrayList<BasicNameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("luamod", "main")); params.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); params.add(new BasicNameValuePair("ctl", "chatSendmessage")); params.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); params.add(new BasicNameValuePair("color", color)); params.add(new BasicNameValuePair("font", font)); params.add(new BasicNameValuePair("position", position)); params.add(new BasicNameValuePair("from", from)); params.add(new BasicNameValuePair("roomId", roomId)); params.add(new BasicNameValuePair("message", message)); params.add(new BasicNameValuePair("tm", tm)); params.add(new BasicNameValuePair("key", MD5.toMd5(keyb))); params.add(new BasicNameValuePair(MODIFYPWD_PARAMETERS.TK_KEY, tk)); params.add(new BasicNameValuePair("forhost", String.valueOf(forhost))); params.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); params.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); LogInfo.log("clf", "发送聊天消息getSendChatMessage..url=" + ParameterBuilder.getQueryUrl(params, getDynamicUrl())); return ParameterBuilder.getQueryUrl(params, getDynamicUrl()); }
Example 30
Project: RoadLab-Pro File: HockeySender.java View source code | 6 votes |
@Override public void send(CrashReportData report) throws ReportSenderException { String log = createCrashLog(report); String url = BASE_URL + ACRA.getConfig().formKey() + CRASHES_PATH; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("raw", log)); parameters.add(new BasicNameValuePair("userID", report.get(ReportField.INSTALLATION_ID))); parameters.add(new BasicNameValuePair("contact", report.get(ReportField.USER_EMAIL))); parameters.add(new BasicNameValuePair("description", report.get(ReportField.USER_COMMENT))); httpPost.setEntity(new UrlEncodedFormEntity(parameters, HTTP.UTF_8)); httpClient.execute(httpPost); } catch (Exception e) { e.printStackTrace(); } }
Example 31
Project: letv File: PlayRecordApi.java View source code | 5 votes |
public String requestGetverificationCode(int updataId, String key, String tm) { String requestUrl = UrlConstdata.getDynamicUrl(); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("luamod", "main")); list.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); list.add(new BasicNameValuePair("ctl", "getCaptcha")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("key", key)); list.add(new BasicNameValuePair("tm", tm)); list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); Log.e("ZSM", "requestGetverificationCode url == " + ParameterBuilder.getQueryUrl(list, requestUrl)); return ParameterBuilder.getQueryUrl(list, requestUrl); }
Example 32
Project: hack_sjtu_2017 File: HttpHandler.java View source code | 5 votes |
public void PostTask(String id, TextParser.EArticleType type, Score score) throws Exception { List<BasicNameValuePair> parameters = new ArrayList<>(); parameters.add(new BasicNameValuePair("type", Integer.toString(type.ordinal()))); parameters.add(new BasicNameValuePair("content_id", id)); System.out.println(score.ToJson(0).toString()); parameters.add(new BasicNameValuePair("score", score.ToJson(0).toString())); PostParam(postTaskURL, parameters); }
Example 33
Project: boohee_v5.6 File: AuthorizeApi.java View source code | 5 votes |
public static String doHttpGet(Context context, String path, long clientId, String accessToken) throws XMAuthericationException { List<NameValuePair> params = new ArrayList(); params.add(new BasicNameValuePair("clientId", String.valueOf(clientId))); params.add(new BasicNameValuePair("token", accessToken)); try { return Network.downloadXml(context, new URL(AuthorizeHelper.generateUrl(HTTP_PROTOCOL + HOST + path, params)), null, null, null, null); } catch (Throwable e) { throw new XMAuthericationException(e); } catch (Throwable e2) { throw new XMAuthericationException(e2); } }
Example 34
Project: pnc-repressurized File: PastebinHandler.java View source code | 5 votes |
public boolean loginInternal(String userName, String password) { HttpPost httppost = new HttpPost("http://pastebin.com/api/api_login.php"); List<NameValuePair> params = new ArrayList<NameValuePair>(3); params.add(new BasicNameValuePair("api_dev_key", DEV_KEY)); params.add(new BasicNameValuePair("api_user_name", userName)); params.add(new BasicNameValuePair("api_user_password", password)); try { httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); userKey = IOUtils.toString(instream, "UTF-8"); if (userKey.startsWith("Bad API request")) { Log.warning("User tried to log in into pastebin, it responded with the following: " + userKey); userKey = null; return false; } return true; } } catch (Exception e) { e.printStackTrace(); } return false; }
Example 35
Project: letv File: LetvUrlMaker.java View source code | 5 votes |
public static String getNetIPAddress() { String requestUrl = getDynamicHead(); List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("mod", HOME_RECOMMEND_PARAMETERS.MOD_VALUE)); list.add(new BasicNameValuePair("ctl", "ip")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); return ParameterBuilder.getQueryUrl(list, requestUrl); }
Example 36
Project: letv File: LetvUrlMaker.java View source code | 5 votes |
public static String getDialogMsgInfoUrl(String markId) { List<BasicNameValuePair> list = new ArrayList(); list.add(new BasicNameValuePair("mod", "minfo")); list.add(new BasicNameValuePair("ctl", "message")); list.add(new BasicNameValuePair(SocialConstants.PARAM_ACT, "index")); list.add(new BasicNameValuePair("markid", markId)); list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode())); list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName())); return ParameterBuilder.getPathUrl(list, getStaticHead(), UrlConstdata.getStaticEnd()); }
Example 37
Project: c4sg-services File: SlackUtils.java View source code | 5 votes |
public static HttpEntity createUrlEncodedFormEntity(Map<String, String> parameters) { List<NameValuePair> nvps = new ArrayList<NameValuePair>(parameters.size()); for (Entry<String, String> entry : parameters.entrySet()) { nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } return new UrlEncodedFormEntity(nvps, Charset.forName("UTF-8")); }
Example 38
Project: Tenable.io-SDK-for-Java File: AgentsApiClientTest.java View source code | 5 votes |
private List<Agent> filteredRequest( String field, String op, String value ) throws Exception { List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add( new BasicNameValuePair("limit", limit ) ); params.add( new BasicNameValuePair("f", field + ":" + op + ":" + value ) ); return apiClient.getAgentsApi().list( params ); }
Example 39
Project: DiscordDevRant File: DevRant.java View source code | 5 votes |
private <T> List<T> getFeed(String url, Function<JsonObject, T> converter, Sort sort, int limit, int skip) { return getFeed(url, converter, new BasicNameValuePair("sort", sort.toString()), new BasicNameValuePair("limit", String.valueOf(limit)), new BasicNameValuePair("skip", String.valueOf(skip)), sort.getParameter() ); }
Example 40
Project: letv File: MediaAssetApi.java View source code | 5 votes |
public String getStarFollowStatusUrl(String starIds) { String baseUrl = getCombineHead() + "follow/followchecklist"; List<BasicNameValuePair> list = new ArrayList(); setCommonParams(list); list.add(new BasicNameValuePair("followid", starIds)); list.add(new BasicNameValuePair("type", "star")); LogInfo.log("clf", "获取是否关注明星 url=" + ParameterBuilder.getQueryUrl(list, baseUrl)); return ParameterBuilder.getQueryUrl(list, baseUrl); }