SpringMVC实用技术

1.校验框架

1.表单校验框架入门

表单校验的重要性

数据可以随意输入,导致错误的结果。表单校验保障了数据有效性、安全性

表单校验分类

校验位置:

客户端校验

服务端校验

校验内容与对应方式:

格式校验

        客户端:使用Js技术,利用正则表达式校验

        服务端:使用校验框架

逻辑校验

        客户端:使用ajax发送要校验的数据,在服务端完成逻辑校验,返回校验结果

        服务端:接收到完整的请求后,在执行业务操作前,完成逻辑校验

表单校验规则

长度:例如用户名长度,评论字符数量

非法字符:例如用户名组成

数据格式:例如Email格式、 IP地址格式

边界值:例如转账金额上限,年龄上下限

重复性:例如用户名是否重复

表单校验框架

JSR(Java Specification Requests):Java 规范提案

303:提供bean属性相关校验规则

JCP(Java Community Process):Java社区

Hibernate框架中包含一套独立的校验框架hibernate-validator

导入坐标

 <!--导入校验的jar303规范-->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <!--导入校验框架实现技术-->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.1.0.Final</version>
        </dependency>

注意:
tomcat7 :搭配hibernate-validator版本5...Final
tomcat8.5↑ :搭配hibernate-validator版本6...Final

1.开启校验

名称:@Valid 、 @Validated

类型:形参注解

位置:处理器类中的实体类类型的方法形参前方

作用:设定对当前实体类类型参数进行校验

@RequestMapping(value = "/addemployee")
public String addEmployee(@Valid Employee employee) {
    System.out.println(employee);
}

2.设置校验规则

名称:@NotNull

类型:属性注解 等

位置:实体类属性上方

作用:设定当前属性校验规则

每个校验规则所携带的参数不同,根据校验规则进行相应的调整
具体的校验规则查看对应的校验框架进行获取

public class Employee{
    @NotNull(message = "姓名不能为空")
    private String name;//员工姓名
}  

3.获取错误信息

@RequestMapping(value = "/addemployee")
public String addEmployee(@Valid Employee employee, Errors errors, Model model){
    System.out.println(employee);
    if(errors.hasErrors()){
        for(FieldError error : errors.getFieldErrors()){
            model.addAttribute(error.getField(),error.getDefaultMessage());
        }
        return "addemployee.jsp";
    }
    return "success.jsp";
}  

通过形参Errors获取校验结果数据,通过Model接口将数据封装后传递到页面显示

<form action="/addemployee" method="post">
    员工姓名:<input type="text" name="name"><span style="color:red">${name}</span><br/>
    员工年龄:<input type="text" name="age"><br/>
    <input type="submit" value="提交">
</form>

通过形参Errors获取校验结果数据,通过Model接口将数据封装后传递到页面显示
页面获取后台封装的校验结果信息

完整代码

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com</groupId>
    <artifactId>MVCvalidator</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.1.19.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.1.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.3.22</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.2.16</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.13</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.33</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>2.0.7</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.4</version>
        </dependency>
        <!--servlet3.1规范的坐标-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <!--jsp坐标-->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <!--spring web坐标-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.9.RELEASE</version>
        </dependency>
        <!--springmvc坐标-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.9.RELEASE</version>
        </dependency>

        <!--json相关坐标3个-->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.9.0</version>
        </dependency>
        <!--导入校验的jar303规范-->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <!--导入校验框架实现技术-->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.1.0.Final</version>
        </dependency>

    </dependencies>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <!--构建-->
   <!-- <build>
        &lt;!&ndash;设置插件&ndash;&gt;
        <plugins>
            &lt;!&ndash;具体的插件配置&ndash;&gt;
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <port>80</port>
                    <path>/</path>
                </configuration>
            </plugin>
        </plugins>
    </build>-->


</project>

web.xml

 <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:spring-mvc.xml</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

success.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<h1>数据添加成功</h1>

addemployee.xml

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加员工-用于演示表单验证</title>
</head>
<body>
    <form action="/addemployee" method="post">
        员工姓名:<input type="text" name="name"><span style="color: red">${name}</span><br>
        员工年龄:<input type="text" name="age"><br>
        <input type="submit" name="提交">
    </form>
</body>
</html>
package com.controller;

import com.domain.Employee;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.validation.Valid;
import java.util.List;

