尽管在axis2.xml中注释了transfer-encoding,但内容长度标头响应不存在

时间:2011-02-23 21:57:54

标签: axis2 tomcat6 content-length transfer-encoding

我在带有axis2 1.3版本的TOMCAT 6.0.18上运行了axis2服务。

我通过注释transfer-encoding元素禁用了分块,并将HTTP更改为1.0 如下图所示:

 <transportSender name="http" 
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> 
        <parameter name="PROTOCOL">HTTP/1.0</parameter> 
        <!-- <parameter name="Transfer-Encoding">chunked</parameter> --> 

我还在服务实现类中实现了LifeCycle接口。

以下是init()方法代码:

public void init(ServiceContext arg0) throws AxisFault { 
                // TODO Auto-generated method stub 

                 arg0.getConfigurationContext().setProperty(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED,Boolean.FALSE); 

arg0.getConfigurationContext().setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10); 

MessageContext responseMessageContext = 
                       MessageContext.getCurrentMessageContext().getOperationContext().getMessageContext( 
                               WSDLConstants.MESSAGE_LABEL_OUT_VALUE); 


                 responseMessageContext.setProperty(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED,Boolean.FALSE); 

responseMessageContext.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10); 

尽管有这些更改,但在调用服务时,我仍然没有看到HTTP响应头中的内容长度。有任何想法吗?

0 个答案:

没有答案