当前位置: 首页>>代码示例>>Java>>正文


Java HttpVersion.HTTP_1_0属性代码示例

本文整理汇总了Java中org.apache.http.HttpVersion.HTTP_1_0属性的典型用法代码示例。如果您正苦于以下问题:Java HttpVersion.HTTP_1_0属性的具体用法?Java HttpVersion.HTTP_1_0怎么用?Java HttpVersion.HTTP_1_0使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.http.HttpVersion的用法示例。


在下文中一共展示了HttpVersion.HTTP_1_0属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toProtocolVersion

private ProtocolVersion toProtocolVersion(String httpVersion) {
    switch (httpVersion) {
        case "HTTP/0.9":
        case "0.9":
            return HttpVersion.HTTP_0_9;
        case "HTTP/1.0":
        case "1.0":
            return HttpVersion.HTTP_1_0;
        case "HTTP/1.1":
        case "1.1":
            return HttpVersion.HTTP_1_1;
        default:
            throw new IllegalArgumentException("Invalid HTTP version: " + httpVersion);

    }
}
 
开发者ID:renatoathaydes,项目名称:rawhttp,代码行数:16,代码来源:RawHttpComponentsClient.java

示例2: responseToGetWithQueryFrom1_0OriginAndNoExpiresIsNotCached

@Test
public void responseToGetWithQueryFrom1_0OriginAndNoExpiresIsNotCached()
    throws Exception {
    final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
            new HttpGet("http://foo.example.com/bar?baz=quux"));
    final HttpResponse resp2 = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    resp2.setEntity(HttpTestUtils.makeBody(200));
    resp2.setHeader("Content-Length","200");
    resp2.setHeader("Date", DateUtils.formatDate(now));

    backendExpectsAnyRequestAndReturn(resp2);

    replayMocks();
    impl.execute(route, req2, context, null);
    verifyMocks();
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:16,代码来源:TestProtocolRecommendations.java

示例3: responseToGetWithQueryFrom1_0OriginVia1_1ProxyAndNoExpiresIsNotCached

@Test
public void responseToGetWithQueryFrom1_0OriginVia1_1ProxyAndNoExpiresIsNotCached()
    throws Exception {
    final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
            new HttpGet("http://foo.example.com/bar?baz=quux"));
    final HttpResponse resp2 = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    resp2.setEntity(HttpTestUtils.makeBody(200));
    resp2.setHeader("Content-Length","200");
    resp2.setHeader("Date", DateUtils.formatDate(now));
    resp2.setHeader("Via","1.0 someproxy");

    backendExpectsAnyRequestAndReturn(resp2);

    replayMocks();
    impl.execute(route, req2, context, null);
    verifyMocks();
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:17,代码来源:TestProtocolRecommendations.java

示例4: execute

void execute() throws Throwable {
    requestVersion = HttpVersion.HTTP_1_0;
    runTest(this);

    requestVersion = HttpVersion.HTTP_1_1;
    runTest(this);

    executorService.shutdown();
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:9,代码来源:HttpServerConformanceTest.java

示例5: upgrades1_0RequestTo1_1

@Test
public void upgrades1_0RequestTo1_1() throws Exception {
    req = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_0);
    final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(req);
    impl.makeRequestCompliant(wrapper);
    assertEquals(HttpVersion.HTTP_1_1, wrapper.getProtocolVersion());
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:7,代码来源:TestRequestProtocolCompliance.java

示例6: getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting

@Test
public void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
    policy = new ResponseCachingPolicy(0, true, true, false);
    request = new BasicHttpRequest("GET", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    Assert.assertFalse(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:7,代码来源:TestResponseCachingPolicy.java

示例7: headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting

@Test
public void headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
    policy = new ResponseCachingPolicy(0, true, true, false);
    request = new BasicHttpRequest("HEAD", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    Assert.assertFalse(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:7,代码来源:TestResponseCachingPolicy.java

示例8: getsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires

@Test
public void getsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
    request = new BasicHttpRequest("GET", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    Assert.assertTrue(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:8,代码来源:TestResponseCachingPolicy.java

示例9: headsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires

@Test
public void headsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
    policy = new ResponseCachingPolicy(0, true, false, false);
    request = new BasicHttpRequest("HEAD", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    Assert.assertTrue(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:TestResponseCachingPolicy.java

示例10: getsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires

@Test
public void getsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
    policy = new ResponseCachingPolicy(0, true, true, false);
    request = new BasicHttpRequest("GET", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    Assert.assertFalse(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:TestResponseCachingPolicy.java

示例11: headsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires

@Test
public void headsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
    policy = new ResponseCachingPolicy(0, true, true, false);
    request = new BasicHttpRequest("HEAD", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    Assert.assertFalse(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:TestResponseCachingPolicy.java

示例12: getsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires

@Test
public void getsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
    request = new BasicHttpRequest("GET", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    response.setHeader("Via", "1.1 someproxy");
    Assert.assertTrue(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:TestResponseCachingPolicy.java

示例13: headsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires

@Test
public void headsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
    policy = new ResponseCachingPolicy(0, true, false, false);
    request = new BasicHttpRequest("HEAD", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    response.setHeader("Date", DateUtils.formatDate(now));
    response.setHeader("Expires", DateUtils.formatDate(tenSecondsFromNow));
    response.setHeader("Via", "1.1 someproxy");
    Assert.assertTrue(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:10,代码来源:TestResponseCachingPolicy.java

示例14: testRequestExpectContinueHTTP10

@Test
public void testRequestExpectContinueHTTP10() throws Exception {
    final HttpContext context = new BasicHttpContext(null);
    final RequestConfig config = RequestConfig.custom().setExpectContinueEnabled(true).build();
    context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
    final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
            "POST", "/", HttpVersion.HTTP_1_0);
    final String s = "whatever";
    final StringEntity entity = new StringEntity(s, "US-ASCII");
    request.setEntity(entity);
    final RequestExpectContinue interceptor = new RequestExpectContinue();
    interceptor.process(request, context);
    final Header header = request.getFirstHeader(HTTP.EXPECT_DIRECTIVE);
    Assert.assertNull(header);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:15,代码来源:TestRequestExpectContinue.java

示例15: getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable

@Test
public void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable() {
    request = new BasicHttpRequest("GET", "/foo?s=bar");
    response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
    Assert.assertFalse(policy.isResponseCacheable(request, response));
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:6,代码来源:TestResponseCachingPolicy.java


注:本文中的org.apache.http.HttpVersion.HTTP_1_0属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。