@Controller
public class EmployeeController {
    @RequestMapping(value = "/addemployee")
    public String addEmployee(@Valid Employee employee, Errors errors, Model m){
        if(errors.hasErrors()){
            List<FieldError> fieldErrors = errors.getFieldErrors();
            for(FieldError error:fieldErrors){
//                System.out.println(error.getField());
//                System.out.println(error.getDefaultMessage());
                m.addAttribute(error.getField(),error.getDefaultMessage());
            }
            return "addemployee.jsp";
        }
        return "success.jsp";
    }
}
package com.domain;

import javax.validation.constraints.NotBlank;

public class Employee {
    @NotBlank(message = "姓名不能为空")
    private String name; //员工姓名
    private Integer age; //员工年龄

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

2.多规则校验

同一个属性可以添加多个校验器

@NotNull(message = "请输入您的年龄")
@Max(value = 60,message = "年龄最大值不允许超过60岁")
@Min(value = 18,message = "年龄最小值不允许低于18岁")
private Integer age;//员工年龄

3种判定空校验器(NotNull)的区别 

表单数据@NotNull@NotEmpty@NotBlank
String s = null;falsefalsefalse
String s = “”;truefalsefalse
String s = " ";truetruefalse
String s = “test”;truetruetrue

3.嵌套校验

名称:@Valid

类型:属性注解

位置:实体类中的引用类型属性上方

作用:设定当前应用类型属性中的属性开启校验

public class Employee {
    //实体类中的引用类型通过标注@Valid注解,设定开启当前引用类型字段中的属性参与校验
    @Valid
    private Address address;
}

注意:开启嵌套校验后,被校验对象内部需要添加对应的校验规则 

4.分组校验

同一个模块,根据执行的业务不同,需要校验的属性会有不同

        新增用户

        修改用户

对不同种类的属性进行分组,在校验时可以指定参与校验的字段所属的组类别

        定义组(通用)

        为属性设置所属组,可以设置多个

