org.simpleframework.http.Request.getValues()方法的使用及代码示例

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

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

Request.getValues介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

  1. gzipOutputStream.close();
  2. } else {
  3. resp.getPrintStream().append("agent=" + req.getValues("User-Agent").get(0));

代码示例来源:origin: CodeStory/fluent-http

  1. @Override
  2. public List<String> headers(String name) {
  3. return request.getValues(name);
  4. }

代码示例来源:origin: ngallagher/simpleframework

  1. /**
  2. * This can be used to get the values of HTTP message headers
  3. * that have the specified name. This is a convenience method that
  4. * will present that values as tokens extracted from the header.
  5. * This has obvious performance benifits as it avoids having to
  6. * deal with <code>substring</code> and <code>trim</code> calls.
  7. * <p>
  8. * The tokens returned by this method are ordered according to
  9. * there HTTP quality values, or "q" values, see RFC 2616 section
  10. * 3.9. This also strips out the quality parameter from tokens
  11. * returned. So "image/html; q=0.9" results in "image/html". If
  12. * there are no "q" values present then order is by appearence.
  13. * <p>
  14. * The result from this is either the trimmed header value, that
  15. * is, the header value with no leading or trailing whitespace
  16. * or an array of trimmed tokens ordered with the most preferred
  17. * in the lower indexes, so index 0 is has higest preference.
  18. *
  19. * @param name the name of the headers that are to be retrieved
  20. *
  21. * @return ordered array of tokens extracted from the header(s)
  22. */
  23. public List<String> getValues(String name) {
  24. return request.getValues(name);
  25. }

代码示例来源:origin: org.simpleframework/simple

  1. /**
  2. * This can be used to get the values of HTTP message headers
  3. * that have the specified name. This is a convenience method that
  4. * will present that values as tokens extracted from the header.
  5. * This has obvious performance benifits as it avoids having to
  6. * deal with <code>substring</code> and <code>trim</code> calls.
  7. * <p>
  8. * The tokens returned by this method are ordered according to
  9. * there HTTP quality values, or "q" values, see RFC 2616 section
  10. * 3.9. This also strips out the quality parameter from tokens
  11. * returned. So "image/html; q=0.9" results in "image/html". If
  12. * there are no "q" values present then order is by appearence.
  13. * <p>
  14. * The result from this is either the trimmed header value, that
  15. * is, the header value with no leading or trailing whitespace
  16. * or an array of trimmed tokens ordered with the most preferred
  17. * in the lower indexes, so index 0 is has higest preference.
  18. *
  19. * @param name the name of the headers that are to be retrieved
  20. *
  21. * @return ordered array of tokens extracted from the header(s)
  22. */
  23. public List<String> getValues(String name) {
  24. return request.getValues(name);
  25. }

代码示例来源:origin: org.simpleframework/simple-http

  1. /**
  2. * This can be used to get the values of HTTP message headers
  3. * that have the specified name. This is a convenience method that
  4. * will present that values as tokens extracted from the header.
  5. * This has obvious performance benifits as it avoids having to
  6. * deal with <code>substring</code> and <code>trim</code> calls.
  7. * <p>
  8. * The tokens returned by this method are ordered according to
  9. * there HTTP quality values, or "q" values, see RFC 2616 section
  10. * 3.9. This also strips out the quality parameter from tokens
  11. * returned. So "image/html; q=0.9" results in "image/html". If
  12. * there are no "q" values present then order is by appearence.
  13. * <p>
  14. * The result from this is either the trimmed header value, that
  15. * is, the header value with no leading or trailing whitespace
  16. * or an array of trimmed tokens ordered with the most preferred
  17. * in the lower indexes, so index 0 is has higest preference.
  18. *
  19. * @param name the name of the headers that are to be retrieved
  20. *
  21. * @return ordered array of tokens extracted from the header(s)
  22. */
  23. public List<String> getValues(String name) {
  24. return request.getValues(name);
  25. }

代码示例来源:origin: ngallagher/simpleframework

  1. /**
  2. * Here we check to ensure that there is a HTTP connection header
  3. * with the required upgrade token. The upgrade token may be
  4. * one of many, so all must be checked. Finally to ensure that
  5. * the upgrade is for a WebSocket the upgrade header is checked.
  6. *
  7. * @return this returns true if the request is an upgrade
  8. */
  9. private boolean isUpgrade() {
  10. List<String> tokens = request.getValues(CONNECTION);
  11. for(String token : tokens) {
  12. if(token.equalsIgnoreCase(UPGRADE)) {
  13. String upgrade = request.getValue(UPGRADE);
  14. if(upgrade != null) {
  15. return upgrade.equalsIgnoreCase(WEBSOCKET);
  16. }
  17. return false;
  18. }
  19. }
  20. return false;
  21. }

代码示例来源:origin: org.simpleframework/simple-http

  1. /**
  2. * Here we check to ensure that there is a HTTP connection header
  3. * with the required upgrade token. The upgrade token may be
  4. * one of many, so all must be checked. Finally to ensure that
  5. * the upgrade is for a WebSocket the upgrade header is checked.
  6. *
  7. * @return this returns true if the request is an upgrade
  8. */
  9. private boolean isUpgrade() {
  10. List<String> tokens = request.getValues(CONNECTION);
  11. for(String token : tokens) {
  12. if(token.equalsIgnoreCase(UPGRADE)) {
  13. String upgrade = request.getValue(UPGRADE);
  14. if(upgrade != null) {
  15. return upgrade.equalsIgnoreCase(WEBSOCKET);
  16. }
  17. return false;
  18. }
  19. }
  20. return false;
  21. }

代码示例来源:origin: org.simpleframework/simple-http

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);

代码示例来源:origin: ngallagher/simpleframework

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);

代码示例来源:origin: ngallagher/simpleframework

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);
  3. Path path = request.getPath();

代码示例来源:origin: org.simpleframework/simple-http

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);
  3. Path path = request.getPath();

代码示例来源:origin: kristofa/mock-http-server

  1. public static FullHttpRequest convert(final Request request) {
  2. byte[] data = null;
  3. try {
  4. final InputStream inputStream = request.getInputStream();
  5. try {
  6. data = IOUtils.toByteArray(inputStream);
  7. } finally {
  8. inputStream.close();
  9. }
  10. } catch (final IOException e) {
  11. LOGGER.error("IOException when getting request content.", e);
  12. }
  13. final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
  14. httpRequest.domain(request.getAddress().getDomain());
  15. httpRequest.port(request.getAddress().getPort());
  16. httpRequest.method(Method.valueOf(request.getMethod()));
  17. httpRequest.path(request.getPath().getPath());
  18. if (data.length > 0) {
  19. httpRequest.content(data);
  20. }
  21. for (final String headerField : request.getNames()) {
  22. for (final String headerFieldValue : request.getValues(headerField)) {
  23. httpRequest.httpMessageHeader(headerField, headerFieldValue);
  24. }
  25. }
  26. for (final Entry<String, String> entry : request.getQuery().entrySet()) {
  27. httpRequest.queryParameter(entry.getKey(), entry.getValue());
  28. }
  29. return httpRequest;
  30. }

相关文章