开发者

content-length header in response not present despite commenting transfer-encoding in axis2.xml

开发者 https://www.devze.com 2023-02-13 05:31 出处:网络
I have an axis2 service running on TOMCAT 6.0.18 with axis2 1.3 version. I disabled chunking by commenting the transfer-encoding element and changed the HTTP to 1.0

I have an axis2 service running on TOMCAT 6.0.18 with axis2 1.3 version.

I disabled chunking by commenting the transfer-encoding element and changed the HTTP to 1.0 as shown below:

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

I also implemented LifeCycle interface in the service implementation class.

Here is the init() method code:

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); 

Despite having these changes, I still don't see the content-length in the HTTP response header when I called the service. Any ideas?

0

精彩评论

暂无评论...
验证码 换一张
取 消