Tabnine Logo
NameValuePair.setValue
Code IndexAdd Tabnine to your IDE (free)

How to use
setValue
method
in
org.apache.commons.httpclient.NameValuePair

Best Java code snippets using org.apache.commons.httpclient.NameValuePair.setValue (Showing top 10 results out of 315)

origin: eclipse/winery

private static NameValuePair[] createNameValuePairArrayFromQuery(String query) {
  // example:
  // csarID=Moodle.csar&serviceTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}Moodle&nodeTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}VmApache
  System.out.println("Splitting query: " + query);
  String[] pairs = query.trim().split("&");
  NameValuePair[] nameValuePairArray = new NameValuePair[pairs.length];
  int count = 0;
  for (String pair : pairs) {
    System.out.println("Splitting query pair: " + pair);
    String[] keyValue = pair.split("=");
    NameValuePair nameValuePair = new NameValuePair();
    System.out.println("Key: " + keyValue[0] + " Value: " + keyValue[1]);
    nameValuePair.setName(keyValue[0]);
    nameValuePair.setValue(keyValue[1]);
    nameValuePairArray[count] = nameValuePair;
    count++;
  }
  return nameValuePairArray;
}
origin: itisaid/Doris

public String requst(Map<String, String> paramMap) {
  List<NameValuePair> paras = new ArrayList<NameValuePair>();
  for (Map.Entry<String, String> entry : paramMap.entrySet()) {
    NameValuePair para = new NameValuePair();
    para.setName(entry.getKey());
    para.setValue(entry.getValue());
    paras.add(para);
  }
  
  String result = null;
  NameValuePair[] parasArray = paras.toArray(new NameValuePair[] {});
  try {
    result = this.mainAdminFetcher.fetch(parasArray);
  } catch (AdminConnectionException e) {
    try {
      result = this.backupAdminFetcher.fetch(parasArray);
    } catch (Exception e1) {
      // Swallow all exception
      logger.error("Cannot acess both main admin server and back admin server.", e1);
    }
  }
  return result;
}
origin: stackoverflow.com

 public static void main(String[] args) {

  Person person = new Person("Ali", "a@c.o");
  try {
    System.out.println(getObjectNameValuePairs(person));

  } catch (IllegalArgumentException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }

}

public static ArrayList<NameValuePair> getObjectNameValuePairs(Object obj) throws IllegalArgumentException, IllegalAccessException {
  ArrayList<NameValuePair> list = new ArrayList<NameValuePair>();
  for (Field field : obj.getClass().getDeclaredFields()) {
    field.setAccessible(true); // if you want to modify private fields
    NameValuePair nameValuePair = new NameValuePair();
    nameValuePair.setName(field.getName());
    nameValuePair.setValue(field.get(obj));
    list.add(nameValuePair);
  }
  return list;
}
origin: qq53182347/liugh-parent

NameValuePair params1 = new NameValuePair();
params1.setName("client_id");
params1.setValue(ResourcesConfig.THIRDPARTY.getString("app_id_sina"));
list.add(params1);
NameValuePair params2 = new NameValuePair();
params2.setName("client_secret");
params2.setValue(ResourcesConfig.THIRDPARTY.getString("app_key_sina"));
list.add(params2);
NameValuePair params3 = new NameValuePair();
params3.setName("grant_type");
params3.setValue("authorization_code");
list.add(params3);
NameValuePair params4 = new NameValuePair();
params4.setName("redirect_uri");
params4.setValue("http://" + host + ResourcesConfig.THIRDPARTY.getString("redirect_url_sina"));
list.add(params4);
NameValuePair params5 = new NameValuePair();
params5.setName("code");
params5.setValue(code);
list.add(params5);
String tokenRes = HttpUtil.post(tokenUrl, list);
origin: youngMen1/JAVA-

NameValuePair params1 = new NameValuePair();
params1.setName("client_id");
params1.setValue(Resources.THIRDPARTY.getString("app_id_sina"));
list.add(params1);
NameValuePair params2 = new NameValuePair();
params2.setName("client_secret");
params2.setValue(Resources.THIRDPARTY.getString("app_key_sina"));
list.add(params2);
NameValuePair params3 = new NameValuePair();
params3.setName("grant_type");
params3.setValue("authorization_code");
list.add(params3);
NameValuePair params4 = new NameValuePair();
params4.setName("redirect_uri");
params4.setValue("http://" + host + Resources.THIRDPARTY.getString("redirect_url_sina"));
list.add(params4);
NameValuePair params5 = new NameValuePair();
params5.setName("code");
params5.setValue(code);
list.add(params5);
String tokenRes = HttpUtil.httpClientPost(tokenUrl, list);
origin: com.lodsve/lodsve-web

/**
 * 发送一个post请求
 *
 * @param url    地址
 * @param params 参数
 * @return 返回结果
 * @throws java.io.IOException
 */
public static String post(String url, Map<String, String> params) throws IOException {
  PostMethod method = new PostMethod(url);
  method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, DEFAULT_CHARSET);
  method.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, DEFAULT_TIMEOUT);
  if (MapUtils.isNotEmpty(params)) {
    List<NameValuePair> pairs = new ArrayList<>(params.size());
    for (Map.Entry<String, String> entry : params.entrySet()) {
      NameValuePair pair = new NameValuePair();
      pair.setName(entry.getKey());
      pair.setValue(entry.getValue());
      pairs.add(pair);
    }
    method.addParameters(pairs.toArray(new NameValuePair[pairs.size()]));
  }
  return executeMethod(method);
}
origin: org.jvnet.hudson.main/hudson-test-harness

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = { new NameValuePair() };
  
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null ));
  
  req.setRequestParameters(Arrays.asList( crumb ));
  return req;
}

origin: org.eclipse.hudson/hudson-test-framework

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = {new NameValuePair()};
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb(null));
  req.setRequestParameters(Arrays.asList(crumb));
  return req;
}
origin: org.jvnet.hudson.main/hudson-test-framework

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = { new NameValuePair() };
  
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null ));
  
  req.setRequestParameters(Arrays.asList( crumb ));
  return req;
}

origin: net.sf.delicious-java/delicious

replaceParam.setValue(DeliciousConstants.NO);
if (replace) {
  replaceParam.setValue(DeliciousConstants.YES);
  post.addParameter(replaceParam);
  NameValuePair sharedParam = new NameValuePair();
  sharedParam.setName(DeliciousConstants.SHARED_PARAMETER);
  sharedParam.setValue(DeliciousConstants.NO);
  post.addParameter(sharedParam);
org.apache.commons.httpclientNameValuePairsetValue

Javadoc

Set the value.

Popular methods of NameValuePair

  • <init>
    Constructor.
  • getValue
    Return the current value.
  • getName
    Return the name.
  • setName
    Set the name.
  • toString
    Get a String representation of this pair.

Popular in Java

  • Finding current android device location
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Path (java.nio.file)
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JPanel (javax.swing)
  • JTable (javax.swing)
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now