HttpAsyncClient是HttpClient的异步版本,提供异步调用的api。文中所使用到的软件版本:Java 1.8.0_191、HttpClient 4.1.4。

1、服务端

参见Java调用Http接口(1)--编写服务端

2、调用Http接口

2.1、GET请求

    public static void get() {
String requestPath = "http://localhost:8080/demo/httptest/getUser?userId=1000&userName=李白";
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
HttpGet get = new HttpGet(requestPath);
Future<HttpResponse> future = httpClient.execute(get, null);
HttpResponse response = future.get();
System.out.println("GET返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("GET返回结果:" + EntityUtils.toString(responseEntity)); //回调方式调用
final CountDownLatch latch = new CountDownLatch(1);
final HttpGet get2 = new HttpGet(requestPath);
httpClient.execute(get2, new FutureCallback<HttpResponse>() {
public void completed(final HttpResponse response) {
latch.countDown();
System.out.println("GET(回调方式)返回状态:" + response.getStatusLine());
try {
System.out.println("GET(回调方式)返回结果:" + EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
}
}
public void failed(final Exception e) {
latch.countDown();
e.printStackTrace();
}
public void cancelled() {
latch.countDown();
System.out.println("cancelled");
} });
latch.await(); //流方式调用
final CountDownLatch latch2 = new CountDownLatch(1);
final HttpGet get3 = new HttpGet(requestPath);
HttpAsyncRequestProducer producer3 = HttpAsyncMethods.create(get3);
AsyncCharConsumer<HttpResponse> consumer3 = new AsyncCharConsumer<HttpResponse>() {
HttpResponse response;
@Override
protected void onResponseReceived(final HttpResponse response) {
this.response = response;
}
@Override
protected void releaseResources() {
}
@Override
protected HttpResponse buildResult(final HttpContext context) {
return this.response;
}
@Override
protected void onCharReceived(CharBuffer buf, IOControl ioctrl) throws IOException {
System.out.println("GET(流方式)返回结果:" + buf.toString());
}
};
httpClient.execute(producer3, consumer3, new FutureCallback<HttpResponse>() {
public void completed(final HttpResponse response) {
latch2.countDown();
System.out.println("GET(流方式)返回状态:" + response.getStatusLine());
}
public void failed(final Exception e) {
latch2.countDown();
e.printStackTrace();
}
public void cancelled() {
latch2.countDown();
System.out.println("cancelled");
}
});
latch2.await();
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
}

2.2、POST请求(发送键值对数据)

    public static void post() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/getUser";
HttpPost post = new HttpPost(requestPath); List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("userId", "1000"));
list.add(new BasicNameValuePair("userName", "李白"));
post.setEntity(new UrlEncodedFormEntity(list, "utf-8")); Future<HttpResponse> future = httpClient.execute(post, null);
HttpResponse response = future.get();
System.out.println("POST返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("POST返回结果:" + EntityUtils.toString(responseEntity)); //回调方式和流方式调用类似
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
}

2.3、POST请求(发送JSON数据)

    public static void post2() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/addUser";
HttpPost post = new HttpPost(requestPath);
post.setHeader("Content-type", "application/json");
String param = "{\"userId\": \"1001\",\"userName\":\"杜甫\"}";
post.setEntity(new StringEntity(param, "utf-8")); Future<HttpResponse> future = httpClient.execute(post, null);
HttpResponse response = future.get();
System.out.println("POST json返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("POST josn返回结果:" + EntityUtils.toString(responseEntity)); //回调方式和流方式调用类似
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
}

2.4、上传文件

    public static void upload() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/upload";
ZeroCopyPost producer = new ZeroCopyPost(requestPath, new File("d:/a.jpg"), ContentType.create("text/plain"));
AsyncCharConsumer<HttpResponse> consumer = new AsyncCharConsumer<HttpResponse>() {
HttpResponse response;
@Override
protected void onResponseReceived(final HttpResponse response) {
this.response = response;
}
@Override
protected void releaseResources() {
}
@Override
protected HttpResponse buildResult(final HttpContext context) {
return this.response;
}
@Override
protected void onCharReceived(CharBuffer buf, IOControl ioctrl) throws IOException {
System.out.println("upload返回结果:" + buf.toString());
}
};
Future<HttpResponse> future = httpClient.execute(producer, consumer, null);
HttpResponse response = future.get();
System.out.println("upload返回状态:" + response.getStatusLine());
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
}

