public void update(Request request, Response response) {
   String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
   SampleOidEntity entity =
       request.getBodyAs(SampleOidEntity.class, "Resource details not provided");
   entity.setId(Identifiers.MONGOID.parse(id));
   service.update(entity);
   response.setResponseNoContent();
 }
  public ApiDeclarations read(Request request, Response response) {
    String path = request.getHeader("path");
    ApiDeclarations api = apisByPath.get("/" + path);

    if (api == null) throw new NotFoundException(path);

    return api;
  }
  public SampleOidEntity read(Request request, Response response) {
    String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
    SampleOidEntity entity = service.read(Identifiers.MONGOID.parse(id));

    // enrich the resource with links, etc. here...
    HyperExpress.bind(Constants.Url.SAMPLE_ID, Identifiers.MONGOID.format(entity.getId()));

    return entity;
  }
  private String getToken(Request request) throws UnauthorizedException {
    String authorization = request.getHeader(HttpHeaders.Names.AUTHORIZATION);

    if (authorization == null) {
      throw new UnauthorizedException("No Authorization header was found");
    }

    Matcher matcher = PATTERN.matcher(authorization);

    if (matcher.find()) {
      return matcher.group(1);
    } else {
      throw new UnauthorizedException("Format is Authorization: Bearer [token]");
    }
  }
 public void delete(Request request, Response response) {
   String id = request.getHeader(Constants.Url.SAMPLE_ID, "No resource ID supplied");
   service.delete(Identifiers.MONGOID.parse(id));
   response.setResponseNoContent();
 }
 public void read(Request request, Response response) {
   System.out.println(
       "message: " + request.getHeader("m") + ", " + "stacktrace: " + request.getHeader("s"));
 }