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”, […]
Tag: response
[Transfer] [Asp.Net] ASP.Net Response.ContentType detailed list
Different ContentType will affect the effect seen by the client. The default ContentType is text/html, which is the web page format. The code is as follows: What is displayed is a web page, and The original html code will be displayed.The following are some commonly used ContentTypes GIF images JPEG images TIFF images MICROSOFT WORD […]
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 com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONWriter; import lombok.extern.slf4j.Slf4j; import org.reactivestreams.Publisher; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.cloud.gateway.filter.GlobalFilter; import org.springframework.core.Ordered; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; import org.springframework.core.io.buffer.DefaultDataBufferFactory; 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 org.springframework.boot.context.properties.ConfigurationProperties; 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, […]
Create an intelligent voice response assistant using AWS and ChatGPT
Try how to integrate with AWS‘s AI service The complete code for this project can be found here. Detailed steps I broke this project into 8 steps: Record audio and save it in WAV format Upload audio files to Amazon S3 Transcribe and identify the content of audio saved in S3 using Amazon Transcribe Amazon […]