gpt4 book ai didi

com.jetdrone.vertx.yoke.middleware.YokeResponse.end()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 09:06:49 27 4
gpt4 key购买 nike

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

YokeResponse.end介绍

暂无

代码示例

代码示例来源:origin: pmlopes/yoke

@Override
public void writeResponseContent(String content) {
  response.end(content);
}

代码示例来源:origin: pmlopes/yoke

@Override
 public void handle(YokeRequest request) {
  request.response().end(new JsonObject().put("name", "Tobi").put("role", "admin"));
 }
})

代码示例来源:origin: pmlopes/yoke

@Override
 public void handle(YokeRequest request) {
  request.response().end("Hello World\n");
 }
})

代码示例来源:origin: pmlopes/yoke

@Override
 public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
  request.response().setStatusCode(400).end("Can \"Upgrade\" only to \"WebSocket\".");
 }
});

代码示例来源:origin: pmlopes/yoke

@Override
  public void handle(AsyncResult<Buffer> asyncResult) {
    if (asyncResult.failed()) {
      next.handle(asyncResult.cause());
    } else {
      setContentType(renderEngine.contentType(), renderEngine.contentEncoding());
      end(asyncResult.result());
    }
  }
});

代码示例来源:origin: pmlopes/yoke

@Override
  public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
    if (dt - 500 * 1000000 > highWaterMark) {
      final YokeResponse response = request.response();

      response.setStatusCode(503);
      response.setStatusMessage(message);
      response.end();
    } else {
      next.handle(null);
    }
  }
}

代码示例来源:origin: pmlopes/yoke

public void jsonp(String callback, JsonArray json) {
  if (callback == null) {
    // treat as normal json response
    end(json);
    return;
  }
  String body = null;
  if (json != null) {
    body = json.encode();
  }
  jsonp(callback, body);
}

代码示例来源:origin: pmlopes/yoke

@Override
  public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
    if ("/crossdomain.xml".equals(request.path())) {
      request.response().putHeader("Content-Type", "text/x-cross-domain-policy");
      request.response().end(DATA);
    } else {
      next.handle(null);
    }
  }
}

代码示例来源:origin: pmlopes/yoke

@Override
 public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
  request.response().putHeader("Allow", "GET").setStatusCode(405).end();
 }
});

代码示例来源:origin: pmlopes/yoke

public void jsonp(String callback, JsonObject json) {
  if (callback == null) {
    // treat as normal json response
    end(json);
    return;
  }
  String body = null;
  if (json != null) {
    body = json.encode();
  }
  jsonp(callback, body);
}

代码示例来源:origin: pmlopes/yoke

public void end(JsonObject jsonObject) {
  setContentType("application/json", "UTF-8");
  end(jsonObject.encode());
}

代码示例来源:origin: pmlopes/yoke

public void end(JsonArray jsonArray) {
  setContentType("application/json", "UTF-8");
  end(jsonArray.encode());
}

代码示例来源:origin: pmlopes/yoke

@Override
  public void handle(@NotNull final YokeRequest request, @NotNull final Handler<Object> next) {
    if ("/favicon.ico".equals(request.normalizedPath())) {
      request.response().headers().setAll(icon.headers);
      request.response().end(icon.body);
    } else {
      next.handle(null);
    }
  }
}

代码示例来源:origin: pmlopes/yoke

@Override
 public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
  if (log.isTraceEnabled()) log.trace("WS, all: " + request.uri());
  request.response().putHeader("Allow", "GET").setStatusCode(405).end();
 }
});

代码示例来源:origin: pmlopes/yoke

public void close() {
 if (!closed) {
  try {
   session.resetListener();
   rc.response().end();
   rc.response().close();
  } catch (IllegalStateException e) {
   // Underlying connection might already be closed - that's fine
  }
  closed = true;
 }
}

代码示例来源:origin: pmlopes/yoke

public void close() {
  if (!closed) {
   try {
    session.resetListener();
    rc.response().end();
    rc.response().close();
    closed = true;
   } catch (IllegalStateException e) {
    // Underlying connection might already be closed - that's fine
   }
  }
 }
}

代码示例来源:origin: pmlopes/yoke

public void close() {
  if (!closed) {
   try {
    session.resetListener();
    rc.response().end();
    rc.response().close();
    closed = true;
   } catch (IllegalStateException e) {
    // Underlying connection might already be closed - that's fine
   }
  }
 }
}

代码示例来源:origin: pmlopes/yoke

public void redirect(int status, String url) {
  setStatusCode(status);
  setStatusMessage(HttpResponseStatus.valueOf(status).reasonPhrase());
  putHeader("location", url);
  end();
}

代码示例来源:origin: pmlopes/yoke

public void close() {
  if (log.isTraceEnabled()) log.trace("XHR poll closing listener");
  if (!closed) {
   try {
    session.resetListener();
    rc.response().end();
    rc.response().close();
    closed = true;
   } catch (IllegalStateException e) {
    // Underlying connection might already be closed - that's fine
   }
  }
 }
}

代码示例来源:origin: pmlopes/yoke

private void handlePreflightRequest(final YokeRequest request)
{
  if (isValidOrigin(request.getHeader(ORIGIN)))
  {
    addCorsResponseHeaders(request.getHeader(ORIGIN),
      request.response().setStatusCode(204).setStatusMessage("No Content")).end();
  }
  else
  {
    request.response().setStatusCode(403).setStatusMessage("CORS Rejected").end();
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com