org.restlet.Response.getHeaders()方法的使用及代码示例

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

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

Response.getHeaders介绍

暂无

代码示例

代码示例来源:origin: ontopia/ontopia

public static void addResponseHeader(Response response, String header, String value) {
    response.getHeaders().add(header, value);
  }
}

代码示例来源:origin: com.whizzosoftware.hobson.hub/hobson-hub-auth

@Override
protected Representation get() throws ResourceException {
  JSONObject json = new JSONObject();
  json.put("issuer", "Hobon");
  json.put("authorization_endpoint", AuthorizationResource.PATH);
  json.put("userinfo_endpoint", "/v1/api/userInfo");
  json.put("token_endpoint", TokenResource.PATH);
  json.put("jwks_uri", JWKSResource.PATH);
  JSONArray ja = new JSONArray();
  ja.put("id_token");
  json.put("response_types_supported", ja);
  ja = new JSONArray();
  ja.put("public");
  json.put("subject_types_supported", ja);
  ja = new JSONArray();
  ja.put("openid");
  json.put("scopes_supported", ja);
  ja = new JSONArray();
  ja.put("RS256");
  json.put("id_token_signing_alg_values_supported", ja);
  ja = new JSONArray();
  ja.put("password");
  ja.put("implicit");
  json.put("grant_types_supported", ja);
  getResponse().getHeaders().add("X-Default-User", HubContext.DEFAULT_USER);
  return new JsonRepresentation(json);
}

代码示例来源:origin: ontopia/ontopia

protected void addResponseHeader(String name, String value) {
    getResponse().getHeaders().add(name, value);
  }
}

代码示例来源:origin: cdelmas/microservices-comparison

@Get("json")
public List<CarRepresentation> all() {
  List<io.github.cdelmas.spike.common.domain.Car> cars = carRepository.all();
  getResponse().getHeaders().add("total-count", String.valueOf(cars.size()));
  return cars.stream().map(c -> {
    CarRepresentation carRepresentation = new CarRepresentation(c);
    carRepresentation.addLink(Link.self(new Reference(getReference()).addSegment(String.valueOf(c.getId())).toString()));
    return carRepresentation;
  }).collect(toList());
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform

@Override
public int handle(Request request, Response response,
    CounterResult counterResult) {
  Series<Header> headers = response.getHeaders();
  headers.set(
      "X-RateLimit-Remaining",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())
          - counterResult.getConsumed()));
  headers.set(
      "X-RateLimit-Limit",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())));
  headers.set("X-RateLimit-Reset",
      Long.toString(counterResult.getReset()));
  response.getAttributes()
      .put(HeaderConstants.ATTRIBUTE_HEADERS, headers);
  return super.handle(request, response, counterResult);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

@Override
public int handle(Request request, Response response,
    CounterResult counterResult) {
  Series<Header> headers = response.getHeaders();
  headers.set(
      "X-RateLimit-Remaining",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())
          - counterResult.getConsumed()));
  headers.set(
      "X-RateLimit-Limit",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())));
  headers.set("X-RateLimit-Reset",
      Long.toString(counterResult.getReset()));
  response.getAttributes()
      .put(HeaderConstants.ATTRIBUTE_HEADERS, headers);
  return super.handle(request, response, counterResult);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark

@Override
public int handle(Request request, Response response,
    CounterResult counterResult) {
  Series<Header> headers = response.getHeaders();
  headers.set(
      "X-RateLimit-Remaining",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())
          - counterResult.getConsumed()));
  headers.set(
      "X-RateLimit-Limit",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())));
  headers.set("X-RateLimit-Reset",
      Long.toString(counterResult.getReset()));
  response.getAttributes()
      .put(HeaderConstants.ATTRIBUTE_HEADERS, headers);
  return super.handle(request, response, counterResult);
}

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

@Override
public int handle(Request request, Response response,
    CounterResult counterResult) {
  Series<Header> headers = response.getHeaders();
  headers.set(
      "X-RateLimit-Remaining",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())
          - counterResult.getConsumed()));
  headers.set(
      "X-RateLimit-Limit",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())));
  headers.set("X-RateLimit-Reset",
      Long.toString(counterResult.getReset()));
  response.getAttributes()
      .put(HeaderConstants.ATTRIBUTE_HEADERS, headers);
  return super.handle(request, response, counterResult);
}

代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform

@Override
public int handle(Request request, Response response,
    CounterResult counterResult) {
  Series<Header> headers = response.getHeaders();
  headers.set(
      "X-RateLimit-Remaining",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())
          - counterResult.getConsumed()));
  headers.set(
      "X-RateLimit-Limit",
      Integer.toString(getLimit(request,
          counterResult.getCountedValue())));
  headers.set("X-RateLimit-Reset",
      Long.toString(counterResult.getReset()));
  response.getAttributes()
      .put(HeaderConstants.ATTRIBUTE_HEADERS, headers);
  return super.handle(request, response, counterResult);
}

代码示例来源:origin: ontopia/ontopia

@Override
  protected int beforeHandle(Request request, Response response) {
    response.getHeaders().add(Constants.HEADER_ONTOPIA_API_VERSION, version.getName());
    response.getServerInfo().setAgent(Ontopia.getInfo() + " rest API " + version.getName());
    return super.beforeHandle(request, response);
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

Series<Header> additionalHeaders = response.getHeaders();
addExtensionHeaders(headers, additionalHeaders);

相关文章