org.apache.http.client.fluent.Response.returnContent()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.apache.http.client.fluent.Response.returnContent方法的一些代码示例,展示了Response.returnContent的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.returnContent方法的具体详情如下:
包路径:org.apache.http.client.fluent.Response
类名称:Response
方法名:returnContent

Response.returnContent介绍

暂无

代码示例

代码示例来源:origin: twosigma/beakerx

@Override
public String update(String name, String json) {
 try {
  String reply = Request.Post(LOCALHOST + this.context.getPort() + AUTOTRANSLTION)
      .addHeader(AUTHORIZATION, auth())
      .bodyString(createBody(name, json), ContentType.APPLICATION_JSON)
      .execute().returnContent().asString();
  if (!reply.equals("ok")) {
   throw new RuntimeException(reply);
  }
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
 return json;
}

代码示例来源:origin: twosigma/beakerx

private Map getResult(LinkedList<String> parts, String last) throws IOException {
 String uri = getUrl(parts, last);
 String valueString = Request
     .Get(uri)
     .execute()
     .returnContent()
     .asString();
 return fromJson(valueString);
}

代码示例来源:origin: dreamhead/moco

public String executeAsString(final Request request) throws IOException {
  return executor.execute(request).returnContent().asString();
}

代码示例来源:origin: twosigma/beakerx

@Override
public String get(String name) {
 String valueString = "";
 try {
  valueString = Request
      .Get(LOCALHOST + this.context.getPort() + AUTOTRANSLTION + this.context.getContextId() + "/" + name)
      .addHeader(AUTHORIZATION, auth())
      .execute()
      .returnContent()
      .asString();
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return valueString;
}

代码示例来源:origin: org.streampipes/streampipes-pipeline-management

private PipelineElementStatus handleResponse(Response httpResp) throws JsonSyntaxException, ClientProtocolException, IOException {
 String resp = httpResp.returnContent().asString();
 org.streampipes.model.Response streamPipesResp = new Gson().fromJson(resp, org.streampipes.model.Response.class);
 return convert(streamPipesResp);
}

代码示例来源:origin: org.streampipes/streampipes-pipeline-management

private EventSchema handleResponse(Response httpResp) throws JsonSyntaxException, IOException {
  String resp = httpResp.returnContent().asString();
  EventSchema outputSchema = GsonSerializer
      .getGsonWithIds()
      .fromJson(resp, EventSchema.class);

  return outputSchema;
 }
}

代码示例来源:origin: com.github.lookout/metrics-datadog

public static String getEc2InstanceId() throws IOException {
  try {
   return Request.Get(url).execute().returnContent().asString();
  } catch (Throwable t) {
   throw new IOException(t);
  }
 }
}

代码示例来源:origin: org.coursera/metrics-datadog

public static String getEc2InstanceId() throws IOException {
  try {
   return Request.Get(url).execute().returnContent().asString();
  } catch (Throwable t) {
   throw new IOException(t);
  }
 }
}

代码示例来源:origin: streampipes/streampipes-ce

private List<Option> handleResponse(Response httpResp) throws JsonSyntaxException, IOException {
 String resp = httpResp.returnContent().asString();
 RuntimeOptionsResponse response = GsonSerializer
     .getGsonWithIds()
     .fromJson(resp, RuntimeOptionsResponse.class);
 return response
     .getOptions()
     .stream()
     .map(o -> new Option(o.getLabel(), o.getAdditionalPayload()))
     .collect(Collectors.toList());
}

代码示例来源:origin: org.streampipes/streampipes-pipeline-management

private List<Option> handleResponse(Response httpResp) throws JsonSyntaxException, IOException {
 String resp = httpResp.returnContent().asString();
 RuntimeOptionsResponse response = GsonSerializer
     .getGsonWithIds()
     .fromJson(resp, RuntimeOptionsResponse.class);
 return response
     .getOptions()
     .stream()
     .map(o -> new Option(o.getLabel(), o.getAdditionalPayload()))
     .collect(Collectors.toList());
}

