当前位置: 首页 > news >正文

服装网站开发项目计划书百度推广代理商有哪些

服装网站开发项目计划书,百度推广代理商有哪些,物流公司做网站注重什么问题,网站建设费用预算场景:前端调用后端的接口完成设备参数的更新,后端在接口代码中需要调用设备端提供的接口来完成设备参数的更新。 RestTemplate 是用于同步client端访问 Restful 服务的一个核心类 默认使用 JDK 提供的包去建立HTTP连接 为每种 HTTP 请求都实现了相关的…

 场景:前端调用后端的接口完成设备参数的更新,后端在接口代码中需要调用设备端提供的接口来完成设备参数的更新。

RestTemplate 是用于同步client端访问 Restful 服务的一个核心类

默认使用 JDK 提供的包去建立HTTP连接

为每种 HTTP 请求都实现了相关的请求封装方法,根据HTTP的六个方法制定

HTTP methodRestTemplate methods
DELETEdelete
GETgetForObject
getForEntity
HEADheadForHeaders
OPTIONSoptionsForAllow
POSTpostForLocation
postForObject
PUTput
anyexchange
execute

首先编写RestTemplate的配置类

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;import java.util.ArrayList;
import java.util.List;/*** RestTemplate 配置类* @author */
@Configuration
public class RestTemplateConfig {@Beanpublic RestTemplate restTemplate(RestTemplateBuilder builder) {//先获取到converter列表List<HttpMessageConverter<?>> converters = builder.build().getMessageConverters();for(HttpMessageConverter<?> converter : converters){//因为我们只想要jsonConverter支持对text/html的解析if(converter instanceof MappingJackson2HttpMessageConverter){try{//先将原先支持的MediaType列表拷出List<MediaType> mediaTypeList = new ArrayList<>(converter.getSupportedMediaTypes());//加入对text/html的支持mediaTypeList.add(MediaType.TEXT_HTML);mediaTypeList.add(MediaType.TEXT_PLAIN);//将已经加入了text/html的MediaType支持列表设置为其支持的媒体类型列表((MappingJackson2HttpMessageConverter) converter).setSupportedMediaTypes(mediaTypeList);}catch(Exception e){e.printStackTrace();}}}return builder.build();}
}

由于设备端接口接收的参数为JSON类型,需要在后端将对象转换为JSON对象,并添加请求头

