尽管在 axis2.xml 中注释了传输编码,但响应中的内容长度标头不存在
我有一个 axis2 服务在 TOMCAT 6.0.18 上运行,版本为 axis2 1.3。
我通过注释传输编码元素禁用了分块,并将 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 响应标头中看到内容长度。有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论