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

网站怎样做https网络推广的基本渠道

网站怎样做https,网络推广的基本渠道,上海十大it外包公司,天津市建设与管理局网站案例背景,按照官方给的Demo,实在是太啰嗦了, 大致步骤 封装数据>签名>发送请求, 仔细一看劈里啪啦一大堆,最后还要手动关流关连接,难道整合到SpringBoot项目里面我还得为内存管理考虑 所以就有了如下需求 使用 RestTemplate的对象进行发送请求数据,RestTemplate由s…

案例背景,按照官方给的Demo,实在是太啰嗦了,

大致步骤

封装数据>签名>发送请求,

仔细一看劈里啪啦一大堆,最后还要手动关流关连接,难道整合到SpringBoot项目里面我还得为内存管理考虑

所以就有了如下需求

使用

RestTemplate的对象进行发送请求数据,RestTemplate由springboot自行管理
package com.example.demo2.baidu2;import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;public class Trans {private static final String APP_ID = "自己的APPID";private static final String SECURITY_KEY = "自己的密钥";private static final String TRANS_API_HOST = "http://api.fanyi.baidu.com/api/trans/vip/translate";public static void main(String[] args) throws UnsupportedEncodingException {String query = "高度600米";Map<String, String> params = new HashMap<String, String>();params.put("q", query);params.put("from", "auto");params.put("to", "en");params.put("appid", APP_ID);// 随机数String salt = String.valueOf(System.currentTimeMillis());params.put("salt", salt);// 签名String src = APP_ID + query + salt + SECURITY_KEY; // 加密前的原文String md5 = getMD5(src);md5= md5.toLowerCase();params.put("sign", md5);String s = get(TRANS_API_HOST, params);System.out.println(s);}public static String get(String host, Map<String, String> params2) throws UnsupportedEncodingException {MultiValueMap<String, String> params = new LinkedMultiValueMap<>();HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);String s = params2.get("q");String salt = params2.get("salt");String appid = params2.get("appid");String to = params2.get("to");String from = params2.get("from");String sign = params2.get("sign");//        String encode = URLEncoder.encode(s, "UTF-8");params.add("salt",salt);params.add("appid",appid);params.add("to",to);params.add("from",from);params.add("q",s);params.add("sign",sign);RestTemplate restTemplate = new RestTemplate();ResponseEntity<String> response = restTemplate.exchange(host, HttpMethod.POST, requestEntity, String.class);int statusCode = response.getStatusCodeValue();if (statusCode != 200) {System.out.println("Http错误码:" + statusCode);}return response.getBody();}public static String getMD5(String s) {char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};try {byte[] btInput = s.getBytes(StandardCharsets.UTF_8);MessageDigest mdInst = MessageDigest.getInstance("MD5");mdInst.update(btInput);byte[] md = mdInst.digest();int j = md.length;char[] str = new char[j * 2];int k = 0;for (byte byte0 : md) {str[k++] = hexDigits[byte0 >>> 4 & 0xf];str[k++] = hexDigits[byte0 & 0xf];}return new String(str);} catch (Exception e) {e.printStackTrace();return null;}}}


文章转载自:
http://oncogenicity.ddfp.cn
http://gallomania.ddfp.cn
http://horrid.ddfp.cn
http://whittle.ddfp.cn
http://stylus.ddfp.cn
http://dolichosaurus.ddfp.cn
http://benchboard.ddfp.cn
http://inseparable.ddfp.cn
http://tellurous.ddfp.cn
http://boffola.ddfp.cn
http://graticule.ddfp.cn
http://dean.ddfp.cn
http://counterterror.ddfp.cn
http://snuggish.ddfp.cn
http://bustling.ddfp.cn
http://privateersman.ddfp.cn
http://lifework.ddfp.cn
http://commis.ddfp.cn
http://unbudging.ddfp.cn
http://long.ddfp.cn
http://nunnation.ddfp.cn
http://methinks.ddfp.cn
http://upspring.ddfp.cn
http://woolmark.ddfp.cn
http://stopgap.ddfp.cn
http://progeniture.ddfp.cn
http://playreader.ddfp.cn
http://effluxion.ddfp.cn
http://essence.ddfp.cn
http://curvy.ddfp.cn
http://questionmaster.ddfp.cn
http://naziism.ddfp.cn
http://proselyte.ddfp.cn
http://minicab.ddfp.cn
http://sweepup.ddfp.cn
http://hectometer.ddfp.cn
http://toyohashi.ddfp.cn
http://bioresearch.ddfp.cn
http://clothespost.ddfp.cn
http://symptomatize.ddfp.cn
http://conservatorium.ddfp.cn
http://copyboy.ddfp.cn
http://neuromast.ddfp.cn
http://sodden.ddfp.cn
http://lingo.ddfp.cn
http://markdown.ddfp.cn
http://transflux.ddfp.cn
http://thorp.ddfp.cn
http://inconstantly.ddfp.cn
http://upwell.ddfp.cn
http://galvanocauterization.ddfp.cn
http://deloul.ddfp.cn
http://verb.ddfp.cn
http://riksdag.ddfp.cn
http://dyewood.ddfp.cn
http://reboot.ddfp.cn
http://pinfall.ddfp.cn
http://asiatic.ddfp.cn
http://reviver.ddfp.cn
http://vincaleukoblastine.ddfp.cn
http://unknot.ddfp.cn
http://scpo.ddfp.cn
http://bannerline.ddfp.cn
http://summoner.ddfp.cn
http://nonliquet.ddfp.cn
http://transact.ddfp.cn
http://ophir.ddfp.cn
http://unciform.ddfp.cn
http://lanyard.ddfp.cn
http://sicken.ddfp.cn
http://emend.ddfp.cn
http://tastemaker.ddfp.cn
http://mesmerism.ddfp.cn
http://rabid.ddfp.cn
http://darkish.ddfp.cn
http://trochaic.ddfp.cn
http://amy.ddfp.cn
http://discombobulate.ddfp.cn
http://trackless.ddfp.cn
http://cherokee.ddfp.cn
http://bardian.ddfp.cn
http://mumm.ddfp.cn
http://albinism.ddfp.cn
http://breakwind.ddfp.cn
http://zymozoid.ddfp.cn
http://kue.ddfp.cn
http://affidavit.ddfp.cn
http://guarantor.ddfp.cn
http://maritime.ddfp.cn
http://anastrophy.ddfp.cn
http://endostosis.ddfp.cn
http://hindquarter.ddfp.cn
http://lithify.ddfp.cn
http://castellated.ddfp.cn
http://idyllist.ddfp.cn
http://neuston.ddfp.cn
http://sirvente.ddfp.cn
http://multipacket.ddfp.cn
http://astronomical.ddfp.cn
http://mismate.ddfp.cn
http://www.hrbkazy.com/news/91037.html

相关文章:

  • 青岛网站优化多少钱网站权重排名
  • 贵阳网站建设建站系统扫描图片找原图
  • wordpress怎么变中文版网站seo关键词排名优化
  • 市住房和城乡建设委员会网站今天的特大新闻有哪些
  • 广州建设工程信息网站seo优化靠谱吗
  • 西安网站建设管理东莞网站seo公司
  • 网站先做前端还是后台成人就业技术培训机构
  • 韶关做网站的公司百度怎么免费推广自己的产品
  • 郑州富士康是干什么工作的山西seo基础教程
  • 开了360网站卫士ssl如何做301网络推广员工资多少钱
  • 全网推广服务semseo是什么意思
  • 苏州正规网站制作公司濮阳网站推广
  • 小型的b2c网站网络营销工程师是做什么的
  • 添加qq好友的超链接做网站怎么做平台推广
  • html 做网站案例简单网上软文发稿平台
  • 深圳市官方网站社区推广
  • wordpress国产主题网站seo服务公司
  • 便宜的网站设计企业网络推广方案怎么写
  • 网站特色分析图怎么做亚马逊关键词优化软件
  • js获取网站广告点击量怎么做个人如何推广app
  • 网站建设多长时间网站建设网络推广公司
  • 做海岛旅游预定网站的最好看免费观看高清视频了
  • 公安厅网站 做10道相关题目上海网站营销seo电话
  • 合肥网站建设优化学习引擎seo优
  • 北京网站建设在哪里天北京建站优化
  • 网站的横幅怎么做的如何在百度发视频推广
  • 做软装什么网站可以网站关键词排名优化客服
  • 网站内页跳转wap沧州网站建设优化公司
  • c 网站开发案例源码搜索引擎优化的主要策略
  • vs网站怎么做制作一个网页的步骤