http://cxf.apache.org/schemas/jaxrs.xsd

http://cxf.apache.org/docs/restful-services.html

示例:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml" /> <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider" />
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> <cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus> <jaxrs:server id="services" address="/">
<jaxrs:serviceBeans>
<bean class="cn.zno.HelloWorld" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider" />
<ref bean="jaxbProvider" />
</jaxrs:providers>
<jaxrs:extensionMappings>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</jaxrs:extensionMappings>
<jaxrs:languageMappings>
<entry key="en" value="en-gb" />
</jaxrs:languageMappings>
</jaxrs:server>
</beans>

没有endpoint

<xsd:element name="server">...</xsd:element>
<xsd:element name="client">...</xsd:element>

jaxrs:server

<xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
<xsd:attribute name="address" type="xsd:string"/>
<xsd:attribute name="bus" type="xsd:string"/>
<xsd:attribute name="serviceClass" type="xsd:string"/>
<xsd:attribute name="transportId" type="xsd:string"/>
<xsd:attribute name="modelRef" type="xsd:string"/>
<xsd:attribute name="bindingId" type="xsd:string"/>
<xsd:attribute name="staticSubresourceResolution" type="xsd:boolean"/>
<xsd:attribute name="beanNames" type="xsd:string"/>
<xsd:attribute name="serviceName" type="xsd:QName"/>
<xsd:attribute name="docLocation" type="xsd:string"/>
<xsd:attribute name="publishedEndpointUrl" type="xsd:string"/>
<xsd:attribute name="basePackages" type="xsd:string"/>
<xsd:attribute name="serviceAnnotation" type="xsd:string"/>
<xsd:attribute name="publish" type="xsd:boolean"/>
<xsd:all>
<xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="serviceFactories" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
<xsd:element name="serviceBeans" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="modelBeans" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="model" type="model" minOccurs="0"/>
<xsd:element name="providers" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="extensionMappings" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="languageMappings" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/>
<xsd:element name="resourceComparator" type="xsd:anyType" minOccurs="0"/>
</xsd:all>

开启日志

    <cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus> 增加后,请求时,增加如下日志:
七月 ,  :: 下午 org.apache.cxf.interceptor.LoggingInInterceptor
信息: Inbound Message
----------------------------
ID:
Address: http://localhost:8080/cxf-jaxrs-service/hello/jsonBean
Encoding: ISO--
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[application/json], cache-control=[no-cache], connection=[keep-alive], Content-Length=[], content-type=[application/json], host=[localhost:], pragma=[no-cache], user-agent=[Apache CXF 3.1.]}
Payload: {"val2":null,"val1":"Maple"}
--------------------------------------
七月 , :: 下午 org.apache.cxf.interceptor.LoggingOutInterceptor
信息: Outbound Message
---------------------------
ID:
Response-Code:
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Thu, Jul :: GMT]}
Payload: {"val2":"Maple","val1":"Maple"}
--------------------------------------

效果等同于:

<bean id="inInterceptors" class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
<bean id="outInterceptors" class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>

[...]

<jaxrs:inInterceptors>
  <ref bean="inInterceptors" />
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
  <ref bean="outInterceptors" />
</jaxrs:outInterceptors>

权限验证

http://cxf.apache.org/docs/security.html

配置 cxf-rs spring bean 文件的更多相关文章

  1. 配置 cxf-ws spring bean 文件

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  2. Spring Bean几种注入方式——setter(常用),构造器,注入内部Bean,注入集合,接口...

    依赖注入分为三种方式: 1.1构造器注入 构造器通过构造方法实现,构造方法有无参数都可以.在大部分情况下我们都是通过类的构造器来创建对象,Spring也可以采用反射机制通过构造器完成注入,这就是构造器 ...

  3. 【Spring】IoC容器 - Spring Bean作用域Scope(含SpringCloud中的RefreshScope )

    前言 上一章学习了[依赖来源],本章主要讨论SpringBean的作用域,我们这里讨论的Bean的作用域,很大程度都是默认只讨论依赖来源为[Spring BeanDefinition]的作用域,因为在 ...

  4. Spring配置bean文件的底层实现方式

    首先 bean文件如下: <beans> <bean id="date" class="java.util.Date"></bea ...

  5. Spring基础——在Spring Config 文件中配置 Bean

    一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...

  6. Spring bean工厂配置头文件

    命名 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  7. CXF和spring整合遇到的问题:No bean named 'cxf' is defined

    今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...

  8. webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成

    首先到CXF官网及spring官网下载相关jar架包,这个不多说.webservice是干嘛用的也不多说. 入门例子 模拟新增一个用户,并返回新增结果,成功还是失败. 大概的目录如上,很简单. Res ...

  9. [原创]java WEB学习笔记98:Spring学习---Spring Bean配置及相关细节:如何在配置bean,Spring容器(BeanFactory,ApplicationContext),如何获取bean,属性赋值(属性注入,构造器注入),配置bean细节(字面值,包含特殊字符,引用bean,null值,集合属性list map propert),util 和p 命名空间

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

随机推荐

  1. http chunked

    http chunked传输:将信息分段传输 好处: 不用指定content-length字段(总的要传输文件信息的长度),即可以将一整段信息分为若干段分别发送,最后发送chunked长度为0的信息表 ...

  2. [转载]百分之百自动登录2345王牌技术员联盟源代码(delphi)

    资源地址:http://download.csdn.net/detail/softlib/9670613

  3. 吴裕雄 实战PYTHON编程(10)

    import cv2 cv2.namedWindow("frame")cap = cv2.VideoCapture(0)while(cap.isOpened()): ret, im ...

  4. hive sql split 分隔符

    Hive字符串分割函数 split(str, regex) - Splits str around occurances that match regexTime taken: 0.769 secon ...

  5. 使用HTTP头去绕过WAF(bypasswaf)

    在用node http get 请求的时候,发现的 解决方案: Add headers to all Burp requests to bypass some WAF products. This e ...

  6. xpath的层级与逻辑定位

    xpath的层级与逻辑定位: 之前我们是通过class和id,name,如果我们所需要的元素没有class,id,name这样的元素,怎么定位呢 1.在不使用xpath情况下:元素没有属性值得时候怎么 ...

  7. WebDriverException: Message: f.QueryInterface is not a function

    WebDriverException: Message: f.QueryInterface is not a function 使用webdriver打开c.highpin.cn,结果报错,见下图: ...

  8. 基于mysql全文索引的深入理解

    最近要使用mysql的全文索引,一直没能成功,一个是只有MyISAM引擎支持,创建表时需要指定,而是需要对my.ini进行配置. 前言:本文简单讲述全文索引的应用实例,MYSQL演示版本5.5.24. ...

  9. css position定位详解

    position:static 默认方式: position:relative 相对定位,相对于原有位置进行移动,并且保留它在文件流中的占位: position:absolute 绝对定位,相对于最近 ...

  10. .net调用web邮箱发送邮件(转载)

    public static void SendEmail() { System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient( ...