2.5、下载文件

    public static void download() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/download";
HttpGet get = new HttpGet(requestPath);
HttpAsyncRequestProducer producer = HttpAsyncMethods.create(get);
File download = new File("d:/temp/download_" + System.currentTimeMillis() + ".jpg");
ZeroCopyConsumer<File> consumer = new ZeroCopyConsumer<File>(download) {
@Override
protected File process(final HttpResponse response, final File file, final ContentType contentType) throws Exception {
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
throw new ClientProtocolException("Upload failed: " + response.getStatusLine());
}
return file;
}
};
Future<File> future = httpClient.execute(producer, consumer, null);
System.out.println("download文件大小:" + future.get().length());
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
}

2.6、完整例子

package com.inspur.demo.http.client;

import java.io.File;
import java.io.IOException;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.concurrent.FutureCallback;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.client.methods.AsyncCharConsumer;
import org.apache.http.nio.client.methods.HttpAsyncMethods;
import org.apache.http.nio.client.methods.ZeroCopyConsumer;
import org.apache.http.nio.client.methods.ZeroCopyPost;
import org.apache.http.nio.protocol.HttpAsyncRequestProducer;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils; /**
* 通过HttpClient调用Http接口
*/
public class HttpAsyncClientCase {
/**
* GET请求
*/
public static void get() {
String requestPath = "http://localhost:8080/demo/httptest/getUser?userId=1000&userName=李白";
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
HttpGet get = new HttpGet(requestPath);
Future<HttpResponse> future = httpClient.execute(get, null);
HttpResponse response = future.get();
System.out.println("GET返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("GET返回结果:" + EntityUtils.toString(responseEntity)); //回调方式调用
final CountDownLatch latch = new CountDownLatch(1);
final HttpGet get2 = new HttpGet(requestPath);
httpClient.execute(get2, new FutureCallback<HttpResponse>() {
public void completed(final HttpResponse response) {
latch.countDown();
System.out.println("GET(回调方式)返回状态:" + response.getStatusLine());
try {
System.out.println("GET(回调方式)返回结果:" + EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
}
}
public void failed(final Exception e) {
latch.countDown();
e.printStackTrace();
}
public void cancelled() {
latch.countDown();
System.out.println("cancelled");
} });
latch.await(); //流方式调用
final CountDownLatch latch2 = new CountDownLatch(1);
final HttpGet get3 = new HttpGet(requestPath);
HttpAsyncRequestProducer producer3 = HttpAsyncMethods.create(get3);
AsyncCharConsumer<HttpResponse> consumer3 = new AsyncCharConsumer<HttpResponse>() {
HttpResponse response;
@Override
protected void onResponseReceived(final HttpResponse response) {
this.response = response;
}
@Override
protected void releaseResources() {
}
@Override
protected HttpResponse buildResult(final HttpContext context) {
return this.response;
}
@Override
protected void onCharReceived(CharBuffer buf, IOControl ioctrl) throws IOException {
System.out.println("GET(流方式)返回结果:" + buf.toString());
}
};
httpClient.execute(producer3, consumer3, new FutureCallback<HttpResponse>() {
public void completed(final HttpResponse response) {
latch2.countDown();
System.out.println("GET(流方式)返回状态:" + response.getStatusLine());
}
public void failed(final Exception e) {
latch2.countDown();
e.printStackTrace();
}
public void cancelled() {
latch2.countDown();
System.out.println("cancelled");
}
});
latch2.await();
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
} /**
* POST请求(发送键值对数据)
*/
public static void post() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/getUser";
HttpPost post = new HttpPost(requestPath); List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("userId", "1000"));
list.add(new BasicNameValuePair("userName", "李白"));
post.setEntity(new UrlEncodedFormEntity(list, "utf-8")); Future<HttpResponse> future = httpClient.execute(post, null);
HttpResponse response = future.get();
System.out.println("POST返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("POST返回结果:" + EntityUtils.toString(responseEntity)); //回调方式和流方式调用类似
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
} /**
* POST请求(发送json数据)
*/
public static void post2() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/addUser";
HttpPost post = new HttpPost(requestPath);
post.setHeader("Content-type", "application/json");
String param = "{\"userId\": \"1001\",\"userName\":\"杜甫\"}";
post.setEntity(new StringEntity(param, "utf-8")); Future<HttpResponse> future = httpClient.execute(post, null);
HttpResponse response = future.get();
System.out.println("POST json返回状态:" + response.getStatusLine());
HttpEntity responseEntity = response.getEntity();
System.out.println("POST josn返回结果:" + EntityUtils.toString(responseEntity)); //回调方式和流方式调用类似
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
} /**
* 上传文件
*/
public static void upload() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/upload";
ZeroCopyPost producer = new ZeroCopyPost(requestPath, new File("d:/a.jpg"), ContentType.create("text/plain"));
AsyncCharConsumer<HttpResponse> consumer = new AsyncCharConsumer<HttpResponse>() {
HttpResponse response;
@Override
protected void onResponseReceived(final HttpResponse response) {
this.response = response;
}
@Override
protected void releaseResources() {
}
@Override
protected HttpResponse buildResult(final HttpContext context) {
return this.response;
}
@Override
protected void onCharReceived(CharBuffer buf, IOControl ioctrl) throws IOException {
System.out.println("upload返回结果:" + buf.toString());
}
};
Future<HttpResponse> future = httpClient.execute(producer, consumer, null);
HttpResponse response = future.get();
System.out.println("upload返回状态:" + response.getStatusLine());
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
} /**
* 下载文件
*/
public static void download() {
CloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();
try {
httpClient.start();
String requestPath = "http://localhost:8080/demo/httptest/download";
HttpGet get = new HttpGet(requestPath);
HttpAsyncRequestProducer producer = HttpAsyncMethods.create(get);
File download = new File("d:/temp/download_" + System.currentTimeMillis() + ".jpg");
ZeroCopyConsumer<File> consumer = new ZeroCopyConsumer<File>(download) {
@Override
protected File process(final HttpResponse response, final File file, final ContentType contentType) throws Exception {
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
throw new ClientProtocolException("Upload failed: " + response.getStatusLine());
}
return file;
}
};
Future<File> future = httpClient.execute(producer, consumer, null);
System.out.println("download文件大小:" + future.get().length());
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpClient);
}
} private static void close(CloseableHttpAsyncClient httpClient) {
try {
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} public static void main(String[] args) {
get();
post();
post2();
upload();
download();
}
}

