gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 13:14:40 30 4
gpt4 key购买 nike

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

YokeRequest.response介绍

暂无

代码示例

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

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

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

XhrStreamingListener(int maxBytesStreaming, YokeRequest rc, SockJSSession session) {
 super(rc, session);
 this.maxBytesStreaming = maxBytesStreaming;
 addCloseHandler(rc.response(), session);
}

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

@Override
  public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
    request.response().putHeader("X-FRAME-OPTIONS", header);
    next.handle(null);
  }
}

代码示例来源: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().putHeader("Cache-Control", "no-store, no-cache");
    next.handle(null);
  }
}

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

EventSourceListener(int maxBytesStreaming, YokeRequest rc, SockJSSession session) {
 super(rc, session);
 this.maxBytesStreaming = maxBytesStreaming;
 addCloseHandler(rc.response(), session);
}

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

HtmlFileListener(int maxBytesStreaming, YokeRequest rc, String callback, SockJSSession session) {
 super(rc, session);
 this.maxBytesStreaming = maxBytesStreaming;
 this.callback = callback;
 addCloseHandler(rc.response(), session);
}

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

@Override
  public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
    request.response().putHeader("X-Download-Options", "noopen");
    next.handle(null);
  }
}

代码示例来源: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 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

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();
  } catch (IllegalStateException e) {
   // Underlying connection might already be closed - that's fine
  }
  closed = true;
 }
}

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

@Override
  public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
    boolean isSecure = (request.isSSL())
        || ("on".equals(request.getHeader("front-end-https")))
        || ("https".equals(request.getHeader("x-forwarded-proto")));

    if (isSecure) {
      request.response().putHeader("Strict-Transport-Security", header);
    }

    next.handle(null);
  }
}

代码示例来源: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

/**
 * Handle all forbidden errors, in this case we need to add a special header to the response
 *
 * @param request yoke request
 * @param next middleware to be called next
 */
private void handle401(final YokeRequest request, final Handler<Object> next) {
  YokeResponse response = request.response();
  response.putHeader("WWW-Authenticate", "Basic realm=\"" + getRealm(request) + "\"");
  response.setStatusCode(401);
  next.handle("No authorization token");
}

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

@Override
  public void handle(@NotNull final YokeRequest request, @NotNull final Handler<Object> next) {
    JsonObject session = request.get("session");
    if (session != null) {
      if (session.getString("id") != null) {
        next.handle(null);
        return;
      }
    }
    String redirect = request.getParam("redirect_url", Utils.encodeURIComponent(request.uri()));
    request.response().redirect(loginURI + "?redirect_url=" + Utils.decodeURIComponent(redirect));
  }
};

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

public static void setCORS(@NotNull YokeRequest request) {
 String origin = request.headers().get("origin");
 if (origin == null || "null".equals(origin)) {
  origin = "*";
 }
 request.response().headers().set("Access-Control-Allow-Origin", origin);
 request.response().headers().set("Access-Control-Allow-Credentials", "true");
 String hdr = request.headers().get("Access-Control-Request-Headers");
 if (hdr != null) {
  request.response().headers().set("Access-Control-Allow-Headers", hdr);
 }
}

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

public void sendFrame(String body) {
 super.sendFrame(body);
 rc.response().write(body + "\n");
 close();
}

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

public void sendFrame(String body) {
 if (log.isTraceEnabled()) log.trace("XHR sending frame");
 if (!headersWritten) {
  rc.response().putHeader("Content-Type", "application/javascript; charset=UTF-8");
  setJSESSIONID(options, rc);
  setCORS(rc);
  rc.response().setChunked(true);
  headersWritten = true;
 }
}

代码示例来源: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();
  }
}

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