Tag - HttpClient

HttpClient java xml    2017-07-19 21:20:57    782


介绍:我现在有一个对象page,需要将page对象转换为xml格式并以binary方式传输到服务端
其中涉及到的技术点有:
1、对象转xml流
2、输出流转输入流
3、httpClient发送二进制流数据

POM文件依赖配置
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.5.2</version>
		</dependency>
		
		<dependency>
		  <groupId>org.apache.httpcomponents</groupId>
		  <artifactId>httpmime</artifactId>
		  <version>4.5.2</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.2.4</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.xwiki.platform</groupId>
			<artifactId>xwiki-platform-rest-model</artifactId>
			<version>7