本文整理匯總了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}