本文整理汇总了Java中org.apache.coyote.http11.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.apache.coyote.http11包,在下文中一共展示了Constants类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseCRLF
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse CRLF at end of chunk.
*
* @param tolerant Should tolerant parsing (LF and CRLF) be used? This
* is recommended (RFC2616, section 19.3) for message
* headers.
*/
protected void parseCRLF(boolean tolerant) throws IOException {
boolean eol = false;
boolean crfound = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfNoData"));
}
}
if (buf[pos] == Constants.CR) {
if (crfound) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfCRCR"));
}
crfound = true;
} else if (buf[pos] == Constants.LF) {
if (!tolerant && !crfound) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfNoCR"));
}
eol = true;
} else {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlf"));
}
pos++;
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:37,代码来源:ChunkedInputFilter.java
示例2: parseCRLF
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse CRLF at end of chunk.
*/
protected boolean parseCRLF()
throws IOException {
boolean eol = false;
boolean crfound = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
throw new IOException("Invalid CRLF");
}
if (buf[pos] == Constants.CR) {
if (crfound) throw new IOException("Invalid CRLF, two CR characters encountered.");
crfound = true;
} else if (buf[pos] == Constants.LF) {
if (!crfound) throw new IOException("Invalid CRLF, no CR character encountered.");
eol = true;
} else {
throw new IOException("Invalid CRLF");
}
pos++;
}
return true;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:ChunkedInputFilter.java
示例3: parseCRLF
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse CRLF at end of chunk.
*
* @param tolerant
* Should tolerant parsing (LF and CRLF) be used? This is
* recommended (RFC2616, section 19.3) for message headers.
*/
protected void parseCRLF(boolean tolerant) throws IOException {
boolean eol = false;
boolean crfound = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfNoData"));
}
}
if (buf[pos] == Constants.CR) {
if (crfound) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfCRCR"));
}
crfound = true;
} else if (buf[pos] == Constants.LF) {
if (!tolerant && !crfound) {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlfNoCR"));
}
eol = true;
} else {
throwIOException(sm.getString("chunkedInputFilter.invalidCrlf"));
}
pos++;
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:37,代码来源:ChunkedInputFilter.java
示例4: parseCRLF
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse CRLF at end of chunk.
*
* @param tolerant Should tolerant parsing (LF and CRLF) be used? This
* is recommended (RFC2616, section 19.3) for message
* headers.
*/
protected void parseCRLF(boolean tolerant) throws IOException {
boolean eol = false;
boolean crfound = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
throw new IOException("Invalid CRLF");
}
if (buf[pos] == Constants.CR) {
if (crfound) throw new IOException("Invalid CRLF, two CR characters encountered.");
crfound = true;
} else if (buf[pos] == Constants.LF) {
if (!tolerant && !crfound) {
throw new IOException("Invalid CRLF, no CR character encountered.");
}
eol = true;
} else {
throw new IOException("Invalid CRLF");
}
pos++;
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:36,代码来源:ChunkedInputFilter.java
示例5: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk.
* A chunk header can look like one of the following:<br />
* A10CRLF<br />
* F23;chunk-extension to be ignoredCRLF
*
* <p>
* The letters before CRLF or ';' (whatever comes first) must be valid hex
* digits. We should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid
* header according to the spec.
*/
protected boolean parseChunkHeader() throws IOException {
int result = 0;
boolean eol = false;
int readDigit = 0;
boolean extension = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
return false;
}
if (buf[pos] == Constants.CR || buf[pos] == Constants.LF) {
parseCRLF(false);
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON && !extension) {
// First semi-colon marks the start of the extension. Further
// semi-colons may appear to separate multiple chunk-extensions.
// These need to be processed as part of parsing the extensions.
extension = true;
extensionSize++;
} else if (!extension) {
//don't read data after the trailer
int charValue = HexUtils.getDec(buf[pos]);
if (charValue != -1 && readDigit < 8) {
readDigit++;
result = (result << 4) | charValue;
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
return false;
}
} else {
// Extension 'parsing'
// Note that the chunk-extension is neither parsed nor
// validated. Currently it is simply ignored.
extensionSize++;
if (maxExtensionSize > -1 && extensionSize > maxExtensionSize) {
throwIOException(sm.getString("chunkedInputFilter.maxExtension"));
}
}
// Parsing the CRLF increments pos
if (!eol) {
pos++;
}
}
if (readDigit == 0 || result < 0) {
return false;
}
if (result == 0) {
endChunk = true;
}
remaining = result;
return true;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:73,代码来源:ChunkedInputFilter.java
示例6: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk.
* A chunk header can look like
* A10CRLF
* F23;chunk-extension to be ignoredCRLF
* The letters before CRLF but after the trailer mark, must be valid hex digits,
* we should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid header
* according to spec
*/
protected boolean parseChunkHeader()
throws IOException {
int result = 0;
boolean eol = false;
boolean readDigit = false;
boolean trailer = false;
while (!eol) {
if (pos >= lastValid) {
// In non blocking mode, no new chunk follows, even if data was present
int n = readBytes();
if (n < 0) {
throw new IOException("Invalid chunk header");
} else if (n == 0) {
return false;
}
}
if (buf[pos] == Constants.CR) {
} else if (buf[pos] == Constants.LF) {
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON) {
trailer = true;
} else if (!trailer) {
//don't read data after the trailer
if (HexUtils.DEC[buf[pos]] != -1) {
readDigit = true;
result *= 16;
result += HexUtils.DEC[buf[pos]];
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
throw new IOException("Invalid chunk header");
}
}
pos++;
}
if (!readDigit || (result < 0))
throw new IOException("Invalid chunk header");
if (result == 0)
endChunk = true;
remaining = result;
return true;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:63,代码来源:ChunkedInputFilter.java
示例7: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk. A chunk header can look like one of the
* following:<br />
* A10CRLF<br />
* F23;chunk-extension to be ignoredCRLF
*
* <p>
* The letters before CRLF or ';' (whatever comes first) must be valid hex
* digits. We should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid header
* according to the spec.
*/
protected boolean parseChunkHeader() throws IOException {
int result = 0;
boolean eol = false;
int readDigit = 0;
boolean extension = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
return false;
}
if (buf[pos] == Constants.CR || buf[pos] == Constants.LF) {
parseCRLF(false);
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON && !extension) {
// First semi-colon marks the start of the extension. Further
// semi-colons may appear to separate multiple chunk-extensions.
// These need to be processed as part of parsing the extensions.
extension = true;
extensionSize++;
} else if (!extension) {
// don't read data after the trailer
int charValue = HexUtils.getDec(buf[pos]);
if (charValue != -1 && readDigit < 8) {
readDigit++;
result = (result << 4) | charValue;
} else {
// we shouldn't allow invalid, non hex characters
// in the chunked header
return false;
}
} else {
// Extension 'parsing'
// Note that the chunk-extension is neither parsed nor
// validated. Currently it is simply ignored.
extensionSize++;
if (maxExtensionSize > -1 && extensionSize > maxExtensionSize) {
throwIOException(sm.getString("chunkedInputFilter.maxExtension"));
}
}
// Parsing the CRLF increments pos
if (!eol) {
pos++;
}
}
if (readDigit == 0 || result < 0) {
return false;
}
if (result == 0) {
endChunk = true;
}
remaining = result;
return true;
}
开发者ID:how2j,项目名称:lazycat,代码行数:73,代码来源:ChunkedInputFilter.java
示例8: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk.
* A chunk header can look like one of the following:<br />
* A10CRLF<br />
* F23;chunk-extension to be ignoredCRLF
*
* <p>
* The letters before CRLF or ';' (whatever comes first) must be valid hex
* digits. We should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid
* header according to the spec.
*/
protected boolean parseChunkHeader()
throws IOException {
int result = 0;
boolean eol = false;
int readDigit = 0;
boolean extension = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
return false;
}
if (buf[pos] == Constants.CR || buf[pos] == Constants.LF) {
parseCRLF(false);
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON && !extension) {
// First semi-colon marks the start of the extension. Further
// semi-colons may appear to separate multiple chunk-extensions.
// These need to be processed as part of parsing the extensions.
extension = true;
extensionSize++;
} else if (!extension) {
//don't read data after the trailer
int charValue = HexUtils.getDec(buf[pos]);
if (charValue != -1 && readDigit < 8) {
readDigit++;
result = (result << 4) | charValue;
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
return false;
}
} else {
// Extension 'parsing'
// Note that the chunk-extension is neither parsed nor
// validated. Currently it is simply ignored.
extensionSize++;
if (maxExtensionSize > -1 && extensionSize > maxExtensionSize) {
throw new IOException("maxExtensionSize exceeded");
}
}
// Parsing the CRLF increments pos
if (!eol) {
pos++;
}
}
if (readDigit == 0 || result < 0)
return false;
if (result == 0)
endChunk = true;
remaining = result;
if (remaining < 0)
return false;
return true;
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:77,代码来源:ChunkedInputFilter.java
示例9: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk.
* A chunk header can look like one of the following:<br />
* A10CRLF<br />
* F23;chunk-extension to be ignoredCRLF
*
* <p>
* The letters before CRLF or ';' (whatever comes first) must be valid hex
* digits. We should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid
* header according to the spec.
*/
protected boolean parseChunkHeader() throws IOException {
int result = 0;
boolean eol = false;
int readDigit = 0;
boolean extension = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
return false;
}
if (buf[pos] == Constants.CR || buf[pos] == Constants.LF) {
parseCRLF(false);
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON && !extension) {
// First semi-colon marks the start of the extension. Further
// semi-colons may appear to separate multiple chunk-extensions.
// These need to be processed as part of parsing the extensions.
extension = true;
extensionSize++;
} else if (!extension) {
//don't read data after the trailer
int charValue = HexUtils.getDec(buf[pos]);
if (charValue != -1 && readDigit < 8) {
readDigit++;
result = (result << 4) | charValue;
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
return false;
}
} else {
// Extension 'parsing'
// Note that the chunk-extension is neither parsed nor
// validated. Currently it is simply ignored.
extensionSize++;
if (maxExtensionSize > -1 && extensionSize > maxExtensionSize) {
throwIOException(sm.getString("chunkedInputFilter.maxExtension"));
}
}
// Parsing the CRLF increments pos
if (!eol) {
pos++;
}
}
if (readDigit == 0 || result < 0) {
return false;
}
if (result == 0) {
endChunk = true;
}
remaining = result;
if (remaining < 0) {
return false;
}
return true;
}
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:77,代码来源:ChunkedInputFilter.java
示例10: parseChunkHeader
import org.apache.coyote.http11.Constants; //导入依赖的package包/类
/**
* Parse the header of a chunk.
* A chunk header can look like
* A10CRLF
* F23;chunk-extension to be ignoredCRLF
* The letters before CRLF but after the trailer mark, must be valid hex digits,
* we should not parse F23IAMGONNAMESSTHISUP34CRLF as a valid header
* according to spec
*/
protected boolean parseChunkHeader()
throws IOException {
int result = 0;
boolean eol = false;
boolean readDigit = false;
boolean trailer = false;
while (!eol) {
if (pos >= lastValid) {
if (readBytes() <= 0)
return false;
}
if (buf[pos] == Constants.CR) {
// FIXME: Improve parsing to check for CRLF
} else if (buf[pos] == Constants.LF) {
eol = true;
} else if (buf[pos] == Constants.SEMI_COLON) {
trailer = true;
} else if (!trailer) {
//don't read data after the trailer
if (HexUtils.getDec(buf[pos]) != -1) {
readDigit = true;
result *= 16;
result += HexUtils.getDec(buf[pos]);
} else {
//we shouldn't allow invalid, non hex characters
//in the chunked header
return false;
}
}
pos++;
}
if (!readDigit)
return false;
if (result == 0)
endChunk = true;
remaining = result;
if (remaining < 0)
return false;
return true;
}
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:61,代码来源:ChunkedInputFilter.java
注:本文中的org.apache.coyote.http11.Constants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论