org.eclipse.jetty.client.api.Request.agent()方法的使用及代码示例

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

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

Request.agent介绍

暂无

代码示例

代码示例来源:origin: labsai/EDDI

@Override
public IRequest setUserAgent(String userAgent) {
  request.agent(userAgent);
  return this;
}

代码示例来源:origin: NationalSecurityAgency/lemongrenade

/**
 * Deletes the entire graph from the LemonGraph database.
 *
 * @param graphId String of graph ID
 * @return JSONObject
 * @throws InvalidGraphException thrown when failing to hit LemonGraph graph/
 */
public static JSONObject deleteGraph(String graphId) throws InvalidGraphException {
  JSONObject ret = new JSONObject();
  try {
    openConnection();
    ContentResponse res = client.newRequest(restUrl+"graph/"+graphId)
       .method(HttpMethod.DELETE)
       .agent("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0")
       .send();
    int status = res.getStatus();
    ret.put("status", status);
    ret.put("message", res.getContentAsString());
    return ret;
  }
  catch (Exception e) {
    log.error("Caught exception in deleteGraph "+e.getMessage());
    throw new InvalidGraphException(e.getMessage());
  }
}

代码示例来源:origin: org.apache.kafka/connect-runtime

req.method(method);
req.accept("application/json");
req.agent("kafka-connect");
if (serializedBody != null) {
  req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8), "application/json");

相关文章