當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicHttpRequest.setHeader方法代碼示例

本文整理匯總了Java中org.apache.http.message.BasicHttpRequest.setHeader方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicHttpRequest.setHeader方法的具體用法?Java BasicHttpRequest.setHeader怎麽用?Java BasicHttpRequest.setHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.message.BasicHttpRequest的用法示例。


在下文中一共展示了BasicHttpRequest.setHeader方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testResponsesToRequestsWithAuthorizationHeadersAreCacheableByNonSharedCache

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testResponsesToRequestsWithAuthorizationHeadersAreCacheableByNonSharedCache() {
    policy = new ResponseCachingPolicy(0, false, false, false);
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    Assert.assertTrue(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:TestResponseCachingPolicy.java

示例2: testAuthorizedResponsesWithSMaxAgeAreCacheable

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testAuthorizedResponsesWithSMaxAgeAreCacheable() {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    response.setHeader("Cache-Control","s-maxage=3600");
    Assert.assertTrue(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:TestResponseCachingPolicy.java

示例3: testAuthorizedResponsesWithMustRevalidateAreCacheable

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testAuthorizedResponsesWithMustRevalidateAreCacheable() {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    response.setHeader("Cache-Control","must-revalidate");
    Assert.assertTrue(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:TestResponseCachingPolicy.java

示例4: testAuthorizedResponsesWithCacheControlPublicAreCacheable

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testAuthorizedResponsesWithCacheControlPublicAreCacheable() {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    response.setHeader("Cache-Control","public");
    Assert.assertTrue(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:TestResponseCachingPolicy.java

示例5: testAuthorizedResponsesWithCacheControlMaxAgeAreNotCacheable

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testAuthorizedResponsesWithCacheControlMaxAgeAreNotCacheable() {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    response.setHeader("Cache-Control","max-age=3600");
    Assert.assertFalse(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:8,代碼來源:TestResponseCachingPolicy.java

示例6: testDoesNotInvalidateRequestsWithClientCacheControlHeaders

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testDoesNotInvalidateRequestsWithClientCacheControlHeaders() throws Exception {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Cache-Control","no-cache");

    impl.flushInvalidatedCacheEntries(host, request);

    verify(mockStorage).getEntry("http://foo.example.com:80/");
    verifyNoMoreInteractions(mockStorage);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:11,代碼來源:TestCacheInvalidator.java

示例7: testDoesNotInvalidateRequestsWithClientPragmaHeaders

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testDoesNotInvalidateRequestsWithClientPragmaHeaders() throws Exception {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Pragma","no-cache");

    impl.flushInvalidatedCacheEntries(host, request);

    verify(mockStorage).getEntry("http://foo.example.com:80/");
    verifyNoMoreInteractions(mockStorage);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:11,代碼來源:TestCacheInvalidator.java

示例8: testResponsesToRequestsWithAuthorizationHeadersAreNotCacheableBySharedCache

import org.apache.http.message.BasicHttpRequest; //導入方法依賴的package包/類
@Test
public void testResponsesToRequestsWithAuthorizationHeadersAreNotCacheableBySharedCache() {
    request = new BasicHttpRequest("GET","/",HTTP_1_1);
    request.setHeader("Authorization","Basic dXNlcjpwYXNzd2Q=");
    Assert.assertFalse(policy.isResponseCacheable(request,response));
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:7,代碼來源:TestResponseCachingPolicy.java


注:本文中的org.apache.http.message.BasicHttpRequest.setHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。