代码示例来源:origin: org.streampipes/streampipes-connect

public FeatureCollection getCameraData() throws IOException {

  String response = Request
      .Get(Url)
      .addHeader("Authorization", "apiKey " +this.apiKey)
      .execute()
      .returnContent()
      .asString();

  return new Gson().fromJson(response, FeatureCollection.class);
 }
}

代码示例来源:origin: org.streampipes/streampipes-connect

public byte[] getImageData() throws IOException {
  return Request
      .Get(imageUrl)
      .execute()
      .returnContent()
      .asBytes();
 }
}

代码示例来源:origin: streampipes/streampipes-ce

public byte[] getImageData() throws IOException {
  return Request
      .Get(imageUrl)
      .execute()
      .returnContent()
      .asBytes();
 }
}

代码示例来源:origin: org.phenotips/clinical-text-analysis-extension-generic-rest

@Override
public InputStream getEmpty(String method) throws ServiceException
{
  try {
    URI uri = getAbsoluteURI(method);
    return Request.Get(uri).execute().returnContent().asStream();
  } catch (IOException | URISyntaxException e) {
    throw new ServiceException(e.getMessage(), e);
  }
}

代码示例来源:origin: org.phenotips/clinical-text-analysis-extension-generic-rest

@Override
public InputStream postEmpty(String method) throws ServiceException
{
  try {
    URI uri = getAbsoluteURI(method);
    return Request.Post(uri).execute().returnContent().asStream();
  } catch (IOException | URISyntaxException e) {
    throw new ServiceException(e.getMessage(), e);
  }
}

代码示例来源:origin: adridadou/eth-contract-api

public String get(final SwarmHash hash) throws IOException {
  Response response = Request.Get(host + "/bzzr:/" + hash.toString())
      .execute();
  return response.returnContent().asString();
}

代码示例来源:origin: mesosphere/dcos-commons

@Before
public void beforeAll() throws Exception {
  MockitoAnnotations.initMocks(this);
  when(mockHttpExecutor.execute(DcosVersionClient.DCOS_VERSION_REQUEST)).thenReturn(mockResponse);
  when(mockResponse.returnContent()).thenReturn(mockResponseContent);
  client = new DcosVersionClient(mockHttpExecutor);
}

代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing

private void trustForBlobId(String blobId, String username) throws Exception {
  Response tokenGenerationResponse = Request.Post(baseUri(mainStepdefs.jmapServer).setPath("/download/" + blobId).build())
    .addHeader("Authorization", userStepdefs.authenticate(username).serialize())
    .execute();
  String serializedAttachmentAccessToken = tokenGenerationResponse.returnContent().asString();
  attachmentAccessTokens.put(
      new AttachmentAccessTokenKey(username, blobId),
      AttachmentAccessToken.from(
        serializedAttachmentAccessToken,
        blobId));
}

代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing

private static String getContinuationToken(URIBuilder uriBuilder, String username) throws ClientProtocolException, IOException, URISyntaxException {
  Response response = Request.Post(uriBuilder.setPath("/authentication").build())
    .bodyString("{\"username\": \"" + username + "\", \"clientName\": \"Mozilla Thunderbird\", \"clientVersion\": \"42.0\", \"deviceName\": \"Joe Blogg’s iPhone\"}",
      ContentType.APPLICATION_JSON)
    .setHeader("Accept", ContentType.APPLICATION_JSON.getMimeType())
    .execute();
  return JsonPath.parse(response.returnContent().asString())
    .read("continuationToken");
}

代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing

public static AccessToken doAuthenticate(URIBuilder uriBuilder, String username, String password) throws ClientProtocolException, IOException, URISyntaxException {
  String continuationToken = getContinuationToken(uriBuilder, username);
  Response response = postAuthenticate(uriBuilder, password, continuationToken);
  return AccessToken.fromString(
    JsonPath.parse(response.returnContent().asString())
      .read("accessToken"));
}

相关文章