Java中调用接口

news2024/5/20 1:21:47

一、微服务本地调用feign

Feign 是一个在 Java 平台上的声明式、模板化的 HTTP 客户端,它简化了使用 HTTP API 的过程。Feign 是 Netflix 开发的,旨在简化基于 HTTP 的 API 客户端开发。

1、特点

1.1:声明式 API 定义: 通过接口和注解的方式定义 API,使得 API 定义更加清晰和简洁。
1.2:集成 Ribbon: Feign 默认集成了 Ribbon 负载均衡器,可以轻松实现客户端的负载均衡。
1.3:集成 Hystrix: Feign 也可以集成 Hystrix,从而实现客户端的容错和断路器功能。
1.4:支持多种编码器和解码器: Feign 支持多种编码器和解码器,包括 JSON、XML 等。
1.5:支持动态 URL 和查询参数: 可以在接口方法中直接使用参数来构建 URL 和查询参数。

2、代码实例

2.1、添加maven支持
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
2.2、在服务启动类添加注解
@Slf4j//日志log
@SpringBootApplication//用于标识 Spring Boot 应用程序的注解
@EnableFeignClients//开启feign
@MapperScan("com.netrust.*.dao")//扫描包下的mapper
@EnableTransactionManagement//开启事务注解
public class BaseApplication {
    public static void main(String[] args) {
        SpringApplication.run(BaseApplication.class, args);
    }
}
2.3、编写feign类
@FeignClient(value = ServerNameConstants.SYSTEM_BASE, contextId = "room", configuration = FeignConfiguration.class)
public interface FeignApi {
    @PostMapping("/add")
    String addSysApi(@RequestBody FeignBO feignBO);
    @PutMapping("/edit")
    String editSysApi(@RequestBody FeignBO feignBO);
    @DeleteMapping("/delete")
    String deleteByIdSysApi(@RequestBody FeignDto feignDto);
    @GetMapping("/queryById")//@SpringQueryMap表示get可以用对象接收,不然就需要一个一个接收
    String queryById(@SpringQueryMap FeignDto feignDto);
    @RequestMapping(value = "file/personPhotoUpload", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String personPhotoUpload(@RequestPart(value = "file") MultipartFile file,
                             @RequestParam(value = "moduleName") String moduleName,
                             @RequestParam(value = "functionName") String functionName,
                             @RequestParam(value = "needCompress") Boolean needCompress);
}
2.4、调用服务
@Resource
private FeignApi feignApi;
/**
* 通过主键查询单条数据
*/
@GetMapping("/feign/{id}")
@ApiOperation(value = "通过主键查询单条数据")
public ResultJson queryById( FeignDto feignDto, @PathVariable("id") Long id) {
   feignDto.setId(id);
   String s = feignApi.queryById(feignDto);
   return JSONObject.parseObject(s, ResultJson.class);
}
2.5、@FeignClient内部参数详解

2.5.1、value: 指定要调用的目标服务的服务名。可以是一个单独的服务名,也可以是多个服务名组成的数组。
2.5.2、url: 指定要调用的目标服务的URL地址,可以是一个完整的URL地址,也可以是占位符形式的URL地址。
2.5.3、path: 指定要调用的目标服务的基本路径,可以是一个字符串,也可以是一个占位符形式的字符串。
2.5.4、configuration: 指定要使用的Feign客户端配置类。可以自定义配置Feign客户端的行为。
2.5.5、decode404: 指定是否将404错误解码。默认情况下,Feign会将404错误解码为null值。
2.5.6、fallback: 指定一个回退类,当调用失败时,将调用回退类中的方法。回退类必须实现@FeignClient注解中的接口。
2.5.7、fallbackFactory: 指定一个回退工厂类,用于创建回退类的实例。回退工厂类必须实现FallbackFactory接口。
2.5.8、primary: 指定Feign客户端是否为首选客户端。如果设置为true,则优先使用该客户端。
2.5.9、qualifier: 指定Feign客户端的限定符。可以与@Autowired注解配合使用,用于指定要注入的Feign客户端实例。
2.5.10、name: 同value,指定要调用的目标服务的服务名。
2.5.11、contextId: 指定Feign客户端的上下文ID。用于区分不同的Feign客户端实例。
2.5.12、url: 指定要调用的目标服务的URL地址。

二、HttpClient

1、工具类

@Slf4j
public class HttpClientUtils {
    /**
     * 文件上传到第三方
     * @param url 网络地址
     * @param inputStream 文件流
     * @param headers 头文件(认证信息设置)
     * @param verification 是否需要验证
     * @return
     * @throws IOException
     */
    public static String uploadFile(String url, InputStream inputStream, Map<String, String> headers, boolean verification) throws IOException {
        HttpClient httpClient = verification ? HttpClients.createDefault() : wrapClient();
        HttpPost httpPost = new HttpPost(url);
        //设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
        httpPost.setConfig(requestConfig);

        if (headers != null) {
            headers.forEach((key, value) -> {
                httpPost.setHeader(key, value);
            });
        }
        //创建文件把流文件写入到字节内
        File file = File.createTempFile(UUID.randomUUID().toString(), ".jpg");
        FileOutputStream os = new FileOutputStream(file);

        int read = 0;
        byte[] buffer = new byte[1024];
        while ((read = inputStream.read(buffer, 0, 1024)) != -1) {
            os.write(buffer, 0, read);
        }
        inputStream.close();
        //发送邮件
        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
        FileBody fileBody = new FileBody(file, ContentType.MULTIPART_FORM_DATA);
        builder.addPart("file", fileBody);
        httpPost.setEntity(builder.build());

        HttpResponse response = httpClient.execute(httpPost);
        String httpEntityContent = getHttpEntityContent(response);
        httpPost.abort();
        return httpEntityContent;
    }

