本文整理了Java中org.simpleframework.http.Request.getValues
方法的一些代码示例,展示了Request.getValues
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getValues
方法的具体详情如下:
包路径:org.simpleframework.http.Request
类名称:Request
方法名:getValues
暂无
代码示例来源:origin: SonarSource/sonarqube
gzipOutputStream.close();
} else {
resp.getPrintStream().append("agent=" + req.getValues("User-Agent").get(0));
代码示例来源:origin: CodeStory/fluent-http
@Override
public List<String> headers(String name) {
return request.getValues(name);
}
代码示例来源:origin: ngallagher/simpleframework
/**
* This can be used to get the values of HTTP message headers
* that have the specified name. This is a convenience method that
* will present that values as tokens extracted from the header.
* This has obvious performance benifits as it avoids having to
* deal with <code>substring</code> and <code>trim</code> calls.
* <p>
* The tokens returned by this method are ordered according to
* there HTTP quality values, or "q" values, see RFC 2616 section
* 3.9. This also strips out the quality parameter from tokens
* returned. So "image/html; q=0.9" results in "image/html". If
* there are no "q" values present then order is by appearence.
* <p>
* The result from this is either the trimmed header value, that
* is, the header value with no leading or trailing whitespace
* or an array of trimmed tokens ordered with the most preferred
* in the lower indexes, so index 0 is has higest preference.
*
* @param name the name of the headers that are to be retrieved
*
* @return ordered array of tokens extracted from the header(s)
*/
public List<String> getValues(String name) {
return request.getValues(name);
}
代码示例来源:origin: org.simpleframework/simple
/**
* This can be used to get the values of HTTP message headers
* that have the specified name. This is a convenience method that
* will present that values as tokens extracted from the header.
* This has obvious performance benifits as it avoids having to
* deal with <code>substring</code> and <code>trim</code> calls.
* <p>
* The tokens returned by this method are ordered according to
* there HTTP quality values, or "q" values, see RFC 2616 section
* 3.9. This also strips out the quality parameter from tokens
* returned. So "image/html; q=0.9" results in "image/html". If
* there are no "q" values present then order is by appearence.
* <p>
* The result from this is either the trimmed header value, that
* is, the header value with no leading or trailing whitespace
* or an array of trimmed tokens ordered with the most preferred
* in the lower indexes, so index 0 is has higest preference.
*
* @param name the name of the headers that are to be retrieved
*
* @return ordered array of tokens extracted from the header(s)
*/
public List<String> getValues(String name) {
return request.getValues(name);
}
代码示例来源:origin: org.simpleframework/simple-http
/**
* This can be used to get the values of HTTP message headers
* that have the specified name. This is a convenience method that
* will present that values as tokens extracted from the header.
* This has obvious performance benifits as it avoids having to
* deal with <code>substring</code> and <code>trim</code> calls.
* <p>
* The tokens returned by this method are ordered according to
* there HTTP quality values, or "q" values, see RFC 2616 section
* 3.9. This also strips out the quality parameter from tokens
* returned. So "image/html; q=0.9" results in "image/html". If
* there are no "q" values present then order is by appearence.
* <p>
* The result from this is either the trimmed header value, that
* is, the header value with no leading or trailing whitespace
* or an array of trimmed tokens ordered with the most preferred
* in the lower indexes, so index 0 is has higest preference.
*
* @param name the name of the headers that are to be retrieved
*
* @return ordered array of tokens extracted from the header(s)
*/
public List<String> getValues(String name) {
return request.getValues(name);
}
代码示例来源:origin: ngallagher/simpleframework
/**
* Here we check to ensure that there is a HTTP connection header
* with the required upgrade token. The upgrade token may be
* one of many, so all must be checked. Finally to ensure that
* the upgrade is for a WebSocket the upgrade header is checked.
*
* @return this returns true if the request is an upgrade
*/
private boolean isUpgrade() {
List<String> tokens = request.getValues(CONNECTION);
for(String token : tokens) {
if(token.equalsIgnoreCase(UPGRADE)) {
String upgrade = request.getValue(UPGRADE);
if(upgrade != null) {
return upgrade.equalsIgnoreCase(WEBSOCKET);
}
return false;
}
}
return false;
}
代码示例来源:origin: org.simpleframework/simple-http
/**
* Here we check to ensure that there is a HTTP connection header
* with the required upgrade token. The upgrade token may be
* one of many, so all must be checked. Finally to ensure that
* the upgrade is for a WebSocket the upgrade header is checked.
*
* @return this returns true if the request is an upgrade
*/
private boolean isUpgrade() {
List<String> tokens = request.getValues(CONNECTION);
for(String token : tokens) {
if(token.equalsIgnoreCase(UPGRADE)) {
String upgrade = request.getValue(UPGRADE);
if(upgrade != null) {
return upgrade.equalsIgnoreCase(WEBSOCKET);
}
return false;
}
}
return false;
}
代码示例来源:origin: org.simpleframework/simple-http
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
String version = request.getValue(SEC_WEBSOCKET_VERSION);
代码示例来源:origin: ngallagher/simpleframework
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
String version = request.getValue(SEC_WEBSOCKET_VERSION);
代码示例来源:origin: ngallagher/simpleframework
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
String version = request.getValue(SEC_WEBSOCKET_VERSION);
Path path = request.getPath();
代码示例来源:origin: org.simpleframework/simple-http
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
String version = request.getValue(SEC_WEBSOCKET_VERSION);
Path path = request.getPath();
代码示例来源:origin: kristofa/mock-http-server
public static FullHttpRequest convert(final Request request) {
byte[] data = null;
try {
final InputStream inputStream = request.getInputStream();
try {
data = IOUtils.toByteArray(inputStream);
} finally {
inputStream.close();
}
} catch (final IOException e) {
LOGGER.error("IOException when getting request content.", e);
}
final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
httpRequest.domain(request.getAddress().getDomain());
httpRequest.port(request.getAddress().getPort());
httpRequest.method(Method.valueOf(request.getMethod()));
httpRequest.path(request.getPath().getPath());
if (data.length > 0) {
httpRequest.content(data);
}
for (final String headerField : request.getNames()) {
for (final String headerFieldValue : request.getValues(headerField)) {
httpRequest.httpMessageHeader(headerField, headerFieldValue);
}
}
for (final Entry<String, String> entry : request.getQuery().entrySet()) {
httpRequest.queryParameter(entry.getKey(), entry.getValue());
}
return httpRequest;
}
内容来源于网络,如有侵权,请联系作者删除!