org.apache.coyote.Request.getAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(13.2k)|赞(0)|评价(0)|浏览(117)

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

Request.getAttribute介绍

暂无

代码示例

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute("org.apache.tomcat.sendfile.filename");
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new NioEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.pos = ((Long) request.getAttribute("org.apache.tomcat.sendfile.start")).longValue();
    sendfileData.length = ((Long) request.getAttribute("org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos;
    return true;
  }
  return false;
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute("org.apache.tomcat.sendfile.filename");
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter
      (outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new AprEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.start = 
      ((Long) request.getAttribute("org.apache.tomcat.sendfile.start")).longValue();
    sendfileData.end = 
      ((Long) request.getAttribute("org.apache.tomcat.sendfile.end")).longValue();
    return true;
  }
  return false;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private void prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName == null) {
    sendfileData = null;
  } else {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    long pos = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    long end = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
    sendfileData = socketWrapper.createSendfileData(fileName, pos, end - pos);
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new NioEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.pos = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    sendfileData.length = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue() - sendfileData.pos;
    return true;
  }
  return false;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Obtain the remote address for this connection as reported by an
 * intermediate proxy (if any).
 *
 * @return The remote address for the this connection
 */
public String getRemoteAddrForwarded() {
  String remoteAddrProxy = (String) req.getAttribute(Constants.REMOTE_ADDR_ATTRIBUTE);
  if (remoteAddrProxy == null) {
    return getRemoteAddr();
  }
  return remoteAddrProxy;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new NioEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.pos = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    sendfileData.length = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue() - sendfileData.pos;
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      "org.apache.tomcat.sendfile.filename");
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new AprEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.start = ((Long) request.getAttribute(
        "org.apache.tomcat.sendfile.start")).longValue();
    sendfileData.end = ((Long) request.getAttribute(
        "org.apache.tomcat.sendfile.end")).longValue();
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      "org.apache.tomcat.sendfile.filename");
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new NioEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.pos = ((Long) request.getAttribute(
        "org.apache.tomcat.sendfile.start")).longValue();
    sendfileData.length = ((Long) request.getAttribute(
        "org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos;
    return true;
  }
  return false;
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new AprEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.start = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    sendfileData.end = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
protected boolean prepareSendfile(OutputFilter[] outputFilters) {
  String fileName = (String) request.getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName != null) {
    // No entity body sent here
    outputBuffer.addActiveFilter(outputFilters[Constants.VOID_FILTER]);
    contentDelimitation = true;
    sendfileData = new AprEndpoint.SendfileData();
    sendfileData.fileName = fileName;
    sendfileData.start = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    sendfileData.end = ((Long) request.getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
    return true;
  }
  return false;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private void prepareSendfile() {
  String fileName = (String) stream.getCoyoteRequest().getAttribute(
      org.apache.coyote.Constants.SENDFILE_FILENAME_ATTR);
  if (fileName != null) {
    sendfileData = new SendfileData();
    sendfileData.path = new File(fileName).toPath();
    sendfileData.pos = ((Long) stream.getCoyoteRequest().getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_START_ATTR)).longValue();
    sendfileData.end = ((Long) stream.getCoyoteRequest().getAttribute(
        org.apache.coyote.Constants.SENDFILE_FILE_END_ATTR)).longValue();
    sendfileData.left = sendfileData.end - sendfileData.pos;
    sendfileData.stream = stream;
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

attr = coyoteRequest.getAttribute(name);
if (attr != null) {
  return attr;
  attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
  if (attr != null) {
    attributes.put(Globals.CERTIFICATES_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
  if (attr != null) {
    attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
  if (attr != null) {
    attributes.put(Globals.KEY_SIZE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_ID_ATTR);
  if (attr != null) {
    attributes.put(Globals.SSL_SESSION_ID_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_MGR_ATTR);
  if (attr != null) {
    attributes.put(Globals.SSL_SESSION_MGR_ATTR, attr);
  attr = coyoteRequest.getAttribute(SSLSupport.PROTOCOL_VERSION_KEY);
  if (attr != null) {
    attributes.put(SSLSupport.PROTOCOL_VERSION_KEY, attr);

代码示例来源:origin: org.jboss.web/jbossweb

public X509Certificate[] getCertificateChain() {
  X509Certificate certs[] = (X509Certificate[]) getAttribute(Globals.CERTIFICATES_ATTR);
  if ((certs == null) || (certs.length < 1)) {
    coyoteRequest.action(ActionCode.ACTION_REQ_SSL_CERTIFICATE, 
        coyoteRequest);
    certs = (X509Certificate[]) coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
    if (certs != null) {
      attributes.put(Globals.CERTIFICATES_ATTR, certs);
    }
  }
  return certs;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

attr =  coyoteRequest.getAttribute(name);
if(attr != null) {
  return attr;
  coyoteRequest.action(ActionCode.REQ_SSL_ATTRIBUTE,
             coyoteRequest);
  attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
  if( attr != null) {
    attributes.put(Globals.CERTIFICATES_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
  if(attr != null) {
    attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
  if(attr != null) {
    attributes.put(Globals.KEY_SIZE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_ID_ATTR);
  if(attr != null) {
    attributes.put(Globals.SSL_SESSION_ID_ATTR, attr);
    attributes.put(Globals.SSL_SESSION_ID_TOMCAT_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_MGR_ATTR);
  if(attr != null) {
    attributes.put(Globals.SSL_SESSION_MGR_ATTR, attr);

代码示例来源:origin: jboss.web/jbossweb

return(attr);
attr =  coyoteRequest.getAttribute(name);
if(attr != null)
  return attr;
  coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE, 
             coyoteRequest);
  attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
  if( attr != null) {
    attributes.put(Globals.CERTIFICATES_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
  if(attr != null) {
    attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
  if(attr != null) {
    attributes.put(Globals.KEY_SIZE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_ID_ATTR);
  if(attr != null) {
    attributes.put(Globals.SSL_SESSION_ID_ATTR, attr);

代码示例来源:origin: org.jboss.web/jbossweb

return(attr);
attr =  coyoteRequest.getAttribute(name);
if(attr != null)
  return attr;
  coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE, 
             coyoteRequest);
  attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
  if( attr != null) {
    attributes.put(Globals.CERTIFICATES_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
  if(attr != null) {
    attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
  if(attr != null) {
    attributes.put(Globals.KEY_SIZE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_ID_ATTR);
  if(attr != null) {
    attributes.put(Globals.SSL_SESSION_ID_ATTR, attr);

代码示例来源:origin: tomcat/catalina

return(attr);
attr =  coyoteRequest.getAttribute(name);
if(attr != null)
  return attr;
  coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE, 
             coyoteRequest);
  attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
  if( attr != null) {
    attributes.put(Globals.CERTIFICATES_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
  if(attr != null) {
    attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
  if(attr != null) {
    attributes.put(Globals.KEY_SIZE_ATTR, attr);
  attr = coyoteRequest.getAttribute(Globals.SSL_SESSION_ID_ATTR);
  if(attr != null) {
    attributes.put(Globals.SSL_SESSION_ID_ATTR, attr);

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

@Override
protected void setCometTimeouts(SocketWrapper<NioChannel> socketWrapper) {
  // Comet support
  SelectionKey key = socketWrapper.getSocket().getIOChannel().keyFor(
      socketWrapper.getSocket().getPoller().getSelector());
  if (key != null) {
    NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment) key.attachment();
    if (attach != null)  {
      attach.setComet(comet);
      if (comet) {
        Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
        if (comettimeout != null) {
          attach.setTimeout(comettimeout.longValue());
        }
      }
    }
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected void setCometTimeouts(SocketWrapper<NioChannel> socketWrapper) {
  // Comet support
  SelectionKey key = socketWrapper.getSocket().getIOChannel().keyFor(
      socketWrapper.getSocket().getPoller().getSelector());
  if (key != null) {
    NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment) key.attachment();
    if (attach != null)  {
      attach.setComet(comet);
      if (comet) {
        Integer comettimeout = (Integer) request.getAttribute(
            org.apache.coyote.Constants.COMET_TIMEOUT_ATTR);
        if (comettimeout != null) {
          attach.setTimeout(comettimeout.longValue());
        }
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
protected void setCometTimeouts(SocketWrapper<NioChannel> socketWrapper) {
  // Comet support
  SelectionKey key = socketWrapper.getSocket().getIOChannel().keyFor(
      socketWrapper.getSocket().getPoller().getSelector());
  if (key != null) {
    NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment) key.attachment();
    if (attach != null)  {
      attach.setComet(comet);
      if (comet) {
        Integer comettimeout = (Integer) request.getAttribute(
            org.apache.coyote.Constants.COMET_TIMEOUT_ATTR);
        if (comettimeout != null) {
          attach.setTimeout(comettimeout.longValue());
        }
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

Request类方法