本文整理了Java中com.mashape.unirest.request.HttpRequest.getUrl()
方法的一些代码示例,展示了HttpRequest.getUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getUrl()
方法的具体详情如下:
包路径:com.mashape.unirest.request.HttpRequest
类名称:HttpRequest
方法名:getUrl
暂无
代码示例来源:origin: Kong/unirest-java
URL url = new URL(request.getUrl());
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), URLDecoder.decode(url.getPath(), "UTF-8"), "", url.getRef());
urlToRequest = uri.toURL().toString();
代码示例来源:origin: vulnersCom/burp-vulners-scanner
.queryString("type", software.getMatchType());
callbacks.printOutput("[Vulners] start check for domain " + domainName + " for software " + software.getName() + "/" + software.getVersion() + " : " + request.getUrl());
代码示例来源:origin: com.infotel.seleniumRobot/core
protected JSONArray getJSonArray(BaseRequest request) throws UnirestException {
HttpResponse<String> response = request.asString();
if (response.getStatus() == 423) {
String error = new JSONObject(response.getBody()).getString("detail");
throw new SeleniumRobotServerException(error);
}
if (response.getStatus() >= 400) {
try {
String error = new JSONObject(response.getBody()).getString("detail");
throw new SeleniumRobotServerException(String.format("request to %s failed: %s", request.getHttpRequest().getUrl(), error));
} catch (Exception e) {
throw new UnirestException(String.format("request to %s failed: %s", request.getHttpRequest().getUrl(), response.getStatusText()));
}
}
if (response.getStatus() == 204) {
return new JSONArray();
}
return new JSONArray(response.getBody());
}
代码示例来源:origin: com.infotel.seleniumRobot/core
protected JSONObject getJSonResponse(BaseRequest request) throws UnirestException {
HttpResponse<String> response = request.asString();
if (response.getStatus() == 423) {
String error = new JSONObject(response.getBody()).getString("detail");
throw new SeleniumRobotServerException(error);
}
if (response.getStatus() >= 400) {
try {
String error = new JSONObject(response.getBody()).getString("detail");
throw new SeleniumRobotServerException(String.format("request to %s failed: %s", request.getHttpRequest().getUrl(), error));
} catch (Exception e) {
throw new UnirestException(String.format("request to %s failed: %s", request.getHttpRequest().getUrl(), response.getStatusText()));
}
}
if (response.getStatus() == 204) {
return new JSONObject();
}
return new JSONObject(response.getBody());
}
代码示例来源:origin: com.github.bingoohuang/blackcat-instrument
public static void prepareRPC(HttpRequest httpRequest) {
val context = threadLocal.get();
if (context == null) return;
val httpMethod = httpRequest.getHttpMethod().name();
trace("RPC", httpMethod + ":" + httpRequest.getUrl());
httpRequest.header(BLACKCAT_TRACEID, context.getTraceId());
val linkId = context.getParentLinkId() + String.format(".%06d", context.getSubLinkId());
httpRequest.header(BLACKCAT_LINKID, linkId);
}
代码示例来源:origin: com.mashape.unirest/unirest-java
URL url = new URL(request.getUrl());
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), URLDecoder.decode(url.getPath(), "UTF-8"), "", url.getRef());
urlToRequest = uri.toURL().toString();
代码示例来源:origin: com.github.bingoohuang/unirest-java
URL url = new URL(request.getUrl());
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), URLDecoder.decode(url.getPath(), "UTF-8"), "", url.getRef());
urlToRequest = uri.toURL().toString();
代码示例来源:origin: net.dv8tion/JDA
private JSONObject toObject(BaseRequest request)
{
try
{
if (api.isDebug())
{
System.out.printf("Requesting %s -> %s\n\tPayload: %s\n\tResponse: ", request.getHttpRequest().getHttpMethod().name(), request.getHttpRequest().getUrl(), ((request instanceof RequestBodyEntity)? ((RequestBodyEntity) request).getBody().toString():"None"));
}
String body = request.asString().getBody();
if (api.isDebug())
{
System.out.println(body);
}
return body == null ? null : new JSONObject(body);
}
catch (UnirestException e)
{
e.printStackTrace();
}
return null;
}
代码示例来源:origin: gradle.plugin.GoBqa/gradle-plugin
response = getRequestNoBody.asString();
}catch (Exception ex){
track.fail("Getrequest:Error during call Api Rest op from URL::"+getRequestNoBody.getUrl() +"' \n" + ex.getMessage());
代码示例来源:origin: net.dv8tion/JDA
private JSONArray toArray(BaseRequest request)
{
try
{
if (api.isDebug())
{
System.out.printf("Requesting %s -> %s\n\tPayload: %s\n\tResponse: ", request.getHttpRequest().getHttpMethod().name(), request.getHttpRequest().getUrl(), ((request instanceof RequestBodyEntity)? ((RequestBodyEntity) request).getBody().toString():"None"));
}
String body = request.asString().getBody();
if (api.isDebug())
{
System.out.println(body);
}
return body == null ? null : new JSONArray(body);
}
catch (UnirestException e)
{
e.printStackTrace();
}
return null;
}
代码示例来源:origin: gradle.plugin.GoBqa/gradle-plugin
response = postRequestNoBody.asString();
} catch (Exception ex) {
track.fail("Postrequest:Error during call Api Rest op from URL::" + postRequestNoBody.getUrl() + "' \n" + ex.getMessage());
内容来源于网络,如有侵权,请联系作者删除!