cxf restful

与cxf相关的pom配置

	<properties>
		
		<cxf.version>3.0.3</cxf.version>
		<!-- jackson 2.3.3 already included by spring boot, so here include jackson.jaxrs 2.3.3-->
		<com.fasterxml.jackson.jaxrs.version>2.3.3</com.fasterxml.jackson.jaxrs.version>

	</properties>	
<!-- use cxf to provider ws support, as spring ws only support contract-first approach which is a effort consuming approach -->
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxws</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-ws-security</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxrs</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<!-- Providers in cxf-rt-rs-extension-providers can only handle jaxb object & primiry object -->
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-rs-extension-providers</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-rs-client</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		
		<!-- jackson 2.3.3 already included by spring boot -->
		<!-- Providers in jackson-jaxrs-json-provider can handle pojo -->
		<dependency>
			<groupId>com.fasterxml.jackson.jaxrs</groupId>
			<artifactId>jackson-jaxrs-json-provider</artifactId>
			<version>${com.fasterxml.jackson.jaxrs.version}</version>
		</dependency>

 

<?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:jaxws="http://cxf.apache.org/jaxws"
	xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
	http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
	http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
	http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

	<cxf:bus>
		<cxf:features>
			<cxf:logging />
		</cxf:features>
	</cxf:bus>

	
	<jaxrs:server address="/rest" basePackages="net.gplatform.sudoor.server.,${application.basepackage}.">
		<jaxrs:providers>
			<!-- Providers in cxf-rt-rs-extension-providers can only handle jaxb object & primiry object -->
			<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"></bean>
		</jaxrs:providers>
	</jaxrs:server>
	
</beans>

 

 

restful里的HttpServletRequest request

public Response userRegister(@Context HttpServletRequest request){

 

 

 

 

 

你可能感兴趣的:(Restful)