3、调用Https接口

与调用Http接口不一样的部分主要在设置ssl部分,其ssl的设置与HttpsURLConnection很相似(参见Java调用Http/Https接口(2)--HttpURLConnection/HttpsURLConnection调用Http/Https接口);下面用GET请求来演示ssl的设置,其他调用方式类似。

package com.inspur.demo.http.client;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.util.concurrent.Future; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.nio.conn.ssl.SSLIOSessionStrategy;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils; import com.inspur.demo.common.util.FileUtil; /**
* 通过HttpAsyncClient调用Https接口
*/
public class HttpAsyncClientHttpsCase { public static void main(String[] args) {
CloseableHttpAsyncClient httpAsyncClient = null;
CloseableHttpAsyncClient httpAsyncClient2 = null;
CloseableHttpAsyncClient httpAsyncClient3 = null;
try {
/*
* 请求有权威证书的地址
*/
String requestPath = "https://www.12306.cn/index/";
httpAsyncClient = HttpAsyncClients.createDefault();
httpAsyncClient.start();
HttpGet get = new HttpGet(requestPath);
Future<HttpResponse> future = httpAsyncClient.execute(get, null);
HttpResponse response = future.get();
System.out.println(response.getStatusLine());
System.out.println("GET1返回结果:" + EntityUtils.toString(response.getEntity(), "utf-8")); /*
* 请求自定义证书的地址
*/
//获取信任证书库
KeyStore trustStore = getkeyStore("jks", "d:/temp/cacerts", "123456");
//不需要客户端证书
requestPath = "https://10.40.x.x:9010/zsywservice";
httpAsyncClient2 = HttpAsyncClients.custom().setSSLStrategy(getSSLIOSessionStrategy(trustStore)).build();
httpAsyncClient2.start();
get = new HttpGet(requestPath);
future = httpAsyncClient2.execute(get, null);
response = future.get();
System.out.println("GET2:" + EntityUtils.toString(response.getEntity())); //需要客户端证书
requestPath = "https://10.40.x.x:9016/zsywservice";
KeyStore keyStore = getkeyStore("pkcs12", "d:/client.p12", "123456");
httpAsyncClient3 = HttpAsyncClients.custom().setSSLStrategy(getSSLIOSessionStrategy(keyStore, "123456", trustStore)).build();
httpAsyncClient3.start();
get = new HttpGet(requestPath);
future = httpAsyncClient3.execute(get, null);
response = future.get();
System.out.println("GET3返回结果:" + EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
} finally {
close(httpAsyncClient);
close(httpAsyncClient2);
close(httpAsyncClient3);
}
} public static SSLIOSessionStrategy getSSLIOSessionStrategy(KeyStore keyStore, String keyPassword, KeyStore trustStore) throws Exception {
SSLContextBuilder bulider = SSLContexts.custom();
if (keyStore != null) {
bulider.loadKeyMaterial(keyStore, keyPassword.toCharArray());
}
if (keyStore != null) {
bulider.loadTrustMaterial(trustStore, null);
} else {
bulider.loadTrustMaterial(new TrustSelfSignedStrategy());
}
SSLContext sslContext = bulider.build();
// 验证URL的主机名和服务器的标识主机名是否匹配
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
// if ("xxx".equals(hostname)) {
// return true;
// } else {
// return false;
// }
return true;
}
};
SSLIOSessionStrategy strategy = new SSLIOSessionStrategy(sslContext, new String[] { "TLSv1", "TLSv1.2" }, null,
hostnameVerifier); return strategy;
} public static SSLIOSessionStrategy getSSLIOSessionStrategy(KeyStore trustStore) throws Exception {
return getSSLIOSessionStrategy(null, null, trustStore);
} private static KeyStore getkeyStore(String type, String filePath, String password) {
KeyStore keySotre = null;
FileInputStream in = null;
try {
keySotre = KeyStore.getInstance(type);
in = new FileInputStream(new File(filePath));
keySotre.load(in, password.toCharArray());
} catch (Exception e) {
e.printStackTrace();
} finally {
FileUtil.close(in);
}
return keySotre;
} private static void close(CloseableHttpAsyncClient httpClient) {
try {
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }

Java调用Http/Https接口(5)--HttpAsyncClient调用Http/Https接口的更多相关文章

  1. Java WebService接口生成和调用 图文详解>【转】【待调整】

    webservice简介: Web Service技术, 能使得运行在不同机器上的不同应用无须借助附加的.专门的第三方软件或硬件, 就可相互交换数据或集成.依据Web Service规范实施的应用之间 ...

  2. c#代码 天气接口 一分钟搞懂你的博客为什么没人看 看完python这段爬虫代码,java流泪了c#沉默了 图片二进制转换与存入数据库相关 C#7.0--引用返回值和引用局部变量 JS直接调用C#后台方法(ajax调用) Linq To Json SqlServer 递归查询

    天气预报的程序.程序并不难. 看到这个需求第一个想法就是只要找到合适天气预报接口一切都是小意思,说干就干,立马跟学生沟通价格. ​ ​不过谈报价的过程中,差点没让我一口老血喷键盘上,话说我们程序猿的人 ...

  3. java接口对接——别人调用我们接口获取数据

    java接口对接——别人调用我们接口获取数据,我们需要在我们系统中开发几个接口,给对方接口规范文档,包括访问我们的接口地址,以及入参名称和格式,还有我们的返回的状态的情况, 接口代码: package ...

  4. .net WebServer示例及调用(接口WSDL动态调用 JAVA)

    新建.asmx页面 using System; using System.Collections.Generic; using System.Linq; using System.Web; using ...

  5. 使用Socket&反射&Java流操作进行方法的远程调用(模拟RPC远程调用)

    写在前面 阅读本文首先得具备基本的Socket.反射.Java流操作的基本API使用知识:否则本文你可能看不懂... 服务端的端口监听 进行远程调用,那就必须得有客户端和服务端.服务端负责提供服务,客 ...

  6. java多态的实现原理(JVM调用过程)(综合多篇文章,参考见文末)

    一个对象变量可以指示多种实际类型的现象称为多态 允许不同类的对象对同一消息做出响应.方法的重载.类的覆盖正体现了多态. 1.多态的机制 1.1 本质上多态分两种 1.编译时多态(又称静态多态) 2.运 ...

  7. 从Java future 到 Guava ListenableFuture实现异步调用

    从Java future 到 Guava ListenableFuture实现异步调用 置顶 2016年04月24日 09:11:14 皮斯特劳沃 阅读数:17570 标签: java异步调用线程非阻 ...

  8. Atitit java c# php c++ js跨语言调用matlab实现边缘检测等功能attilax总结

    Atitit java c# php c++ js跨语言调用matlab实现边缘检测等功能attilax总结 1.1. 边缘检测的基本方法Canny最常用了1 1.2. 编写matlab边缘检测代码, ...

  9. 【Java EE 学习 80 下】【调用WebService服务的四种方式】【WebService中的注解】

    不考虑第三方框架,如果只使用JDK提供的API,那么可以使用三种方式调用WebService服务:另外还可以使用Ajax调用WebService服务. 预备工作:开启WebService服务,使用jd ...

随机推荐

  1. NULL与nullptr

    [https://blog.csdn.net/weixin_40237626/article/details/82560012] 其实啊,在编译器进行解释程序时,NULL会被直接解释成0,所以这里的参 ...

  2. window.showModelessDialog传值

    参数传递:1.   要想对话框传递参数,是通过vArguments来进行传递的.类型不限制,对于字符串类型,最大为4096个字符.也可以传递对象,例如:------------------------ ...

  3. 深度排序模型概述(一)Wide&Deep/xDeepFM

    本文记录几个在广告和推荐里面rank阶段常用的模型.广告领域机器学习问题的输入其实很大程度了影响了模型的选择,因为输入一般维度非常高,稀疏,同时包含连续性特征和离散型特征.模型即使到现在DeepFM类 ...

  4. python 获取天气信息,并绘制曲线

    import urllib.request import gzip import json print('------天气查询------') def get_weather_data() : cit ...

  5. 自动创建Kibana索引

    参考 https://www.cnblogs.com/dance-walter/p/10471950.html 参考 https://www.elastic.co/guide/en/kibana/cu ...

  6. DB2数据库基础

    一.DB2数据库安装教程 DB2安装教程:https://jingyan.baidu.com/article/e75057f2f59ef9ebc91a8905.html 二.DB2常用命令 1. 打开 ...

  7. RabbitMQ安装后无法访问15672端口

    切换到RabbitMQ的安装目录 sbin 目录下执行: rabbitmq-plugins enable rabbitmq_management 即可打开管理界面. rabbitmq的web管理界面无 ...

  8. maven更改本地的maven私服

    1.今天想升级一个服务的jar包,更改后 使用命令 mvn deploy -e 一直报错, 看错误信息是  私服地址不是公司现在的地址. 想了半天,原来是电脑一直配置的上家公司的私服地址.. 但是在哪 ...

  9. 【tensorflow-v2.0】如何将模型转换成tflite模型

    前言 TensorFlow Lite 提供了转换 TensorFlow 模型,并在移动端(mobile).嵌入式(embeded)和物联网(IoT)设备上运行 TensorFlow 模型所需的所有工具 ...

  10. 【Spring Cloud学习之四】Zuul网关

    环境 eclipse 4.7 jdk 1.8 Spring Boot 1.5.2 Spring Cloud 1.2 一.接口网关接口网关:拦截所有的请求,交由接口网关,然后接口网关进行转发,类似ngi ...