    /**
     * 封装HTTP POST方法
     *
     * @param verification TRUE为不跳过证书检测  FALSE为跳过证书检测
     * @param (如JSON串)
     * @return
     * @throws ClientProtocolException
     * @throws IOException
     */
    public static String post(String url, String body, Map<String, String> headers, boolean verification) throws ClientProtocolException, IOException {
        HttpClient httpClient = verification ? HttpClients.createDefault() : wrapClient();
        HttpPost httpPost = new HttpPost(url);
        //设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
        httpPost.setConfig(requestConfig);
        httpPost.setHeader("Content-Type", "application/json");
        if (headers != null) {
            headers.forEach((key, value) -> {
                httpPost.setHeader(key, value);
            });
        }
        if (body != null) {
            StringEntity s = new StringEntity(body, StandardCharsets.UTF_8);
            s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
            //设置参数到请求对象中
            httpPost.setEntity(s);
        }

        HttpResponse response = httpClient.execute(httpPost);
        String httpEntityContent = getHttpEntityContent(response);
        httpPost.abort();
        return httpEntityContent;
    }

    public static String put(String url, String body, Map<String, String> headers, boolean verification) throws ClientProtocolException, IOException {
        HttpClient httpClient = verification ? HttpClients.createDefault() : wrapClient();
        HttpPut httpPut = new HttpPut(url);
        //设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
        httpPut.setConfig(requestConfig);
        httpPut.setHeader(HTTP.CONTENT_TYPE, "application/json");
        if (headers != null) {
            headers.forEach((key, value) -> {
                httpPut.setHeader(key, value);
            });
        }
        if (body != null) {
            StringEntity s = new StringEntity(body, StandardCharsets.UTF_8);
            s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
            //设置参数到请求对象中
            httpPut.setEntity(s);
        }
        HttpResponse response = httpClient.execute(httpPut);
        String httpEntityContent = getHttpEntityContent(response);
        httpPut.abort();
        return httpEntityContent;
    }

    public static String delete(String url, String body, Map<String, String> headers, boolean verification) throws ClientProtocolException, IOException {
        HttpClient httpClient = verification ? HttpClients.createDefault() : wrapClient();
        HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(url);
        //设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
        httpDelete.setConfig(requestConfig);
        httpDelete.setHeader(HTTP.CONTENT_TYPE, "application/json");
        if (headers != null) {
            headers.forEach((key, value) -> {
                httpDelete.setHeader(key, value);
            });
        }
        if (body != null) {
            StringEntity s = new StringEntity(body, StandardCharsets.UTF_8);
            s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
            //设置参数到请求对象中
            httpDelete.setEntity(s);
        }
        HttpResponse response = httpClient.execute(httpDelete);
        String httpEntityContent = getHttpEntityContent(response);
        httpDelete.abort();
        return httpEntityContent;
    }