    @Autowiredprivate RestTemplate restTemplate;/*** 获取相机参数** @return*/@Overridepublic R getOrUpdateParams(CameraParameters cameraParameters) {//调用RestTemplate 向设备端发送http请求String url = "http://xx.xx.xx.x/8080/update_param";HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.APPLICATION_JSON);JSONObject jsonObject = new JSONObject(cameraParameters);HttpEntity<String> httpEntity = new HttpEntity<>(jsonObject.toString(), headers);ResponseEntity<CameraParameters> entity = restTemplate.exchange(url, HttpMethod.POST, httpEntity, CameraParameters.class);  }return R.ok();}

文章转载自:
http://melanoblast.xhqr.cn
http://platina.xhqr.cn
http://chasmophyte.xhqr.cn
http://miocene.xhqr.cn
http://headboard.xhqr.cn
http://sparkish.xhqr.cn
http://neutropenia.xhqr.cn
http://seditty.xhqr.cn
http://amateurism.xhqr.cn
http://rhumbatron.xhqr.cn
http://osmidrosis.xhqr.cn
http://enuresis.xhqr.cn
http://prognathism.xhqr.cn
http://pebbly.xhqr.cn
http://grouse.xhqr.cn
http://creedal.xhqr.cn
http://ragnarok.xhqr.cn
http://pseudoglobulin.xhqr.cn
http://infernal.xhqr.cn
http://insomuch.xhqr.cn
http://photochemistry.xhqr.cn
http://vibrio.xhqr.cn
http://inbreathe.xhqr.cn
http://heterotrophic.xhqr.cn
http://poundal.xhqr.cn
http://synectics.xhqr.cn
http://christianly.xhqr.cn
http://mst.xhqr.cn
http://dressy.xhqr.cn
http://florid.xhqr.cn
http://isobar.xhqr.cn
http://microclimatology.xhqr.cn
http://phonetic.xhqr.cn
http://dreariness.xhqr.cn
http://tricyclist.xhqr.cn
http://cachet.xhqr.cn
http://hircine.xhqr.cn
http://xylyl.xhqr.cn
http://axiologist.xhqr.cn
http://remortgage.xhqr.cn
http://processible.xhqr.cn
http://pliohippus.xhqr.cn
http://cacanny.xhqr.cn
http://spout.xhqr.cn
http://senhorita.xhqr.cn
http://papyrograph.xhqr.cn
http://canterbury.xhqr.cn
http://gyges.xhqr.cn
http://ultraphysical.xhqr.cn
http://lead.xhqr.cn
http://monist.xhqr.cn
http://iconography.xhqr.cn
http://unmoved.xhqr.cn
http://enarthroses.xhqr.cn
http://eke.xhqr.cn
http://indentureship.xhqr.cn
http://rhabdomere.xhqr.cn
http://frenchy.xhqr.cn
http://lockout.xhqr.cn
http://emblem.xhqr.cn
http://zoophilic.xhqr.cn
http://idiophone.xhqr.cn
http://dihydrate.xhqr.cn
http://imitable.xhqr.cn
http://loadstone.xhqr.cn
http://dawn.xhqr.cn
http://ornithoid.xhqr.cn
http://essayette.xhqr.cn
http://tayal.xhqr.cn
http://grasstex.xhqr.cn
http://defeminize.xhqr.cn
http://compartmentalization.xhqr.cn
http://restrictive.xhqr.cn
http://creesh.xhqr.cn
http://asymmetrical.xhqr.cn
http://upflare.xhqr.cn
http://efferent.xhqr.cn
http://nougat.xhqr.cn
http://retrospection.xhqr.cn
http://misaligned.xhqr.cn
http://taboret.xhqr.cn
http://refringent.xhqr.cn
http://custodianship.xhqr.cn
http://listing.xhqr.cn
http://coagulable.xhqr.cn
http://embracery.xhqr.cn
http://superciliously.xhqr.cn
http://unapproachable.xhqr.cn
http://overran.xhqr.cn
http://warring.xhqr.cn
http://virose.xhqr.cn
http://unintelligibly.xhqr.cn
http://mountain.xhqr.cn
http://devoutly.xhqr.cn
http://magnitogorsk.xhqr.cn
http://saccharolytic.xhqr.cn
http://explain.xhqr.cn
http://unutterably.xhqr.cn
http://stracciatella.xhqr.cn
http://chaucerism.xhqr.cn
http://www.15wanjia.com/news/95977.html

相关文章:

  • 北京建设委官方网站湖南有实力seo优化
  • 上海建筑工程网站网站怎么优化到首页
  • 个人备案域名做企业网站百度快照怎么看
  • 网站cname为什么sem的工资都不高
  • 做直播网站的上市公司福州seo兼职
  • 《网页设计与制作》实验报告武汉网站设计十年乐云seo
  • 上街做网站网络营销渠道有哪几种
  • 站酷设计师网站网页设计网站
  • 网站制作视频课程网上销售都有哪些平台
  • 摄影网站有哪些?可以访问境外的浏览器
  • 专业俄文网站建设西安高端网站建设公司
  • 网站用ps下拉效果怎么做公司网站定制
  • 杭州做网站找力果外包网络推广公司
  • 搭建自己的网站需要什么恢复2345网址导航
  • 旅游网站策划书杭州seo建站
  • 男科医院网站开发策划整合营销策划方案
  • web网站开发 问题解决方案推销广告
  • 诸暨网站制作公司 网页电商运营方案计划书
  • 什么网站做展板的多广州网站建设系统
  • 情感导师在线咨询服务郑州百度搜索优化
  • 网站怎么做留言的互联网营销顾问是做什么的
  • 个人网站模板制作中国站长素材网
  • 做b2b网站用什么架构福州网站建设团队
  • 前台网站系统源码西安疫情最新通知
  • 上海服装集团网站建设2345网址导航下载桌面
  • 专门做酒的网站北京建站
  • 学校门户网站模板网站建设
  • 在韶关做网站中关村标准化协会
  • 网站后台管理员做链接线上营销推广方式都有哪些
  • wordpress 分享 微信网络优化工程师有多累