        开启组校验

public interface GroupOne {
}
 @RequestMapping(value = "/addemployee")
    public String addEmployee(@Validated({GroupA.class}) Employee employee, Errors errors, Model m){
        if(errors.hasErrors()){
            List<FieldError> fieldErrors = errors.getFieldErrors();
            System.out.println(fieldErrors.size());
            for(FieldError error:fieldErrors){
//                System.out.println(error.getField());
//                System.out.println(error.getDefaultMessage());
                m.addAttribute(error.getField(),error.getDefaultMessage());
            }
            return "addemployee.jsp";
        }
        return "success.jsp";
    }
@NotEmpty(message = "姓名不能为空",groups = {GroupOne.class})
private String name;//员工姓名

2.文件上传

1.文件上传下载 

上传文件过程分析

SpringMvc把这些步骤进行封装变为一个接口,就是MultipartResolver

MultipartResolver接口 

MultipartResolver接口定义了文件上传过程中的相关操作,并对通用性操作进行了封装

MultipartResolver接口底层实现类CommonsMultipartResovler

CommonsMultipartResovler并未自主实现文件上传下载对应的功能,而是调用了apache的文件上传下载组件

需导入坐标

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.4</version>
</dependency>

代码实现

package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@Controller
public class FileUploadController {
    @RequestMapping(value = "/fileupload")
    public String fileupload(MultipartFile file) throws IOException {
        System.out.println("file upload is running..."+file);
        file.transferTo(new File("zjl.png"));
        return "page.jsp";
    }
}
<context:component-scan base-package="com"/>

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="1024000000"/>
    </bean>
    <mvc:annotation-driven/>

fileupload.jsp

<form action="/fileupload" method="post" enctype="multipart/form-data">
    上传LOGO:<input type="file" name="file"/><br/>
    上传照片:<input type="file"/><br/>
    上传任意文件:<input type="file"/><br/>
    <input type="submit" value="上传"/>
</form>

2.文件上传注意事项

1.文件命名问题, 获取上传文件名,并解析文件名与扩展名

2.文件名过长问题

3.文件保存路径

4.重名问题

package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;

@Controller
public class FileUploadController {
    @RequestMapping(value = "/fileupload")
//参数中定义MultipartFile参数,用于接收页面提交的type=file类型的表单,要求表单名称与参数名相同
    public String fileupload(MultipartFile file,MultipartFile file1,MultipartFile file2, HttpServletRequest request) throws IOException {
        System.out.println("file upload is running ..."+file);
        //        MultipartFile参数中封装了上传的文件的相关信息
//                System.out.println(file.getSize());
//                System.out.println(file.getBytes().length);
//                System.out.println(file.getContentType());
//                System.out.println(file.getName());
//                System.out.println(file.getOriginalFilename());
//                System.out.println(file.isEmpty());
        //首先判断是否是空文件,也就是存储空间占用为0的文件
        if(!file.isEmpty()){
            //如果大小在范围要求内正常处理,否则抛出自定义异常告知用户(未实现)
            //获取原始上传的文件名,可以作为当前文件的真实名称保存到数据库中备用
            String fileName = file.getOriginalFilename();
            //设置保存的路径
            String realPath = request.getServletContext().getRealPath("/images");
            //保存文件的方法,指定保存的位置和文件名即可,通常文件名使用随机生成策略产生,避免文件名冲突问题
            file.transferTo(new File(realPath,file.getOriginalFilename()));
        }
        //测试一次性上传多个文件
        if(!file1.isEmpty()){
            String fileName = file1.getOriginalFilename();
            //可以根据需要,对不同种类的文件做不同的存储路径的区分,修改对应的保存位置即可
            String realPath = request.getServletContext().getRealPath("/images");
            file1.transferTo(new File(realPath,file1.getOriginalFilename()));
        }
        if(!file2.isEmpty()){
            String fileName = file2.getOriginalFilename();
            String realPath = request.getServletContext().getRealPath("/images");
            file2.transferTo(new File(realPath,file2.getOriginalFilename()));
        }
        return "page.jsp";
    }

}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<form action="/fileupload" method="post" enctype="multipart/form-data">
    上传LOGO:<input type="file" name="file"/><br/>
    上传照片:<input type="file1"/><br/>
    上传任意文件:<input type="file2"/><br/>
    <input type="submit" value="上传"/>
</form>

3.Restful

1.Restful开发入门

Rest( REpresentational State Transfer) 一种网络资源的访问风格,定义了网络资源的访问方式

传统风格访问路径

http://localhost/user/get?id=1

http://localhost/deleteUser?id=1

Rest风格访问路径

http://localhost/user/1

Restful是按照Rest风格访问网络资源

优点

隐藏资源的访问行为,通过地址无法得知做的是何种操作

书写简化

Rest行为约定方式

GET(查询) http://localhost/user/1 GET

POST(保存) http://localhost/user POST

PUT(更新) http://localhost/user PUT

DELETE(删除) http://localhost/user DELETE

注意:上述行为是约定方式,约定不是规范,可以打破,所以称Rest风格,而不是Rest规范

2.Restful风格配置 

package com.controller;

import org.springframework.web.bind.annotation.*;

//设置rest风格的控制器
@RestController
//设置公共访问路径,配合下方访问路径使用
@RequestMapping("/user/")
public class UserController {
    //rest风格访问路径完整书写方式
    @RequestMapping("/user/{id}")
    //使用@PathVariable注解获取路径上配置的具名变量,该配置可以使用多次
    public String restLocation(@PathVariable Integer id){
        System.out.println("restful is running ....");
        return "success.jsp";
    }

    //rest风格访问路径简化书写方式,配合类注解@RequestMapping使用
    @RequestMapping("{id}")
    public String restLocation2(@PathVariable Integer id){
        System.out.println("restful is running ....get:"+id);
        return "success.jsp";
    }

    //接收GET请求配置方式
    @RequestMapping(value = "{id}",method = RequestMethod.GET)
    //接收GET请求简化配置方式
    @GetMapping("{id}")
    public String get(@PathVariable Integer id){
        System.out.println("restful is running ....get:"+id);
        return "success.jsp";
    }

    //接收POST请求配置方式
    @RequestMapping(value = "{id}",method = RequestMethod.POST)
    //接收POST请求简化配置方式
    @PostMapping("{id}")
    public String post(@PathVariable Integer id){
        System.out.println("restful is running ....post:"+id);
        return "success.jsp";
    }

    //接收PUT请求简化配置方式
    @RequestMapping(value = "{id}",method = RequestMethod.PUT)
    //接收PUT请求简化配置方式
    @PutMapping("{id}")
    public String put(@PathVariable Integer id){
        System.out.println("restful is running ....put:"+id);
        return "success.jsp";
    }

    //接收DELETE请求简化配置方式
    @RequestMapping(value = "{id}",method = RequestMethod.DELETE)
    //接收DELETE请求简化配置方式
    @DeleteMapping("{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("restful is running ....delete:"+id);
        return "success.jsp";
    }
}

page.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<h1>数据添加成功</h1>
<form action="/user/1" method="post">
    <input type="text" name="_method" value="PUT">
    <input type="submit"/>
</form>

开启SpringMVC对Restful风格的访问支持过滤器,即可通过页面表单提交PUT与DELETE请求

页面表单使用隐藏域提交请求类型,参数名称固定为_method,必须配合提交类型method=post使用

在web.xml中配置过滤器

<!--配置过滤器,解析请求中的参数_method,即可通过页面表单提交PUT请求与DELETE请求-->
<filter>
    <filter-name>HiddenHttpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>HiddenHttpMethodFilter</filter-name>
    <servlet-name>DispatcherServlet</servlet-name>
</filter-mapping>

3.postman使用 

直接在官网下载,然后安装注册

postman 是一款可以发送Restful风格请求的工具,方便开发调试

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【linuxC语言】系统调用IO文件操作

文章目录 前言一、文件描述符介绍二、系统调用IO API介绍2.1 open函数2.2 close函数2.3 read函数2.4 write函数2.5 lseek函数 三、示例代码总结 前言 在Linux系统中&#xff0c;C语言通过系统调用实现对文件的输入输出&#xff08;I/O&#xff09;操作。系统调用提供了访问操作…

LLM - 使用 Langchain 实现本地 Naive RAG

目录 一.引言 二.构建本地 Langchain 库 1.Doc 知识文档 2.Split 文档切分 3.Encode 内容编码 4.Similar 本地库构建 三.缓存本地 Langchain 库 四.读取本地 Langchain 库 1.Load 读取缓存 2.Similar 预测 3.Add 添加文档 五.总结 一.引言 上一篇博客介绍了当下 R…

M2TS转MP4怎么转?超快的方法~

M2TS格式的优点主要体现在对高清视频的完美支持&#xff0c;能够提供极致的视觉体验。然而&#xff0c;由于其相对较大的文件大小&#xff0c;有时可能不太适合网络传输。此外&#xff0c;部分不支持M2TS的播放设备可能导致一定的兼容性问题。 想要播放m2ts视频&#xff0c;可…

MySQL实战45讲——30答疑文章(二):用动态的观点看加锁

目录 不等号条件里的等值查询 等值查询的过程 怎么看死锁&#xff1f; 怎么看锁等待&#xff1f; update 的例子 小结 上期问题时间 提示 文章摘自林晓斌老师《MySQL实战45讲》&#xff0c;作为笔记而用&#xff0c;故有加一些自己的理解。在第[20]和[21]篇文章中&…

Python基础二

一、变量 在编程中&#xff0c;变量是用来存储数据值的名称。在 Python 中&#xff0c;变量是动态类型的&#xff0c;这意味着你可以将任何类型的数据分配给一个变量&#xff0c;而不需要提前声明变量的类型。 1、全局变量 在函数外部定义的变量是全局变量&#xff0c;可以在程…

cesium-天际线

主要是两个着色器 let postProccessStage new Cesium.PostProcessStage({//unform着色器对象 textureScalefragmentShader:// 声明一个纹理采样器 colorTexture 用于读取纹理颜色uniform sampler2D colorTexture; // 声明一个纹理采样器 depthTexture 用于读取深度纹理unifor…

Python接口自动化之Token详解及应用

以下介绍Token原理及在自动化中的应用。 一、Token基本概念及原理 1.Token作用 为了验证用户登录情况以及减轻服务器的压力&#xff0c;减少频繁的查询数据库&#xff0c;使服务器更加健壮。 2.什么是Token Token是服务端生成的一串字符串&#xff0c;以作客户端进行请求的…

《焦点访谈》上的星火大模型:AI生成春天散文,共绘美好春天

发布 | 大力财经 在今年的全国“两会”上&#xff0c;全国人大代表、科大讯飞董事长刘庆峰提出了关于制定国家《通用人工智能发展规划》的建议&#xff0c;推动我国通用人工智能的发展&#xff0c;以应对全球AI领域的激烈竞争。 刘庆峰在3月6日晚间的《焦点访谈》中表示&#…

简单整理vue-router,路由知识

1.项目中引入 1.1 安装注册 1.2 封装抽离 在main.js中 书写,会造成单个js文件过于臃肿的情况,需要将路由配置部分抽离出来,在src下新建router文件夹,新建index.js文件 import Vue from vue import VueRouter from vue-router import HomeView from ../views/HomeView.vue im…

Elasticsearch:dense vector 数据类型及标量量化

密集向量&#xff08;dense_vector&#xff09;字段类型存储数值的密集向量。 密集向量场主要用于 k 最近邻 (kNN) 搜索。 dense_vector 类型不支持聚合或排序。 默认情况下&#xff0c;你可以基于 element_type 添加一个 dend_vector 字段作为 float 数值数组&#xff1a; …

【中间件】docker的安装

&#x1f4dd;个人主页&#xff1a;五敷有你 &#x1f525;系列专栏&#xff1a;中间件 ⛺️稳中求进&#xff0c;晒太阳 .卸载旧版 首先如果系统中已经存在旧的Docker&#xff0c;则先卸载&#xff1a; yum remove docker \docker-client \docker-client-latest \doc…

Web自动化测试学习方向(Selenium)

&#x1f525; 交流讨论&#xff1a;欢迎加入我们一起学习&#xff01; &#x1f525; 资源分享&#xff1a;耗时200小时精选的「软件测试」资料包 &#x1f525; 教程推荐&#xff1a;火遍全网的《软件测试》教程 &#x1f4e2;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1…

chrome插件webRequest拦截请求并获取post请求体requestBody数据raw内容,解决中文乱码问题

详细使用说明可以看官方文档&#xff1a;https://developer.chrome.com/docs/extensions/reference/api/webRequest?hlzh-cn 拦截操作 想要通过浏览器插件拦截请求的话&#xff0c;需要在manifest.json里面添加webRequet权限&#xff1a; 拦截请求代码放在background.js里面…

Web服务器

Web服务器 1. 阻塞/非阻塞、同步/异步(网络IO)2. Unix/Linux 上的五种IO模型2.1 阻塞 blocking2.2 非阻塞 non-blocking &#xff08;NIO&#xff09;2.3 IO复用&#xff08;IO multiplexing&#xff09;2.4 信号驱动&#xff08;signal-driven&#xff09;2.5 异步&#xff08…

【项目实践04】【RocketMQ消息收发拦截器】

文章目录 一、前言二、项目背景三、实现方案1. 关键接口2. 消息发送方3. 消息消费方4. 配置引入类5. 使用示例 四、思路扩展1. 消费流程简介 一、前言 本系列用来记录一些在实际项目中的小东西&#xff0c;并记录在过程中想到一些小东西&#xff0c;因为是随笔记录&#xff0c…

【Web】浅聊JDBC的SPI机制是怎么实现的——DriverManager

目录 前言 分析 前言 【Web】浅浅地聊JDBC java.sql.Driver的SPI后门-CSDN博客 上篇文章我们做到了知其然&#xff0c;知道了JDBC有SPI机制&#xff0c;并且可以利用其Driver后门 这篇文章希望可以做到知其所以然&#xff0c;对JDBC的SPI机制的来源做到心里有数 分析 先是…

如何实现数据中心布线变更管理?

前言 随着科技的不断发展&#xff0c;数据中心作为企业的核心基础设施之一&#xff0c;承载着大量重要的业务数据。在数据中心运维过程中&#xff0c;变更管理流程变得尤为重要&#xff0c;它是确保数据中心基础设施稳定运行和保障数据安全的关键环节。变更管理的定义是指在维…

电商效果图云渲染优势是什么?

电商效果图云渲染指的是利用云计算技术&#xff0c;将电商所需的效果图渲染任务转移至云服务器进行处理。这些云服务器凭借其卓越的计算能力与庞大的存储空间&#xff0c;能够迅速完成复杂的渲染任务&#xff0c;从而释放本地电脑资源&#xff0c;提升工作效率。 电商效果图云…

常见四种限流算法详解(附:javaDemo)

限流简介 现代互联网很多业务场景&#xff0c;比如秒杀、下单、查询商品详情&#xff0c;最大特点就是高并发&#xff0c;而往往我们的系统不能承受这么大的流量&#xff0c;继而产生了很多的应对措施&#xff1a;CDN、消息队列、多级缓存、异地多活。 但是无论如何优化&…

今日学习总结2024.3.2

最近的学习状态比较好&#xff0c;感觉非常享受知识进入脑子的过程&#xff0c;有点上头。 实验室一个星期唯一一天的假期周六&#xff0c;也就是今天&#xff0c;也完全不想放假出去玩啊&#xff0c;在实验室泡了一天。 很后悔之前胆小&#xff0c;没有提前投简历找实习&…
最新文章