com.nycjv321.http.HttpQueryParameterBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simple-http-client Show documentation
Show all versions of simple-http-client Show documentation
A simple wrapper of Apache's Http Client Library that tries to
make interacting with HTTP Easy
The newest version!
package com.nycjv321.http;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* Created by fedora on 11/21/15.
*/
public class HttpQueryParameterBuilder {
public static String build(Map parameters) {
if (parameters.isEmpty()) {
return "";
}
Set strings = parameters.keySet();
String parametersString = "?";
for (Iterator iterator = strings.iterator(); iterator.hasNext(); ) {
String string = iterator.next();
parametersString = parametersString + string + "=" + parameters.get(string);
if (iterator.hasNext()) {
parametersString = parametersString + "&";
}
}
return parametersString;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy