本文整理汇总了Java中org.apache.commons.httpclient.HttpVersion.HTTP_1_1属性的典型用法代码示例。如果您正苦于以下问题:Java HttpVersion.HTTP_1_1属性的具体用法?Java HttpVersion.HTTP_1_1怎么用?Java HttpVersion.HTTP_1_1使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.httpclient.HttpVersion
的用法示例。
在下文中一共展示了HttpVersion.HTTP_1_1属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformMessage_normal_relevantPropertiesRetained
@Test
public void transformMessage_normal_relevantPropertiesRetained() throws Exception {
HttpRequest request = new HttpRequest(new RequestLine("GET", REQUEST, HttpVersion.HTTP_1_1),
new Header[]{new Header("testHeader", "testValue")}, ENCODING);
MuleMessage message = new HttpMuleMessageFactory(context()).create(request, "UTF-8");
retainer.retainRequestProperties(message);
Map<String, Object> retainedProperties =
message.getInvocationProperty(RequestPropertiesRetainer.INITIAL_REQUEST_PROPERTY);
assertThat(retainedProperties.size(), is(7));
@SuppressWarnings("unchecked")
Map<String, String> headers = (Map<String, String>) retainedProperties.get(HttpConnector.HTTP_HEADERS);
assertThat(headers.get("testHeader"), is("testValue"));
assertThat(retainedProperties.get(HttpConnector.HTTP_METHOD_PROPERTY).toString(), is("GET"));
assertThat(retainedProperties.get(HttpConnector.HTTP_VERSION_PROPERTY).toString(), is("HTTP/1.1"));
assertThat(retainedProperties.get(HttpConnector.HTTP_REQUEST_PROPERTY).toString(), is(REQUEST));
assertThat(retainedProperties.get(HttpConnector.HTTP_QUERY_STRING).toString(), is("query=value"));
}
示例2: getVersion
/**
* Returns {@link HttpVersion HTTP protocol version} to be used by the
* {@link org.apache.commons.httpclient.HttpMethod HTTP methods} that
* this collection of parameters applies to.
*
* @return {@link HttpVersion HTTP protocol version}
*/
public HttpVersion getVersion() {
Object param = getParameter(PROTOCOL_VERSION);
if (param == null) {
return HttpVersion.HTTP_1_1;
}
return (HttpVersion)param;
}