HTTP status code, response header, request header

1. Status code in Chinese 100: “Continue”, 101: “Exchange Agreement”, 200: “OK”, 201: “Created”, 202: “Accept”, 203: “Non-authoritative information”, 204: “No content”, 205: “Reset content”, 206: “Part of the content”, 300: “Multiple selection”, 301: “Moved permanently”, 302: “Found”, 303: “See others”, 304: “Not modified”, 305: “Use proxy”, 307: “Temporary Redirect”, 400: “Bad Request”, 401: “Unauthorized”, […]

WebGL response context loss solution

Table of Contents Response context lost How to respond to context loss context events Sample program (RotatingTriangle_contextLost.js) Response context lost WebGL uses the computer’s graphics hardware, and these resources are managed by the operating system and shared by multiple applications, including browsers. In some special circumstances, such as another program taking over the graphics hardware, […]

Coke DTO components, unified response

Cola DTO component, unified response Response content 1. Response failed 2.Single piece of data 3.Multiple pieces of data 4. Paging data Domain Model @Getter @AllArgsConstructor public enum CatType {<!– –> CHINA(“Chinese Pastoral Cat”), PERSIAN(“Persian cat”), TOMCAT(“Tom Cat”); private final String desc; } @Entity @Table(name = “tbl_cat”) @Data @Accessors(chain = true) @FieldNameConstants public class Cat {<!– […]

Django template loading and response

Foreword Django’s template system decouples Python code from HTML code and dynamically generates HTML pages. Django projects can be configured with one or more template engines, but usually when using Django’s template system, you should first consider its built-in backend DTL (Django Template Language, Django template language). 1. What is a template In Django, templates […]

Spring Cloud Gateway 3 Modify response body case 2 in global filter

import; import; import lombok.extern.slf4j.Slf4j; import org.reactivestreams.Publisher; import; import; import org.springframework.core.Ordered; import; import; import; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponseDecorator; import org.springframework.stereotype.Component; import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.util.annotation.NonNull; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Optional; @Component @Slf4j public class GatewayGlobalFilter implements GlobalFilter, Ordered {<!– –> @Override […]

SpringMVC-request and response

1. Environment preparation <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> //Determine the scope to avoid conflicts with tomcat </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> //Start webmvc in spring <version>5.2.10.RELEASE</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <port>80</port> <path>/</path> <uriEncoding>UTF-8</uriEncoding> //This is to solve the problem of Chinese garbled characters in tomcat […]

SpringBoot global exception handling request parameter verification and response body packaging

1. Response body packaging Global interface response body packaging, returning json data Support release of some interfaces or classes # mvc configuration mvc: body-exclude-paths: -/test/** body-exclude-classes: – com.qiangesoft.rdp.starter.XXX import lombok.Data; import; import org.springframework.context.annotation.Configuration; import java.util.ArrayList; import java.util.List; /** * mvc interface packaging configuration * * @author qiangesoft * @date 2023-09-18 */ @Data @Configuration @ConfigurationProperties(prefix […]

Aggregation and unification, SpringBoot implements global response and global exception handling

Table of Contents Preface global response Data specification Status code (error code) global response class use optimization Global exception handling Why global exception handling is needed Business exception class global capture use optimization Summarize Foreword In version 1.0 of Yuexiang Campus, data is returned in the form of Map objects. Although it is more convenient, […]