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

建设服装网站目的seo点击工具

建设服装网站目的,seo点击工具,做微博类的网站难吗,网站建设应该怎么做发送get请求时,发送请求头(Header)中的内容 方便第二次调用其他url时传递参数,例如userCode或者租户编码 调用方式 Autowired private HttpServletRequest request;先注入HttpServletRequestpublic xxx xxx(){String url &quo…

发送get请求时,发送请求头(Header)中的内容

方便第二次调用其他url时传递参数,例如userCode或者租户编码

调用方式

@Autowired
private HttpServletRequest request;先注入HttpServletRequestpublic xxx xxx(){String url = "http://" + ip +":8082/inAndOut/into/xxxxxx";String userCode = request.getHeader("usercode");//动态传递Header中的userCode,用来给组件服务接口传userCodeMap<String, String> headers = new HashMap<>();headers.put("Content-Type", "application/json");headers.put("Authorization", "Bearer your_token_here");headers.put("tenantcode", tenantCode);headers.put("userCode", userCode);String request = HttpClientUtil.sendGetWithHeaders(url,headers);
}

userCode和tenantCode可以从Header中获取,前端也一样,这是在PostMan中测试

工具类

import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;import java.io.IOException;
import java.util.HashMap;
import java.util.Map;public class GetWithHeadersExample {public static void main(String[] args) {Map<String, String> headers = new HashMap<>();headers.put("Content-Type", "application/json");headers.put("Authorization", "Bearer your_token_here");String url = "http://example.com/api/endpoint";try {String response = sendGetWithHeaders(url, headers);System.out.println("Response: " + response);} catch (IOException e) {e.printStackTrace();}}public static String sendGetWithHeaders(String url, Map<String, String> headers) throws IOException {CloseableHttpClient httpClient = HttpClients.createDefault();HttpGet httpGet = new HttpGet(url);for (Map.Entry<String, String> entry : headers.entrySet()) {httpGet.addHeader(entry.getKey(), entry.getValue());}HttpResponse response = httpClient.execute(httpGet);HttpEntity entity = response.getEntity();String responseBody = EntityUtils.toString(entity);httpClient.close();return responseBody;}
}

http://www.dtcms.com/wzjs/439176.html

相关文章:

  • 建网站的域名是什么意思海淀区seo搜索优化
  • 做追星网站效果图营销策略有哪些理论
  • 项目实施方案计划书网络优化工程师前景如何
  • 济南网站网站建设东莞网络营销推广软件
  • 网站搜索引擎优化公司360广告推广平台
  • 济南城市建设集团网站如何搭建个人网站
  • 南昌有没有做企业网站和公司免费发布推广信息的平台有哪些
  • 封面制作网站seo网站的优化流程
  • 福州有名的公司网站设计外贸网站制作推广
  • 阿里巴巴国际站买家入口百度问一问在线咨询客服
  • 中材矿山建设有限公司网站八百客crm系统登录入口
  • 深圳市建设工程交易服务中心网站免费网站seo排名优化
  • 一个网站可以做多少个关键词青青河边草直播免费观看
  • 网站建设公司哪家专业seo和sem的区别与联系
  • 并提示网站菜单导航及用户登录北京seo软件
  • 网站页面架构网店运营培训哪里好
  • 灰色网站怎么做seo百度小说搜索风云榜排行榜
  • 设计师用什么做网站百度云盘官网
  • 7有免费建网站seowhy培训
  • 百度推广做的网站可以用吗sem百度竞价推广
  • 南通电子商务网站建设网页制作公司
  • 深圳网站建设软件开发重庆人社培训网
  • 做水果的网站淄博信息港聊天室网址
  • 网站的空间什么意思sem推广竞价
  • 桂林两江四湖象山景区简介黑帽seo是什么
  • 企业网站如何做推广网络营销的8个基本职能
  • 国家机构网站建设深圳哪里有网络推广渠避
  • 美术培训学校网站模板汽车网络营销策划方案
  • 在自己的网站上怎么做淘宝客营销活动方案模板
  • 做pcb网站的公司百度网盘登陆