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

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

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

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

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

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

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Object getAttribute(String name) {
  6. if (request == null) {
  7. throw new IllegalStateException("Null request object");
  8. }
  9. return request.getAttribute(name);
  10. }

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

  1. private String getRequestPath(Request request) {
  2. // get the dispatcher type
  3. String requestPath = null;
  4. Object attribute = request.getAttribute(
  5. Globals.DISPATCHER_REQUEST_PATH_ATTR);
  6. if (attribute != null) {
  7. requestPath = attribute.toString();
  8. }
  9. return requestPath;
  10. }

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

  1. /**
  2. * get the SSL Client certificate for the given request (if any)
  3. *
  4. * @param req
  5. * - the request to check
  6. * @return - the X509Certificate
  7. */
  8. protected X509Certificate getCertificate(Request req) {
  9. X509Certificate result = null;
  10. Object certobj = req.getAttribute(Globals.CERTIFICATES_ATTR);
  11. if (certobj != null) {
  12. String msg = "certificate " + certobj.getClass().getName() + " found";
  13. LOGGER.finer(msg);
  14. if (certobj instanceof java.security.cert.X509Certificate[]) {
  15. java.security.cert.X509Certificate[] certs = (X509Certificate[]) certobj;
  16. if (certs.length > 0)
  17. result = certs[0];
  18. }
  19. }
  20. return result;
  21. }

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

  1. /**
  2. * Return the principal that has been authenticated for this Request.
  3. */
  4. public Principal getUserPrincipal() {
  5. if (userPrincipal == null) {
  6. if (getRequest().isSecure()) {
  7. X509Certificate certs[] = (X509Certificate[]) getAttribute(
  8. Globals.CERTIFICATES_ATTR);
  9. if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
  10. ((certs == null) || (certs.length < 1))) {
  11. // Force SSL re-handshake and request client auth
  12. certs = (X509Certificate[]) getAttribute(
  13. Globals.SSL_CERTIFICATE_ATTR);
  14. }
  15. if (certs != null && certs.length > 0) {
  16. userPrincipal = certs[0].getSubjectX500Principal();
  17. }
  18. }
  19. }
  20. return userPrincipal;
  21. }

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

  1. /**
  2. * Return the principal that has been authenticated for this Request.
  3. */
  4. public Principal getUserPrincipal() {
  5. if (userPrincipal == null) {
  6. if (getRequest().isSecure()) {
  7. X509Certificate certs[] = (X509Certificate[]) getAttribute(
  8. Globals.CERTIFICATES_ATTR);
  9. if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
  10. ((certs == null) || (certs.length < 1))) {
  11. // Force SSL re-handshake and request client auth
  12. certs = (X509Certificate[]) getAttribute(
  13. Globals.SSL_CERTIFICATE_ATTR);
  14. }
  15. if (certs != null && certs.length > 0) {
  16. userPrincipal = certs[0].getSubjectX500Principal();
  17. }
  18. }
  19. }
  20. return userPrincipal;
  21. }

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

  1. /**
  2. * Return the principal that has been authenticated for this Request.
  3. */
  4. public Principal getUserPrincipal() {
  5. if (userPrincipal == null) {
  6. if (getRequest().isSecure()) {
  7. X509Certificate certs[] = (X509Certificate[]) getAttribute(
  8. Globals.CERTIFICATES_ATTR);
  9. if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
  10. ((certs == null) || (certs.length < 1))) {
  11. // Force SSL re-handshake and request client auth
  12. certs = (X509Certificate[]) getAttribute(
  13. Globals.SSL_CERTIFICATE_ATTR);
  14. }
  15. if (certs != null && certs.length > 0) {
  16. userPrincipal = certs[0].getSubjectX500Principal();
  17. }
  18. }
  19. }
  20. return userPrincipal;
  21. }

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

  1. /**
  2. * Return the principal that has been authenticated for this Request.
  3. */
  4. public Principal getUserPrincipal() {
  5. if (userPrincipal == null) {
  6. if (getRequest().isSecure()) {
  7. X509Certificate certs[] = (X509Certificate[]) getAttribute(
  8. Globals.CERTIFICATES_ATTR);
  9. if (FORCE_CLIENT_AUTH_ON_GET_USER_PRINCIPAL &&
  10. ((certs == null) || (certs.length < 1))) {
  11. // Force SSL re-handshake and request client auth
  12. certs = (X509Certificate[]) getAttribute(
  13. Globals.SSL_CERTIFICATE_ATTR);
  14. }
  15. if (certs != null && certs.length > 0) {
  16. userPrincipal = certs[0].getSubjectX500Principal();
  17. }
  18. }
  19. }
  20. return userPrincipal;
  21. }

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

  1. @Override
  2. public PushBuilder newPushBuilder() {
  3. Http2Stream http2Stream = null;
  4. if (coyoteRequest != null) {
  5. http2Stream = (Http2Stream)coyoteRequest.getAttribute(Http2Stream.HTTP2_STREAM_ATTRIBUTE);
  6. }
  7. if (http2Stream != null && http2Stream.isPushEnabled()) {
  8. return new ApplicationPushBuilder(this);
  9. } else {
  10. return null;
  11. }
  12. }

相关文章

Request类方法