use of org.apache.http.client.utils.URIBuilder in project wechat-mp-sdk by usc.
the class QRcodeUtil method bulidQRcodeImgUrl.
public static String bulidQRcodeImgUrl(String ticket) {
if (StringUtils.isEmpty(ticket)) {
return StringUtils.EMPTY;
}
String url = WechatRequest.SHOW_QRCODE.getUrl();
try {
URI uri = new URIBuilder(url).setParameter("ticket", ticket).build();
log.info("build qrcode img url: url={}", uri);
return uri.toString();
} catch (Exception e) {
String msg = "build qrcode img url failed: url=" + url + "?ticket=" + ticket;
log.error(msg, e);
return StringUtils.EMPTY;
}
}
use of org.apache.http.client.utils.URIBuilder in project intellij-community by JetBrains.
the class PluginDownloader method getUrl.
@NotNull
private static String getUrl(@NotNull IdeaPluginDescriptor descriptor, @Nullable String host, @Nullable BuildNumber buildNumber) throws URISyntaxException, MalformedURLException {
if (host != null && descriptor instanceof PluginNode) {
String url = ((PluginNode) descriptor).getDownloadUrl();
return new URI(url).isAbsolute() ? url : new URL(new URL(host), url).toExternalForm();
} else {
Application app = ApplicationManager.getApplication();
ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
String buildNumberAsString = buildNumber != null ? buildNumber.asString() : app != null ? ApplicationInfo.getInstance().getApiVersion() : appInfo.getBuild().asString();
URIBuilder uriBuilder = new URIBuilder(appInfo.getPluginsDownloadUrl());
uriBuilder.addParameter("action", "download");
uriBuilder.addParameter("id", descriptor.getPluginId().getIdString());
uriBuilder.addParameter("build", buildNumberAsString);
uriBuilder.addParameter("uuid", PermanentInstallationID.get());
return uriBuilder.build().toString();
}
}
use of org.apache.http.client.utils.URIBuilder in project oxAuth by GluuFederation.
the class ToopherAPI method get.
private JSONObject get(String endpoint) throws Exception {
URI uri = new URIBuilder().setScheme(URI_SCHEME).setHost(URI_HOST).setPath(URI_BASE + endpoint).build();
HttpGet get = new HttpGet(uri);
consumer.sign(get);
return httpClient.execute(get, jsonHandler);
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class AstrophysicsDataSystem method getURLForEntry.
@Override
public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException {
URIBuilder uriBuilder = getBaseUrl(API_ENTRY_URL);
// Search astronomy + physics + arXiv db
uriBuilder.addParameter("db_key", "AST");
uriBuilder.addParameter("db_key", "PHY");
uriBuilder.addParameter("db_key", "PRE");
// Add title search
entry.getFieldOrAlias(FieldName.TITLE).ifPresent(title -> {
uriBuilder.addParameter("ttl_logic", "OR");
uriBuilder.addParameter("title", title);
uriBuilder.addParameter("ttl_syn", "YES");
uriBuilder.addParameter("ttl_wt", "0.3");
uriBuilder.addParameter("ttl_wgt", "YES");
});
// Add author search
entry.getFieldOrAlias(FieldName.AUTHOR).ifPresent(author -> {
uriBuilder.addParameter("aut_logic", "OR");
uriBuilder.addParameter("author", author);
uriBuilder.addParameter("aut_syn", "YES");
uriBuilder.addParameter("aut_wt", "1.0");
uriBuilder.addParameter("aut_wgt", "YES");
});
return uriBuilder.build().toURL();
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class AstrophysicsDataSystem method getBaseUrl.
private URIBuilder getBaseUrl(String apiUrl) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder(apiUrl);
uriBuilder.addParameter("data_type", "BIBTEXPLUS");
uriBuilder.addParameter("start_nr", String.valueOf(1));
uriBuilder.addParameter("nr_to_return", String.valueOf(200));
return uriBuilder;
}
Aggregations