资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何进行SpringCloudFeign接口返回流的实现-创新互联

今天就跟大家聊聊有关如何进行SpringCloudFeign接口返回流的实现,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

成都创新互联公司服务项目包括上高网站建设、上高网站制作、上高网页制作以及上高网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,上高网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到上高省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

服务提供者

@GetMapping("/{id}")  public void queryJobInfoLogDetail(@PathVariable("id") Long id, HttpServletResponse response) {    File file = new File("xxxxx");    InputStream fileInputStream = new FileInputStream(file);    OutputStream outStream;    try {      outStream = response.getOutputStream();      byte[] bytes = new byte[1024];      int len = 0;      while ((len = fileInputStream.read(bytes)) != -1) {        outStream.write(bytes, 0, len);      }      fileInputStream.close();      outStream.close();      outStream.flush();    } catch (IOException e) {      log.error("exception", e);    }  }

client 客户端

@GetMapping(value = "/{id}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)  feign.Response queryJobInfoLogDetail(@PathVariable("id") Long id);

服务消费者

@GetMapping("/{id}")  public void queryJobInfoLogInfoList(@PathVariable("id") Long id, HttpServletResponse servletResponse) {    Response response = apiServices.queryJobInfoLogDetail(id);    Response.Body body = response.body();    InputStream fileInputStream = null;    OutputStream outStream;    try {      fileInputStream = body.asInputStream();      outStream = servletResponse.getOutputStream();      byte[] bytes = new byte[1024];      int len = 0;      while ((len = fileInputStream.read(bytes)) != -1) {        outStream.write(bytes, 0, len);      }      fileInputStream.close();      outStream.close();      outStream.flush();    } catch (Exception e) {    }  }

看完上述内容,你们对如何进行SpringCloudFeign接口返回流的实现有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。


网站名称:如何进行SpringCloudFeign接口返回流的实现-创新互联
标题来源:http://cdkjz.cn/article/ceeisi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220