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

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

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

Request.getAttribute介绍

[英]Return the specified request attribute if it exists; otherwise, return null.
[中]返回指定的请求属性(如果存在);否则,返回null

代码示例

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

@Override
public Object getProperty(String name) {
  return request.getAttribute(name);
}

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

@Override
public Object getProperty(String name) {
  return request.getAttribute(name);
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

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

/**
 * {@inheritDoc}
 */
@Override
public Object getAttribute(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getAttribute(name);
}

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

private String getRequestPath(Request request) {
  // get the dispatcher type
  String requestPath = null;
  Object attribute = request.getAttribute(
    Globals.DISPATCHER_REQUEST_PATH_ATTR);
  if (attribute != null) {
    requestPath = attribute.toString();
  }
  return requestPath;
}

代码示例来源:origin: com.bitplan.rest/com.bitplan.simplerest

/**
 * get the SSL Client certificate for the given request (if any)
 * 
 * @param req
 *          - the request to check
 * @return - the X509Certificate
 */
protected X509Certificate getCertificate(Request req) {
 X509Certificate result = null;
 Object certobj = req.getAttribute(Globals.CERTIFICATES_ATTR);
 if (certobj != null) {
  String msg = "certificate " + certobj.getClass().getName() + " found";
  LOGGER.finer(msg);
  if (certobj instanceof java.security.cert.X509Certificate[]) {
   java.security.cert.X509Certificate[] certs = (X509Certificate[]) certobj;
   if (certs.length > 0)
    result = certs[0];
  }
 }
 return result;
}

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

/**
 * Return the principal that has been authenticated for this Request.
 */
public Principal getUserPrincipal() {
  if (userPrincipal == null) {
    if (getRequest().isSecure()) {
      X509Certificate certs[] = (X509Certificate[]) getAttribute(
          Globals.CERTIFICATES_ATTR);
      if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
          ((certs == null) || (certs.length < 1))) {
        // Force SSL re-handshake and request client auth
        certs = (X509Certificate[]) getAttribute(
            Globals.SSL_CERTIFICATE_ATTR);
      }
      
      if (certs != null && certs.length > 0) {
        userPrincipal = certs[0].getSubjectX500Principal();
      }
    }
  }
  return userPrincipal;
}

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

/**
 * Return the principal that has been authenticated for this Request.
 */
public Principal getUserPrincipal() {
  if (userPrincipal == null) {
    if (getRequest().isSecure()) {
      X509Certificate certs[] = (X509Certificate[]) getAttribute(
          Globals.CERTIFICATES_ATTR);
      if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
          ((certs == null) || (certs.length < 1))) {
        // Force SSL re-handshake and request client auth
        certs = (X509Certificate[]) getAttribute(
            Globals.SSL_CERTIFICATE_ATTR);
      }
      
      if (certs != null && certs.length > 0) {
        userPrincipal = certs[0].getSubjectX500Principal();
      }
    }
  }
  return userPrincipal;
}

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

/**
 * Return the principal that has been authenticated for this Request.
 */
public Principal getUserPrincipal() {
  if (userPrincipal == null) {
    if (getRequest().isSecure()) {
      X509Certificate certs[] = (X509Certificate[]) getAttribute(
          Globals.CERTIFICATES_ATTR);
      if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
          ((certs == null) || (certs.length < 1))) {
        // Force SSL re-handshake and request client auth
        certs = (X509Certificate[]) getAttribute(
            Globals.SSL_CERTIFICATE_ATTR);
      }
      
      if (certs != null && certs.length > 0) {
        userPrincipal = certs[0].getSubjectX500Principal();
      }
    }
  }
  return userPrincipal;
}

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

/**
 * Return the principal that has been authenticated for this Request.
 */
public Principal getUserPrincipal() {
  if (userPrincipal == null) {
    if (getRequest().isSecure()) {
      X509Certificate certs[] = (X509Certificate[]) getAttribute(
          Globals.CERTIFICATES_ATTR);
      if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
          ((certs == null) || (certs.length < 1))) {
        // Force SSL re-handshake and request client auth
        certs = (X509Certificate[]) getAttribute(
            Globals.SSL_CERTIFICATE_ATTR);
      }
      
      if (certs != null && certs.length > 0) {
        userPrincipal = certs[0].getSubjectX500Principal();
      }
    }
  }
  return userPrincipal;
}

代码示例来源:origin: org.glassfish.main.web/web-core

@Override
public PushBuilder newPushBuilder() {
  Http2Stream http2Stream = null;
  if (coyoteRequest != null) {
    http2Stream = (Http2Stream)coyoteRequest.getAttribute(Http2Stream.HTTP2_STREAM_ATTRIBUTE);
  }
  if (http2Stream != null && http2Stream.isPushEnabled()) {
    return new ApplicationPushBuilder(this);
  } else {
    return null;
  }
}

相关文章

微信公众号

最新文章

更多

Request类方法