1 Star 0 Fork 51

seixion / lemur-http

forked from 悟耘开源 / lemur-http
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-2-Clause

#requestProxy requestProxy 是为了把 http,以及webserver 的简单请求进行封装,做到接口化操作http接口 快速开发,高效完成

作者博客:http://blog.csdn.net/qjueyue
作者邮箱:qrb.jueyue@gmail.com
QQ群:  364192721

###作用:

  1. 可以使http请求进行接口化,使得http接口更好的和java做融合
  2. 融合json可以自动转为bean
  3. 也可以解析符合要求的xml
  4. 负责的返回string,大家可以自己解析

###使用方法:

1.配置httpclient和spring 融合,这个网上比较多
2.写接口与参数
3.注入调用接口

###适用项目:

与其他项目进行交互,调用地方接口较多的项目
使用连接池,对象返回复杂

###支持返回类型:

String,int,long,double
bean
list<bean>

###版本修改

  • 1.6.1

    • 新增本多种签名计算方法,可以有效减少签名计算类
  • 1.6.2

    • 使用IRequestParam注解替换了RequestParams 统一命名方式
    • IRequest 增加了 @Component 注解(可以被spring 识别名称)
    • 扫描类的工具改成了spring 的scan

     <!-- 注册 HTTP请求动态代理接口 -->
     <bean class="com.onepiece.requestproxy.factory.RequestBeanScannerConfigurer">
     	<property name="basePackage" value="com.jueyue.onepiece.test.request">
     	</property><!--符合了spring的写法-->
     </bean>

###demo 可以轻松设置一写基础参数,调用httpclient属性,接口化调用网络接口

	@IRequest("testRequest")
   public interface ITestRequest {
   
   	@IRequestMethod(type = RequestTypeEnum.GET, url = "http://api.map.baidu.com/telematics/v3/weather")
   	String testGet(@IRequestParam("location") String location,
   			@IRequestParam("output") String output,
   			@IRequestParam("ak") String ak);
   
   	@IRequestMethod(type = RequestTypeEnum.GET, url = "http://api.map.baidu.com/telematics/v3/weather")
   	BaiduWeatherEntity testGetEntity(
   			@IRequestParam("location") String location,
   			@IRequestParam("output") String output,
   			@IRequestParam("ak") String ak);
   
   	@IRequestMethod(connectTimeout = 120, url = "http://open.ikamobile.cn:8391/pur/train/number.json", type = RequestTypeEnum.GET)
   	public String queryTrainSchedule(
   			@IRequestParam("from_station_name") String fromStationName,
   			@IRequestParam("to_station_name") String toStationName,
   			@IRequestParam("date") String date,
   			@IRequestParam("train_type") String trainType);
   
   }
Copyright (c) 2014, jueyue All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

利用切面代理,以及httpclient把http请求方法化,可以方便的管理第三方的API,而不是重复的写接口 展开 收起
BSD-2-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/seixion/lemur-http.git
git@gitee.com:seixion/lemur-http.git
seixion
lemur-http
lemur-http
master

搜索帮助

14c37bed 8189591 565d56ea 8189591