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


Java HttpVersion.HTTP_1_1属性代码示例

本文整理汇总了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"));
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:18,代码来源:RequestPropertiesRetainerTest.java

示例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;
}
 
开发者ID:jenkinsci,项目名称:lib-commons-httpclient,代码行数:14,代码来源:HttpMethodParams.java


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