List of usage examples for org.apache.http.message BasicNameValuePair BasicNameValuePair
public BasicNameValuePair(String str, String str2)
From source file:net.bither.api.BitherErrorApi.java
@Override public HttpEntity getHttpEntity() throws Exception { List<NameValuePair> params = new ArrayList<NameValuePair>(); if (!Utils.isEmpty(this.mErrorMsg)) { params.add(new BasicNameValuePair(ERROR_MSG, this.mErrorMsg.trim())); }/*from w ww. j ava 2s .com*/ return new UrlEncodedFormEntity(params, HTTP.UTF_8); }
From source file:org.addhen.smssync.tests.util.DataFormatUtilTest.java
@Override public void setUp() throws Exception { super.setUp(); pairs = new ArrayList<NameValuePair>(); pairs.add(new BasicNameValuePair("a", "b")); pairs.add(new BasicNameValuePair("c", "d")); }
From source file:jp.co.conit.sss.sn.ex2.util.SNApiUtil.java
/** * SamuraiNotification?devicesAPI???/*from ww w . j av a2s . com*/ * * @param snParam * @return */ public static SNServerResult devices(SNParam snParam) { SNServerResult result = new SNServerResult(); String url = SN_DOMAIN + SN_DEVICES; List<NameValuePair> postData = new ArrayList<NameValuePair>(); if (!StringUtil.isEmpty(snParam.getLang())) { postData.add(new BasicNameValuePair("lang", snParam.getLang())); } if (!StringUtil.isEmpty(snParam.getTags())) { postData.add(new BasicNameValuePair("tags", snParam.getTags())); } if (!StringUtil.isEmpty(snParam.getMid())) { postData.add(new BasicNameValuePair("mid", snParam.getMid())); } postData.add(new BasicNameValuePair("token", snParam.getToken())); postData.add(new BasicNameValuePair("device_token", snParam.getDeviceToken())); return post(url, postData, result); }
From source file:org.opencastproject.remotetest.server.resource.CaptureResources.java
public static HttpResponse stopCapturePost(TrustedHttpClient client, String id) throws Exception { HttpPost post = new HttpPost(getServiceUrl() + "stopCapture"); List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); params.add(new BasicNameValuePair("recordingID", id)); post.setEntity(new UrlEncodedFormEntity(params)); return client.execute(post); }
From source file:net.reichholf.dreamdroid.intents.IntentFactory.java
public static Intent getStreamFileIntent(String fileName, String title) { Intent intent = new Intent(Intent.ACTION_VIEW); SimpleHttpClient shc = SimpleHttpClient.getInstance(); ArrayList<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("file", fileName)); Uri uri = Uri.parse(shc.buildFileStreamUrl(URIStore.FILE, params)); Log.i(DreamDroid.LOG_TAG, "Streaming file: " + uri.getEncodedQuery()); intent.setDataAndType(uri, "video/*"); intent.putExtra("title", title); return intent; }
From source file:cn.xdf.thinkutils.db2.entity.ArrayListEx.java
/** * ?//from w w w .j a v a2s . c o m * * @param key * @param value * @return */ public boolean add(String key, String value) { return add(new BasicNameValuePair(key, value)); }
From source file:org.apache.sling.testing.clients.util.URLParameterBuilder.java
public URLParameterBuilder add(String name, String value) { params.add(new BasicNameValuePair(name, value)); return this; }
From source file:com.arrow.acs.client.search.SearchCriteria.java
public List<NameValuePair> getAllCriteria() { List<NameValuePair> pairs = new ArrayList<>(); for (Entry<String, String> entry : simpleCriteria.entrySet()) { String value = entry.getValue(); if (!value.isEmpty()) { pairs.add(new BasicNameValuePair(entry.getKey(), value)); }/*from w w w.j ava2 s . co m*/ } for (Entry<String, String[]> entry : arrayCriteria.entrySet()) { String name = entry.getKey(); for (String value : entry.getValue()) { if (!value.isEmpty()) { pairs.add(new BasicNameValuePair(name, value)); } } } return pairs; }
From source file:com.grinnellplans.plandroid.LoginTask.java
protected String doInBackground(String... params) { Log.i("LoginTask::doInBackground", "entered"); AndroidHttpClient plansClient = AndroidHttpClient.newInstance("plandroid"); final HttpPost req = new HttpPost("http://" + _ss.get_serverName() + "/api/1/index.php?task=login"); List<NameValuePair> postParams = new ArrayList<NameValuePair>(2); postParams.add(new BasicNameValuePair("username", params[0])); postParams.add(new BasicNameValuePair("password", params[1])); Log.i("LoginTask::doInBackground", "setting postParams"); String resp = null;//from w ww . j av a 2 s. c o m try { req.setEntity(new UrlEncodedFormEntity(postParams)); HttpResponse response = null; Log.i("LoginTask::doInBackground", "executing request"); response = plansClient.execute(req, _httpContext); Log.i("LoginTask::doInBackground", "reading response"); resp = new BufferedReader((new InputStreamReader(response.getEntity().getContent()))).readLine(); } catch (Exception e) { resp = constructResponse(e); } plansClient.close(); Log.i("LoginTask::doInBackground", "server responded \"" + resp + "\""); Log.i("LoginTask::doInBackground", "exit"); return resp; }