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

712 views Asked by At

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 name="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

There are 0 answers