org.glassfish.grizzly.http.server.Request.setAttribute()方法的使用及代码示例

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

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

Request.setAttribute介绍

[英]Set the specified request attribute to the specified value.
[中]将指定的请求属性设置为指定的值。

代码示例

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

  1. @Override
  2. public void setProperty(String name, Object value) {
  3. request.setAttribute(name, value);
  4. }

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-grizzly2-http

  1. @Override
  2. public void setProperty(String name, Object value) {
  3. request.setAttribute(name, value);
  4. }

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: javaee/grizzly

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: javaee/grizzly

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: javaee/grizzly

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: javaee/grizzly

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: javaee/grizzly

  1. private void setDispatcherPath(final Request request, final String path) {
  2. request.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, path);
  3. }

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: javaee/grizzly

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-http-server

  1. /**
  2. * Instrument the specified {@link Request} with an attribute marking its
  3. * <em>received</em> time (in {@linkplain System#nanoTime() nanoseconds}).
  4. */
  5. @Override @SuppressWarnings("rawtypes")
  6. public void onRequestReceiveEvent(HttpServerFilter filter, Connection connection, Request request) {
  7. request.setAttribute(ATTRIBUTE_TIME_STAMP, System.nanoTime());
  8. /*
  9. * It seems that in some edge cases Grizzly is not caching the
  10. * connection addresses in the request / response structure. Internally
  11. * the TCPNIOConnectionClass uses a Holder to store those (which
  12. * provides lazy initialization). We force the holders to get (and
  13. * cache) the values by alling the "get(Local|Peer)Address()" methods.
  14. */
  15. connection.getLocalAddress();
  16. connection.getPeerAddress();
  17. }

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server

  1. public static Object populateCertificateAttribute(final Request request) {
  2. Object certificates = null;
  3. if (request.getRequest().isSecure()) {
  4. if (!request.getRequest().isUpgrade()) {
  5. // It's normal HTTP request, not upgraded one
  6. try {
  7. request.getInputBuffer().fillFully(
  8. request.getHttpFilter().getConfiguration().getMaxBufferedPostSize());
  9. } catch (IOException e) {
  10. throw new IllegalStateException("Can't complete SSL re-negotation", e);
  11. }
  12. }
  13. GrizzlyFuture<Object[]> certFuture =
  14. new CertificateEvent(true).trigger(request.getContext());
  15. try {
  16. // TODO: make the timeout configurable
  17. certificates = certFuture.get(30, TimeUnit.SECONDS);
  18. } catch (Exception e) {
  19. if (LOGGER.isLoggable(Level.FINE)) {
  20. LOGGER.log(Level.FINE,
  21. "Unable to obtain certificates from peer.",
  22. e);
  23. }
  24. }
  25. request.setAttribute(SSLSupport.CERTIFICATE_KEY, certificates);
  26. }
  27. return certificates;
  28. }

相关文章

Request类方法