    /**
     * 封装HTTP GET方法
     *
     * @param
     * @param verification TRUE为不跳过证书检测  FALSE为跳过证书检测
     * @return
     * @throws ClientProtocolException
     * @throws IOException
     */
    public static String get(String url, Map<String, Object> params, Map<String, String> headers, boolean verification) throws ClientProtocolException, IOException {
        HttpClient httpClient = verification ? HttpClients.createDefault() : wrapClient();
        HttpGet httpGet = new HttpGet();
        //设置请求和传输超时时间
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
        httpGet.setConfig(requestConfig);
        if (headers != null) {
            headers.forEach((key, value) -> {
                httpGet.addHeader(key, value);
            });
        }
        if (params != null) {
            url = getUrlByParams(url, params);
        }
        httpGet.setURI(URI.create(url));
        HttpResponse response = httpClient.execute(httpGet);
        String httpEntityContent = getHttpEntityContent(response);
        httpGet.abort();
        return httpEntityContent;
    }

    private static String getUrlByParams(String url, Map<String, Object> params) {
        StringBuffer sb = new StringBuffer();
        params.forEach((key, value) -> {
            sb.append("&" + key + "=" + value);
        });
        if (sb.length() > 0) {
            String substring = sb.substring(1);
            url += url.contains("?") ? "&" : "?" + substring;
        }
        return url;
    }

    /**
     * 获得响应HTTP实体内容
     *
     * @param response
     * @return
     * @throws IOException
     * @throws UnsupportedEncodingException
     */
    private static String getHttpEntityContent(HttpResponse response) throws IOException, UnsupportedEncodingException {
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            InputStream is = entity.getContent();
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            String line = br.readLine();
            StringBuilder sb = new StringBuilder();
            while (line != null) {
                sb.append(line + "\n");
                line = br.readLine();
            }
            return sb.toString();
        }
        return null;
    }

    public static HttpClient wrapClient() {
        HttpClients.createDefault();
        try {
            SSLContext ctx = SSLContext.getInstance("TLS");
            X509TrustManager trustManager = new X509TrustManager() {
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }

                public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
                }

                public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
                }
            };
            ctx.init(null, new TrustManager[]{trustManager}, null);
            SSLConnectionSocketFactory ssf = new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE);
            return HttpClients.custom()
                    .setSSLSocketFactory(ssf)
                    .build();
        } catch (Exception e) {
            return HttpClients.createDefault();
        }
    }
}

2、调用解析

try {
    HashMap<String, String> map = new HashMap<>();
    map.put("app_id",appid);
    map.put("app_secret",appSecret);
    map.put("grant_type","client_credentials");

    String res = HttpClientUtils.post(host + "/oauth/token", JSON.toJSONString(map), null, false);
    JSONObject jsonObject = JSONObject.parseObject(res);
    if(jsonObject.containsKey("code") && jsonObject.getString("code").equals("0")){
        return JSONObject.parseObject(jsonObject.getString("result"),PushToken.class);
    }else{
        throw new ServiceException(res);
    }
}catch (ServiceException e){
    throw new ServiceException(e);
}catch (Exception e){
    e.printStackTrace();
}

三、路由代理

1、工具类

@Slf4j
@Component
public class RoutingDelegateUtil {

    @Resource
    //@Qualifier(value = "remoteRestTemplate")
    private RestTemplate restTemplate;

    /**
     * 上传form表单,文件
     */
    private final static String CONTENT_TYPE_FORM = "multipart/form-data;";

    /**
     * 请求转发统一处理
     *
     * @param request  原请求对象
     * @param routeUrl 路由地址,统一前缀,重定向目标主机域名(带协议及端口)
     * @param prefix   需要去除的前缀
     * @return
     * @throws Exception
     */
    public ResponseEntity<String> redirect(HttpServletRequest request, String routeUrl, String prefix) throws Exception {
        String contentType = request.getContentType();
        log.info("getContentType={}", contentType);
        // multipart/form-data处理
        if (StringUtils.isNotEmpty(contentType) && contentType.contains(CONTENT_TYPE_FORM)) {
            return redirectFile(request, routeUrl);
        } else {
            return redirect(request, routeUrl, prefix, String.class);
        }
    }

