List of usage examples for org.apache.http.message BasicNameValuePair BasicNameValuePair
public BasicNameValuePair(String str, String str2)
From source file:eu.over9000.cathode.data.parameters.StreamTypeOption.java
@Override public List<NameValuePair> buildParamPairs() { if (streamType == null) { return Collections.emptyList(); }//from w w w . j a va 2 s .com return Collections.singletonList(new BasicNameValuePair("stream_type", streamType.name())); }
From source file:com.irontec.fragments.EzarpenakFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);//from ww w . ja v a2 s. com mContext = getActivity().getBaseContext(); View rootView = inflater.inflate(R.layout.fragment_ezarpenak, container, false); mViewSwitcher = (ViewSwitcher) rootView.findViewById(R.id.viewSwitcher1); mEzarpenZerrenda = (ListView) rootView.findViewById(R.id.ezarpenak_list); mItems = new ArrayList<BasicNameValuePair>(); BasicNameValuePair item1 = new BasicNameValuePair("Saioa itxi", ""); BasicNameValuePair item2 = new BasicNameValuePair("Sare sozialak", "Zure sare sozialak kudeatu"); BasicNameValuePair item3 = new BasicNameValuePair("Lizentziak", "Erabilitako baliabideak"); BasicNameValuePair item4 = new BasicNameValuePair("Honi buruz", ""); mItems.add(item1); mItems.add(item2); mItems.add(item3); mItems.add(item4); mEzarpenZerrenda.setAdapter(new SimpleLicenseAdapter(mContext, mItems)); mEzarpenZerrenda.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { Intent intent = null; if (position == 0) { MintzatuAPI.logout(mContext); intent = new Intent(getActivity().getBaseContext(), LoginCircles.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); if (getActivity() != null) { getActivity().finish(); } } else if (position == 3) { intent = new Intent(mContext, HoniBuruzActivity.class); } else { intent = new Intent(mContext, EzarpenakDetailActivity.class); } switch (position) { case 1: intent.putExtra("detail_type", 0); break; case 2: intent.putExtra("detail_type", 1); break; default: break; } if (intent != null) { startActivity(intent); } } }); mViewSwitcher.showNext(); return rootView; }
From source file:fr.qinder.api.APIRequest.java
public void addPost(String key, String value) { posts.add(new BasicNameValuePair(key, value)); }
From source file:ai.eve.volley.stack.HttpClientStack.java
@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))); }/*from w w w. j av a 2s.c o m*/ return result; }
From source file:org.wso2.carbon.governance.registry.extensions.utils.APIUtils.java
/** * This method will authenticate the user name and password mentioned in life cycle against APIM. * * @param httpContext// www. ja v a 2s . co m * @param apimEndpoint * @param apimUsername * @param apimPassword */ public static void authenticateAPIM(HttpContext httpContext, String apimEndpoint, String apimUsername, String apimPassword) throws GovernanceException { String loginEP = apimEndpoint + Constants.APIM_LOGIN_ENDPOINT; try { // create a post request to addAPI. HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(loginEP); // Request parameters and other properties. List<NameValuePair> params = new ArrayList<NameValuePair>(Constants.APIM_PARAMETER_COUNT); params.add(new BasicNameValuePair(API_ACTION, API_LOGIN_ACTION)); params.add(new BasicNameValuePair(API_USERNAME, apimUsername)); params.add(new BasicNameValuePair(API_PASSWORD, apimPassword)); httppost.setEntity(new UrlEncodedFormEntity(params, Constants.UTF_8_ENCODE)); HttpResponse response = httpclient.execute(httppost, httpContext); HttpEntity entity = response.getEntity(); String responseString = EntityUtils.toString(entity, Constants.UTF_8_ENCODE); if (response.getStatusLine().getStatusCode() != Constants.SUCCESS_RESPONSE_CODE) { throw new RegistryException(" Authentication with APIM failed: HTTP error code : " + response.getStatusLine().getStatusCode()); } Gson gson = new Gson(); ResponseAPIM responseAPIM = gson.fromJson(responseString, ResponseAPIM.class); if (responseAPIM.getError().equalsIgnoreCase("true")) { throw new GovernanceException( "Error occurred in validating the user. Please check the credentials"); } } catch (Exception e) { throw new GovernanceException("Authentication failed with API Manager. Please check the credentials", e); } }
From source file:com.ratebeer.android.api.command.SendBeerMailCommand.java
@Override protected void makeRequest(ApiConnection apiConnection) throws ApiException { ApiConnection.ensureLogin(apiConnection, getUserSettings()); apiConnection.post("http://www.ratebeer.com/savemessage/", Arrays.asList(new BasicNameValuePair("nSource", Integer.toString(getUserSettings().getUserID())), new BasicNameValuePair("Referrer", "http://www.ratebeer.com/user/messages/0/"), new BasicNameValuePair("UserName", "0"), new BasicNameValuePair("RecipientName", sendTo), new BasicNameValuePair("Subject", subject), new BasicNameValuePair("Body", body)), HttpURLConnection.HTTP_MOVED_TEMP); }
From source file:com.survivingwithandroid.jsontutorial.HttpClient.java
public String postJsonData(String data) { try {/*from ww w. ja va 2s .c o m*/ StringBuffer buffer = new StringBuffer(); // Apache HTTP Reqeust System.out.println("Sending data.."); System.out.println("Data: [" + data + "]"); org.apache.http.client.HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(URL); List<NameValuePair> nvList = new ArrayList<NameValuePair>(); BasicNameValuePair bnvp = new BasicNameValuePair("json", data); // We can add more nvList.add(bnvp); post.setEntity(new UrlEncodedFormEntity(nvList)); HttpResponse resp = client.execute(post); // We read the response InputStream is = resp.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder str = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { str.append(line + "\n"); } is.close(); buffer.append(str.toString()); // Done! return buffer.toString(); } catch (Throwable t) { t.printStackTrace(); } return null; }
From source file:com.ratebeer.android.api.command.SendBeerReplyCommand.java
@Override protected void makeRequest(ApiConnection apiConnection) throws ApiException { ApiConnection.ensureLogin(apiConnection, getUserSettings()); apiConnection.post("http://www.ratebeer.com/SaveReply.asp", Arrays.asList(new BasicNameValuePair("MessID", Integer.toString(replyTo)), new BasicNameValuePair("Referrer", "/showmessage_new.asp?messageID=" + replyTo), new BasicNameValuePair("UserID", Integer.toString(recipient)), new BasicNameValuePair("Body", body)), HttpURLConnection.HTTP_MOVED_TEMP); }
From source file:co.appvigil.requestHandler.AccessTokenRequest.java
private List<NameValuePair> getParams(String[] requestString) { int i;// ww w . j av a2 s.c o m List<NameValuePair> params = new ArrayList<NameValuePair>(); for (i = 0; i < requestString.length; i++) { params.add(new BasicNameValuePair(requestString[i].split("=")[0], requestString[i].split("=")[1])); } return params; }
From source file:com.foobnix.vkontakte.VkApi.java
@Override public void setToken(String token) { requestHelper.setDefaultParam(new BasicNameValuePair("access_token", token)); }