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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public static Object populateCertificateAttribute(final Request request) {
  Object certificates = null;
  if (request.getRequest().isSecure()) {
    if (!request.getRequest().isUpgrade()) {
      // It's normal HTTP request, not upgraded one
      try {
        request.getInputBuffer().fillFully(
            request.getHttpFilter().getConfiguration().getMaxBufferedPostSize());
      } catch (IOException e) {
        throw new IllegalStateException("Can't complete SSL re-negotation", e);
      }
    }
    GrizzlyFuture<Object[]> certFuture =
        new CertificateEvent(true).trigger(request.getContext());
    try {
      // TODO: make the timeout configurable
      certificates = certFuture.get(30, TimeUnit.SECONDS);
    } catch (Exception e) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE,
              "Unable to obtain certificates from peer.",
              e);
      }
    }
    request.setAttribute(SSLSupport.CERTIFICATE_KEY, certificates);
  }
  return certificates;
}

相关文章

微信公众号

最新文章

更多

Request类方法