    /**
     * 上传form表单,文件
     * <p>
     * 请求转发处理
     *
     * @param request  原请求对象
     * @param routeUrl 重定向目标主机域名(带协议及端口)
     * @return
     * @throws IOException
     */
    public ResponseEntity<String> redirectFile(HttpServletRequest request, String routeUrl) throws IOException {
        // build up the redirect URL
        String redirectUrl = createRedictUrl(request, routeUrl, "");
        log.info("redirectFile redirectUrl={}", redirectUrl);
        String method = request.getMethod();
        //设置请求头
        MultiValueMap<String, String> headers = parseRequestHeader(request);

        // 组装form参数
        MultiValueMap<String, Object> form = new LinkedMultiValueMap<>();
        StandardMultipartHttpServletRequest standardMultipartHttpServletRequest = (StandardMultipartHttpServletRequest) request;
        // 组装form参数-文件
        MultiValueMap<String, MultipartFile> multiValueMap = standardMultipartHttpServletRequest.getMultiFileMap();
        for (Map.Entry<String, List<MultipartFile>> entries : multiValueMap.entrySet()) {
            for (MultipartFile multipartFile : entries.getValue()) {
                String fileName = multipartFile.getOriginalFilename();
                log.info("redirectFile MultipartFile: fileName={}", fileName);
                File file = File.createTempFile("spw-", fileName);
                multipartFile.transferTo(file);
                FileSystemResource fileSystemResource = new FileSystemResource(file);
                form.add(entries.getKey(), fileSystemResource);
            }
        }
        // 组装form参数-一般属性
        Enumeration<String> enumeration = standardMultipartHttpServletRequest.getParameterNames();
        while (enumeration.hasMoreElements()) {
            String name = enumeration.nextElement();
            String value = standardMultipartHttpServletRequest.getParameter(name);
            log.info("redirectFile enumeration: name={}, value={}", name, value);
            form.add(name, value);
        }

        // 用HttpEntity封装整个请求报文
        HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(form, headers);

        return restTemplate.exchange(redirectUrl, HttpMethod.valueOf(method), formEntity, String.class);
    }

    /**
     * 非form-data请求转发处理
     *
     * @param request  原请求对象
     * @param routeUrl 重定向目标主机域名(带协议及端口)
     * @param prefix    需要去除的前缀
     * @param clazz 结果类型
     * @return
     * @throws Exception
     */
    public <T> ResponseEntity<T> redirect(HttpServletRequest request, String routeUrl, String prefix, Class<T> clazz) throws Exception {
        // build up the redirect URL
        String redirectUrl = createRedictUrl(request, routeUrl, prefix);
        log.info("redirectUrl={}", redirectUrl);
        RequestEntity requestEntity = createRequestEntity(request, redirectUrl);
        return restTemplate.exchange(requestEntity, clazz);
    }

    /**
     * 构建重定向地址
     *
     * @param request  原请求对象
     * @param routeUrl 重定向目标主机域名(带协议及端口)
     * @param prefix   需要去除的前缀
     * @return
     */
    private String createRedictUrl(HttpServletRequest request, String routeUrl, String prefix) {
        String queryString = request.getQueryString();
        return routeUrl + request.getRequestURI().substring(1).replace(prefix, "") +
                (queryString != null ? "?" + queryString : "");
    }

    /**
     * 构建请求实体
     *
     * @param request 原请求对象
     * @param url     新目标路由URL
     * @return
     * @throws URISyntaxException
     * @throws IOException
     */
    private RequestEntity createRequestEntity(HttpServletRequest request, String url) throws URISyntaxException, IOException {
        String method = request.getMethod();
        HttpMethod httpMethod = HttpMethod.resolve(method);
        MultiValueMap<String, String> headers = parseRequestHeader(request);
        byte[] body = parseRequestBody(request);
        return new RequestEntity<>(body, headers, httpMethod, new URI(url));
    }

    /**
     * 解析请求体
     *
     * @param request
     * @return
     * @throws IOException
     */
    private byte[] parseRequestBody(HttpServletRequest request) throws IOException {
        InputStream inputStream = request.getInputStream();
        return StreamUtils.copyToByteArray(inputStream);
    }

    /**
     * 解析请求头
     *
     * @param request
     * @return
     */
    private MultiValueMap<String, String> parseRequestHeader(HttpServletRequest request) {
        HttpHeaders headers = new HttpHeaders();
        List<String> headerNames = Collections.list(request.getHeaderNames());
        for (String headerName : headerNames) {
            List<String> headerValues = Collections.list(request.getHeaders(headerName));
            for (String headerValue : headerValues) {
                headers.add(headerName, headerValue);
            }
        }
        return headers;
    }
}

2、工具类调用

@RequestMapping("/sys-monitor/**")
    @Description("服务监控分发")
    public ResultJson transmit(HttpServletRequest request, @RequestParam(value = "ip", required = false, defaultValue = "127.0.0.1") String ip) throws Exception {
        String routeUrl = "http://" + ip + ":端口";
        ResponseEntity<ResultJson> responseEntity = restRoute.redirect(request, routeUrl, "sys-monitor", ResultJson.class);
        return responseEntity.getBody();
    }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1651671.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

大数据和AI在半导体生产系统中的应用

大数据和AI在半导体生产系统中的应用场景非常广泛,涉及从设计、制造到质量控制和市场分析的各个环节。以下是一些具体的半导体大数据应用场景、技术原理、以及实现这些应用的具体做法和方法: 01、半导体大数据应用场景 1. 预测性维护 - **应用场景**:预测设备故障,提前…

android图标底色问题,debug与release不一致

背景 在android 8&#xff08;sdk 26&#xff09;之前的版本&#xff0c;直接使用图片文件作为图标&#xff0c;开发时比较容易控制图标&#xff0c;但是不同的安卓定制版本就不容易统一图标风格了。 在android 8及之后的版本&#xff0c;图标对应的是ic_launcher.xml&#x…

充电宝哪个牌子好更耐用?2024年耐用充电宝不能错过

随着科技的进步和智能手机的普及&#xff0c;我们的生活已经与手机紧密相连。然而&#xff0c;手机电量的限制却常常让我们感到焦虑和不安。一旦手机没电&#xff0c;我们就仿佛失去了与外界联系的能力&#xff0c;无法及时接收重要信息、进行导航或支付。为了解决这个问题&…

运放的同相与反相放大

反相放大器 同相端接地&#xff0c;电压为 0&#xff0c;反相端和同相端虚短&#xff0c;因此也是 0 V 的电压&#xff0c;同时由于虚断&#xff0c;几乎没有电流注入&#xff0c;所以R 1 和R 2 相当于串联&#xff0c;电阻上的电流相等 因此可以求出输入输出关系式为 V o u t…

【python数据分析基础】—pandas透视表和交叉表

目录 前言一、pivot_table 透视表二、crosstab 交叉表三、实际应用 前言 透视表是excel和其他数据分析软件中一种常见的数据汇总工具。它是根据一个或多个键对数据进行聚合&#xff0c;并根据行和列上的分组键将数据分配到各个矩形区域中。 一、pivot_table 透视表 pivot_tabl…

gitee 简易使用 上传文件

Wiki - Gitee.com 官方教程 1.gitee 注册帐号 2.下载git 安装 http://git-scm.com/downloads 3. 桌面 鼠标右键 或是开始菜单 open git bash here 输入&#xff08;复制 &#xff0c;粘贴&#xff09; 运行完成后 刷新网页 下方加号即可以添加文件 上传文件 下载 教程…

谷底入场,2024年普通人如何布局大健康赛道?_产业_发展_市场

【181、2077、9182】 坐标&#xff1a;厦门&#xff0c;我是易创客运营肖琳 深耕社交新零售行业10年&#xff0c;主要提供新零售系统工具及顶层商业模式设计、全案策划运营陪跑等。 今天为大家介绍普通人如何布局大健康赛道。 马云曾经说&#xff0c;未来10年能够超越阿里的…

医院预约挂号|基于Springboot+vue的医院预约挂号系统小程序的设计与实现(源码+数据库+文档)

医院预约挂号系统小程序 目录 基于Springboot&#xff0b;vue的医院预约挂号系统小程序设计与实现 一、前言 二、系统设计 三、系统功能设计 1小程序端 后台功能模块 4.2.1管理员功能 4.2.2医生功能 四、数据库设计 五、核心代码 六、论文参考 七、最新计算机毕设选…

Py脚本_文件分类

最近发现通过Edge和chrome或者其他浏览器下载的文件都存放在一个地方就很繁琐&#xff0c;于是翻找以前的脚本来归纳这些文件&#xff0c;虽然有IDM下载独有会自动分类&#xff0c;但是相信很多同学都在一个文件里找文件&#xff0c;这次就写个Py脚本来实现这个功能。 # -*- c…

git bash退出vim编译模式

解决方法&#xff1a; 1.按esc键&#xff08;回到命令模式&#xff09; 此时是没有分号让我们在后面输入命令的 2.按shift键: 3.再输入&#xff1a;wq&#xff0c;并按enter键 此时我们发现又回到git bash窗口 希望对大家有所帮助&#xff01;

