REST-Apache CXF-Schema验证

时间:2013-01-04 13:37:58

标签: apache validation rest schema cxf

我正在使用Apache CXF(与spring混合)使用RESTful Webservice。 我在我的WADL中公开了两个服务。

对于我的Webservice的每个请求,我需要验证对特定模式的请求。我公开的服务之一使用特定模式,其他服务符合其他特定模式。

你能帮助我吗?

1 个答案:

答案 0 :(得分:1)

有几种方法可以满足您的需求。一种方法是使用jaxrs:schemaLocations元素:

<beans>
    <jaxrs:server address="/" serviceClass="com.something.ServiceClass">
        <jaxrs:schemaLocations>
            <jaxrs:schemaLocation>classpath:/schemas/a.xsd</jaxrs:schemaLocation>
            <jaxrs:schemaLocation>classpath:/schemas/b.xsd</jaxrs:schemaLocation>
        </jaxrs:schemaLocations>
    </jaxrs:server>
</beans>

有关详细信息和示例,请参阅此link

相关问题