• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HttpParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ArbitraryMeasurement类代码示例发布时间:2022-05-23
下一篇:
Java HazelcastException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap