spring RestTemplate 实例(NameValuePair)
第一种:
public List<NameValuePair> getThirdsysPermissionRest(String url,ThirdsysFuncpDTO thirdsysFuncpDTO){
RestTemplate restTemplate = new RestTemplate();
// 查询条件
HttpEntity<ThirdsysFuncpDTO> requestEntity = new HttpEntity<ThirdsysFuncpDTO>(
thirdsysFuncpDTO);
// 查询结果
ResponseEntity<List> result;
// 通过rest的post方法取得数据
result = restTemplate.postForEntity(url, requestEntity,List.class);
// 结果内容
List<NameValuePair> resutl = null;
if(ObjectUtils.isNotEmpty(result)){
resutl = result.getBody();
}
return resutl;
}
public List<NameValuePair> tmpPermission(ThirdsysFuncpDTO thirdsysFuncpDTO){
List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("1", "djfk"));
list.add(new BasicNameValuePair("2", "123"));
list.add(new BasicNameValuePair("3", "qweqwe"));
list.add(new BasicNameValuePair("4", "3asfd"));
list.add(new BasicNameValuePair("5", "你好"));
return list;
}
@RequestMapping(value = "/UserThirdsysfunc/test", method = RequestMethod.POST)
public @ResponseBody List<NameValuePair> getDataset(HttpServletRequest request,
HttpServletResponse response, @RequestBody ThirdsysFuncpDTO thirdsysFuncpDTO) {
return userThirdsysfuncManager.tmpPermission(thirdsysFuncpDTO);
}
另外一种:
public JSONArray getRateQueryController(Integer unitinfoId, Integer rmtypeId, Integer ratedefId,
Integer setcurrencyId, String startdtString, String enddtString, Integer memberId, Integer tmnlplfid) {
RestTemplate restTemplate = new RestTemplate();
String str = restTemplate.getForObject(result_url+"?unitinfoId="
+ unitinfoId + "&rmtypeId=" + rmtypeId + "&ratedefId=" + ratedefId + "&setcurrencyId=" + setcurrencyId
+ "&startdtString=" + startdtString + "&enddtString=" + enddtString + "&memberId=" + memberId
+ "&tmnlplfid=" + tmnlplfid, String.class);
JSONArray jsonarray = JSONArray.fromObject(str);
return jsonarray;
};
public List<ResultRatedtl> getRateQueryResult(Integer unitinfoId, Integer rmtypeId, Integer ratedefId, Integer setcurrencyId, String startdtString, String enddtString,
Integer memberId, Integer tmnlplfid) {
JSONArray jsonarray = rateManager.getRateQueryController(unitinfoId, rmtypeId, ratedefId, setcurrencyId, startdtString, enddtString, memberId, tmnlplfid);
List<ResultRatedtl> list = (List<ResultRatedtl>) JSONArray.toCollection(jsonarray, ResultRatedtl.class);
return list;
}
@RequestMapping(value = "/RateQuery/result", method = RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody List<ResultRatedtl> getRatedefQueryResult(OrderParamDTO orderParamDTO) {
List<ResultRatedtl> list = rateQueryManager.getRatedefQueryResult(orderParamDTO);
return list;
}
spring RestTemplate 实例(NameValuePair)的更多相关文章
- Spring RestTemplate详解
Spring RestTemplate详解 1.什么是REST? REST(RepresentationalState Transfer)是Roy Fielding 提出的一个描述互联系统架构风格 ...
- Spring RestTemplate 的介绍和使用-入门
RestTemplate是什么? 传统情况下在java代码里访问restful服务,一般使用Apache的HttpClient.不过此种方法使用起来太过繁琐.spring提供了一种简单便捷的模板类来进 ...
- Spring RestTemplate: 比httpClient更优雅的Restful URL访问, java HttpPost with header
{ "Author": "tomcat and jerry", "url":"http://www.cnblogs.com/tom ...
- Spring RestTemplate介绍
http://www.cnblogs.com/rollenholt/p/3894117.html RestTemplate 这篇文章打算介绍一下Spring的RestTemplate.我这边以前设计到 ...
- How to Send an HTTP Header With Every Request With Spring RestTemplate
In Know Which Apps Are Hitting Your Web Service, I showed how to write a servlet filter that enforce ...
- spring得到实例和new一个实例,哪个快?
spring配置的bean是默认单例,那么在程序中,得到一个实例一定比创建一个实例的速度快,也更加省资源.今天实际测试的时候发现,new 一个对象比spring得到一个对象快多了.后面自己又加了个单例 ...
- Spring Security4实例(Java config版)——ajax登录,自定义验证
本文源码请看这里 相关文章: Spring Security4实例(Java config 版) -- Remember-Me 首先添加起步依赖(如果不是springboot项目,自行切换为Sprin ...
- Spring Security4实例(Java config 版) —— Remember-Me
本文源码请看这里 相关文章: Spring Security4实例(Java config版)--ajax登录,自定义验证 Spring Security提供了两种remember-me的实现,一种是 ...
- Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置
用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before.@Around和@After等advice.最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到了A ...
随机推荐
- unity3d 中动画的帧事件
代码事件监听 using UnityEngine; using System.Collections; public class BoxEventScript : MonoBehaviour { vo ...
- TCP打洞技术
//转http://iamgyg.blog.163.com/blog/static/3822325720118202419740/ 建立穿越NAT设备的p2p的TCP连接仅仅比UDP复杂一点点,TCP ...
- FOJ题目Problem 2082 过路费 (link cut tree边权更新)
Problem 2082 过路费 Accept: 382 Submit: 1279 Time Limit: 1000 mSec Memory Limit : 32768 KB Proble ...
- 【Cocos2d-x】坐标系和图层
在Cocos2D-X中,存在四种坐标系: 1.OpenGL坐标系:该坐标系原点在屏幕左下角.x轴向右,y轴向上.这也就是cocos2dx中用到的坐标系所以没啥好说的. 2.屏幕坐标系(UIKit坐标) ...
- ”危险“的RESTRICT与GCC的编译优化(编程者对编译器所做的一个“承诺”:使用restrict修饰过的指针,它所指向的内容只能经由该指针修改)
restrict是C99标准中新添加的关键字,对于从C89标准开始起步学习C语言的同学来说(包括我),第一次看到restrict还是相当陌生的.Wikipedia给出的解释如下: In the C p ...
- ThinkPHP5+Redis单例型购物车
<?php /** * Redis + 单例型购物车 * param $basket 存储商品信息 * param $ins 存储实例化对象 */ namespace lib; use redi ...
- 前后端分离之接口登陆权限token
随着业务的需求普通的springmvc+jsp已经不能满足我们的系统了,会逐渐把后台和前端展示分离开来,下面我们就来把普通的springmvc+jsp分为 springmvc只提供rest接口,前端用 ...
- BZOJ 3667 Pollard-rho &Miller-Rabin
论O(1)快速乘和O(logn)快速乘的差距-. //By SiriusRen #include <cstdio> #include <algorithm> using nam ...
- ndis6 how to drop packets
In ndis6 how to drop packets? in FilterSendNetBufferLists: FILTER_RELEASE_LOCK(&pFilter->Lock ...
- SpringMVC视频
视频内容: 1.下载spring mvc以及spring mvc示例演示http://pan.baidu.com/s/1kTHRfDH 2.配置完善&初步探究控制器拦截http://pan.b ...