配置好Maven后本地仓库不自动加载以及创建Maven报错的解决方法

先退出到全局模式再点击All Settings 点击maven 修改Maven home path修改了这个local不同步 点击Flie中的Module 然后选择maven 点击next设置需要存放的位置以及组名 然后报错 报错误的原因是因为maven版本太高和与你使用的IDEA版本不兼容 将maven的版本改为3.6并修改环境变量 …

销毁机密文件你还在用删的吗?文件粉碎了解一下哈!(附自制工具下载)

网管小贾 / sysadm.cc 窗外淅淅沥沥&#xff0c;陶克龙回到闷热的办公室&#xff0c;一屁股坐到了椅子上。 一大早他就接到了组织的秘密联络&#xff0c;他的身份已经暴露&#xff0c;需要尽快撤离。 此时的陶克龙大脑飞快地运转着&#xff0c;他需要从纷繁复杂的思绪中抽丝剥…

对于习惯使用ftp传输的企业,如何寻找最佳的替代方案?

FTP协议广泛应用各行业的文件传输场景中&#xff0c;对于很多企业而言&#xff0c;由于FTP应用获取门槛低、使用普遍&#xff0c;因此&#xff0c;有较为稳定的FTP使用习惯&#xff0c;但即便如此&#xff0c;也不得不面对&#xff0c;FTP应用存在着严重缺陷&#xff1a; 传输效…

AnaTraf:一款功能强大的网络流量分析工具,助您实现高效网络管理

在当下迅速发展的网络时代&#xff0c;网络流量分析已经成为网络管理和维护的关键环节。 AnaTraf网络流量分析仪&#xff1a;全面把控网络状况 AnaTraf 是一款高性能的实时网络流量分析工具,能够帮助您全面了解网络状况,提高网络运维效率。其主要功能包括: 全流量回溯分析&am…

node报错——解决Error: error:0308010C:digital envelope routines::unsupported——亲测可用

今天在打包vue2项目时&#xff0c;遇到一个报错&#xff1a; 最关键的代码如下&#xff1a; Error: error:0308010C:digital envelope routines::unsupportedat new Hash (node:internal/crypto/hash:80:19)百度后发现是node版本的问题。 在昨天我确实操作了一下node&…

终于找到微信聊天记录SQLite数据库文件解密方法了,一起来看看吧!

https://github.com/xuchengsheng/ 获取当前登录微信的微信昵称、账号、手机号、邮箱、秘钥、微信Id、文件夹路径 将微信PC的多个聊天记录数据库合并为单一数据库文件 支持微信聊天对话窗口&#xff08;文本消息&#xff0c;引用消息&#xff0c;图片消息&#xff0c;表情消息…

亚马逊最新的 Echo Show 5 和 Show 8

爆爆&#xff01;亚马逊最新智能显示器终于来了&#xff01;Show 8可是一个功能超强的小工具&#xff0c;既能当数码相框、智能家居控制器和闹钟&#xff0c;还能控制您家中的几乎所有设备&#xff01;8英寸的显示屏让您流媒体和视频通话体验更加流畅&#xff01; 如果您不需要…

Java并发编程: Synchronized锁升级

文章目录 一、jdk8 markword实现表二、使用工具来查看锁升级 一、jdk8 markword实现表 new -> 偏向锁 -> 轻量级锁&#xff08;自旋锁、自适应自旋锁&#xff09;-> 重量级锁&#xff1a; 偏向锁和轻量级锁都是用户空间完成的。重量级锁是需要向内核申请的。 synchr…

第五十一周:文献阅读+CNN-LSTM-AM

目录 摘要 Abstract 文献阅读&#xff1a;基于CNN-LSTM-AM时空深度学习模型的城市供水预测 现存问题 提出方法 创新点 方法论 CNN-LSTM-AM模型 研究实验 数据集 预处理 评估指标 实验过程 合格性验证 模型实现 总结 摘要 本周阅读的文献《Urban Water Supply …

Unity WebGL过曝问题的解决策略

文章目录 一些可能的解决策略1. **调整曝光设置**&#xff1a;2. **使用Lerp或其他颜色混合技巧**&#xff1a;3. **HDR与色调映射**&#xff1a;4. **检查光源强度和范围**&#xff1a;5. **材质和纹理设置**&#xff1a;6. **使用Platform-specific Settings**&#xff1a;7.…