本文整理汇总了Java中org.apache.commons.httpclient.HttpParser类的典型用法代码示例。如果您正苦于以下问题:Java HttpParser类的具体用法?Java HttpParser怎么用?Java HttpParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpParser类属于org.apache.commons.httpclient包,在下文中一共展示了HttpParser类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readRequest
import org.apache.commons.httpclient.HttpParser; //导入依赖的package包/类
public SimpleRequest readRequest() throws IOException {
try {
String line = null;
do {
line = HttpParser.readLine(in, HTTP_ELEMENT_CHARSET);
} while (line != null && line.length() == 0);
if (line == null) {
setKeepAlive(false);
return null;
}
SimpleRequest request = new SimpleRequest(
RequestLine.parseLine(line),
HttpParser.parseHeaders(this.in, HTTP_ELEMENT_CHARSET),
this.in);
return request;
} catch (IOException e) {
close();
throw e;
}
}
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:22,代码来源:SimpleHttpServerConnection.java
示例2: readResponse
import org.apache.commons.httpclient.HttpParser; //导入依赖的package包/类
public SimpleResponse readResponse() throws IOException {
try {
String line = null;
do {
line = HttpParser.readLine(in, HTTP_ELEMENT_CHARSET);
} while (line != null && line.length() == 0);
if (line == null) {
setKeepAlive(false);
return null;
}
SimpleResponse response = new SimpleResponse(
new StatusLine(line),
HttpParser.parseHeaders(this.in, HTTP_ELEMENT_CHARSET),
this.in);
return response;
} catch (IOException e) {
close();
throw e;
}
}
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:22,代码来源:SimpleHttpServerConnection.java
示例3: adaptWARCHTTPResponse
import org.apache.commons.httpclient.HttpParser; //导入依赖的package包/类
private CaptureSearchResult adaptWARCHTTPResponse(CaptureSearchResult result,
WARCRecord rec) throws IOException {
ArchiveRecordHeader header = rec.getHeader();
// need to parse the documents HTTP message and headers here: WARCReader
// does not implement this... yet..
byte [] statusBytes = HttpParser.readRawLine(rec);
int eolCharCount = getEolCharsCount(statusBytes);
if (eolCharCount <= 0) {
throw new RecoverableIOException("Failed to read http status where one " +
" was expected: " +
((statusBytes == null) ? "(null)" : new String(statusBytes)));
}
String statusLine = EncodingUtil.getString(statusBytes, 0,
statusBytes.length - eolCharCount, ARCConstants.DEFAULT_ENCODING);
if ((statusLine == null) ||
!StatusLine.startsWithHTTP(statusLine)) {
throw new RecoverableIOException("Failed parse of http status line.");
}
StatusLine status = new StatusLine(statusLine);
result.setHttpCode(String.valueOf(status.getStatusCode()));
Header[] headers = HttpParser.parseHeaders(rec,
ARCConstants.DEFAULT_ENCODING);
annotater.annotateHTTPContent(result,rec,headers,header.getMimetype());
return result;
}
开发者ID:netarchivesuite,项目名称:netarchivesuite-svngit-migration,代码行数:32,代码来源:NetarchiveSuiteWARCRecordToSearchResultAdapter.java
示例4: getHttpHeaders
import org.apache.commons.httpclient.HttpParser; //导入依赖的package包/类
private Header[] getHttpHeaders(ArchiveRecord nativeRecord) throws IOException {
if (nativeRecord instanceof ARCRecord) {
return ((ARCRecord) nativeRecord).getHttpHeaders();
} else if (nativeRecord instanceof WARCRecord) {
WARCRecord warcRecord = (WARCRecord) nativeRecord;
if (warcRecord.hasContentHeaders()) {
Header[] headers = HttpParser.parseHeaders(nativeRecord, DEFAULT_ENCODING);
return headers;
}
}
return new Header[0];
}
开发者ID:shsdev,项目名称:archiventory,代码行数:13,代码来源:ArcRecordReader.java
示例5: skipHeaders
import org.apache.commons.httpclient.HttpParser; //导入依赖的package包/类
private void skipHeaders(ArchiveRecord record) throws IOException {
HttpParser.parseHeaders(record, WARCConstants.DEFAULT_ENCODING);
}
开发者ID:DIA-NZ,项目名称:webcurator,代码行数:4,代码来源:ArcDigitalAssetStoreService.java
注:本文中的org.apache.commons.httpclient.HttpParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论