一.开端:
前段时间做Restful接口调用相关功能,找了几个方法,最终选用了Spring自带的rest服务请求的方法,但是也看到了另一种方式ResteasyClient,尝试着写了一个小的Demo:
这个东西是JBoss的,所以需要引入的jar有:
1 <!-- Apache Commons --> 2 <dependency org="commons-codec" name="commons-codec" rev="1.10" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 3 <dependency org="commons-pool" name="commons-pool" rev="1.6" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 4 <dependency org="commons-io" name="commons-io" rev="2.4" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 5 <!-- JSR303 Validation --> 6 <dependency org="javax.validation" name="validation-api" rev="1.1.0.Final" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 7 <dependency org="org.hibernate" name="hibernate-validator" rev="5.1.3.Final" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 8 <dependency org="com.fasterxml" name="classmate" rev="1.1.0" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 9 <!-- json序列化相关 --> 10 <dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.7.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 11 <dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.7.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 12 <dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.7.3" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 13 <!-- Log 相关内容 --> 14 <dependency org="org.slf4j" name="slf4j-api" rev="1.7.10" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 15 <dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.7.10" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="false"/> 16 <dependency org="org.slf4j" name="jul-to-slf4j" rev="1.7.10" conf="compile->compile(*),master(*);runtime->runtime(*)" transitive="