如何更改 jaxrs 端点的属性以支持“mtom”

发布于 2024-09-04 09:12:49 字数 1520 浏览 4 评论 0原文

我创建了一个 RESTful Web 服务,并且我想在不使用 SOAP 的情况下将二进制文件发送到该服务。

CXF网站上有一些信息: XOP

但我找不到办法获取 CXF JAX-RS 端点,并设置 mtom-enabled 属性。

我的 Spring 配置是:

<jaxrs:server id="fis" address="http://172.20.41.40:8080/fis">
    <jaxrs:serviceBeans>
        <ref bean="FaultInfoResource" />
        <ref bean="ExplorationResultResource" />
    </jaxrs:serviceBeans>  
</jaxrs:server> 

<bean id="FaultInfoService"  parent="baseService" class="com.dfe.demo.FaultInfoService">
</bean>
<bean id="FaultInfoResource" class="com.dfe.demo.FaultInfoResource">
  <property name="faultInfoService" ref="FaultInfoService"/>
</bean> 

<bean id="ExplorationResultService"  parent="baseService" class="com.dfe.demo.ExplorationResultService">
</bean>
<bean id="ExplorationResultResource" class="com.dfe.demo.ExplorationResultResource">
  <property name="explorationResultService" ref="ExplorationResultService"/>
</bean>

我的服务器类是:

ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]{"com/dfe/iss/config/applicationContext.xml","com/dfe/demo/yearlyplan/cxf-servlet.xml"});
JAXRSServerFactoryBean fib = (JAXRSServerFactoryBean) ctx.getBean("fis");
fib.create();

I created a RESTful web service, and I want to send binary files to this service without SOAP.

There are some information on CXF website:
XOP

But I can't find a way to get the CXF JAX-RS endpoints, and set an mtom-enabled property.

My Spring config is:

<jaxrs:server id="fis" address="http://172.20.41.40:8080/fis">
    <jaxrs:serviceBeans>
        <ref bean="FaultInfoResource" />
        <ref bean="ExplorationResultResource" />
    </jaxrs:serviceBeans>  
</jaxrs:server> 

<bean id="FaultInfoService"  parent="baseService" class="com.dfe.demo.FaultInfoService">
</bean>
<bean id="FaultInfoResource" class="com.dfe.demo.FaultInfoResource">
  <property name="faultInfoService" ref="FaultInfoService"/>
</bean> 

<bean id="ExplorationResultService"  parent="baseService" class="com.dfe.demo.ExplorationResultService">
</bean>
<bean id="ExplorationResultResource" class="com.dfe.demo.ExplorationResultResource">
  <property name="explorationResultService" ref="ExplorationResultService"/>
</bean>

And my server class is:

ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]{"com/dfe/iss/config/applicationContext.xml","com/dfe/demo/yearlyplan/cxf-servlet.xml"});
JAXRSServerFactoryBean fib = (JAXRSServerFactoryBean) ctx.getBean("fis");
fib.create();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

躲猫猫 2024-09-11 09:12:49

试试这个:

<beans>
    <jaxrs:server id="bookstore1">
        <jaxrs:properties>
            <entry key="mtom-enabled" value="true"/>
        </jaxrs:properties>
    </jaxrs:server>  
</beans>

Try this:

<beans>
    <jaxrs:server id="bookstore1">
        <jaxrs:properties>
            <entry key="mtom-enabled" value="true"/>
        </jaxrs:properties>
    </jaxrs:server>  
</beans>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文