HttpServletRequest getParameter() missing parameter problem

Background Implemented a basic component can intercept all http requests, the request header/parameter/body/response, etc. for printout. Here the most critical and most difficult to deal with is the output of the body, because the transmission of characters in the body is obtained through the HttpServletRequest byte stream getInputStream (); and this byte stream does not exist after reading once. For example, the use of open source frameworks such as Spring some links have been intercepted to read the input stream, that after our custom interceptor to intercept the print body, the InputStream has no bytes … The implementation of the idea is not difficult, is their own inheritance to achieve HttpServletRequestWrapper, a copy of the body to save a good, and then in the Filter chain transfer can be.

Nuclear-grade Log4j vulnerabilities remain prevalent and have ongoing impact

Log4j “nuclear-grade” vulnerability Log4Shell may affect the world forever. The U.S. Department of Homeland Security (DHS) Cybersecurity Review Board (CSRB) recently released its investigative report in response to last year’s Log4Shell vulnerability. The CSRB is an agency established by DHS only this February to investigate major cybersecurity incidents and provide reports containing recommendations to enhance the nation’s cybersecurity. The CSRB’s first investigation was into the “nuclear-grade” vulnerability that erupted in Log4j last year.

Java Date Timestamp Date Comparison Pitfalls

Scenario reenactment In the mysql database (innodb engine) tab table has a createAt field of type datetime(6) precise to milliseconds.Of course we know that mysql’s date field is only accurate to the second level by default, if you want to millisecond subtlety can be defined as datetime(6), from version 5.6.4 onwards support business interface A through the ORM framework to deposit a record in the table, here createAt deposit2016-04-13 15:20:39.152

StackOverflowError errors in Java

Introduction StackOverflowError can be annoying for Java developers as it is one of the most common runtime errors we may encounter. In this article, we will learn how this error occurs by looking at various code examples and how to handle it. Stack Frames and StackOverflowerError Occur Let’s start with the basics. When a method is called, a new stack frame is created on the call stack. This stack frame contains the parameters of the called method, its local variables and the return address of the method, i.

Jump table implementation in Java

Introduction Jump table is a data structure for storing a sorted list of elements with the help of a linked table hierarchy connected to a subsequence of elements. Jump table allows to handle item lookups in an efficient way. A jump table is a probabilistic data structure, which means that it skips several elements of the entire list, hence the name. We can think of a jump table as an extended version of a linked table.

The difference between the delete() method and deleteOnExit() method in Java.io.

delete () method Deletes a file directly when the delete () method is called, regardless of whether the file exists or not, and executes it as soon as it is called. deleteOnExit () method When the deleteOnExit () method is called, it is only equivalent to a declaration of deleteOnExit (), and the deleteOnExit () method is really called when the program is finished running and the JVM is terminated to achieve the delete operation.

Why do double floating point operations lose precision?

1. What is a floating point number? A floating point number is a type of data used by computers to represent decimals, using scientific notation. In java, double is a double-precision, 64-bit, floating-point number, and the default is 0.0d. float is a single-precision, 32-bit floating-point numbers, default is 0.0f. Storing in memory float sign bit (1 bit) exponent (8 bit) mantissa (23 bit) double sign bit (1 bit) exponent (11 bit) mantissa (52 bit)

Seven of the best Java testing frameworks

Java is one of the most popular programming languages today and is perennially in the top three of the most popular programming languages. A good java programmer cannot develop safer and more efficient code without knowledge of testing frameworks. One of the most important reasons for using these testing frameworks is to reduce the possibility of errors, increase development efficiency, and reduce development costs. In this article, we will introduce the most common testing frameworks used for Java testing.

Java Proxy Pattern Explained

1. Proxy Pattern The proxy pattern is a relatively well understood design pattern. Simply put we use a proxy object to replace access to the real object (real object), so that we can provide additional functional operations to extend the functionality of the target object without modifying the original target object. The main purpose of the proxy pattern is to extend the functionality of the target object, for example, you can add some custom operations before and after the execution of a method of the target object.

Java Geometry spatial geometry data processing applications

First understand a few basic concepts that help to understand the application scenario of this article Geographic Information System GIS GIS (Geographic Information System or Geo-Information system, GIS) is sometimes referred to as a “geographic information system”. It is a specific and very important spatial information system. It is in the [computer] hardware and software system support, the whole or part of the [Earth] surface (including the atmosphere) space in the relevant [geographic] distribution [data], [storage], [management], [computing], [analysis], [show]and [description] of the technical system

Java8 is going down? Jenkins announces support for Java 11 and above only

Jenkins, an open source Devops tool, announced: Starting with the June 28th release of Jenkins 2.357 and the upcoming September LTS release, Jenkins requires Java 11 as a minimum. Originally known as Hudson, Jenkins is a venerable continuous integration tool that has been in existence for over a decade. Since its inception in 2005, the Jenkins project has undergone several Java migrations. The current migration from Java 8 to Java 11 is consistent with the migration history in the Jenkins project.

Java Multithreaded Concurrent FutureTask

Java’s multithreading mechanism essentially accomplishes two things, asynchronous computation and concurrency. Concurrency is solved by a series of APIs that address thread safety; asynchronous computation, on the other hand, is commonly used with Runnable and Callable in conjunction with threads. FutureTask is a cancelable asynchronous callable API based on the Runnable implementation. Basic usage Future represents the result of an asynchronous computation, and is executed via the ExecutorService’s Future<? > submit(Runnable task) method of the ExecutorService, which is used as the return value.

The essence and difference between IO and NIO in Java

Introduction The full name of IO is input output, is the bridge between the java program and the outside world, IO refers to all the classes in the java.io package, they exist from java 1.0. NIO is called new IO, is the new generation of IO introduced in java 1.4. What is the nature of IO? What is the difference between it and NIO? How do we learn IO and NIO?

OpenJDK proposal will provide Java class file API

The Java community is working on a Classfile API proposal that aims to provide an API for parsing, generating, and converting Java class files; initially as an internal replacement for the ASM in the JDK, and later as a public API. It is planned that ASM will eventually be removed from the JDK entirely. The proposal notes that class file generation, parsing, and detection are ubiquitous in the Java ecosystem; many tools and libraries need to be able to handle class files, and frameworks often perform on-the-fly bytecode instrumentation, transformation, and generation.

Building an infinite stream in java 8

Introduction In java, we can convert a specific set into a stream, so in some cases, such as in a test environment, we need to construct a stream with a certain number of elements, how do we need to handle it? Here we can construct an unlimited stream and then call the limit method to limit the number returned. Basic use Let’s start with an example of using Stream.iterate to create an infinite Stream.

Customizing parallelStream's thread pool

Introduction By default, ForkJoinPool creates a thread for each processor, and parallelStream will use this shared thread pool to submit tasks if not specified. So how do we handle a specific situation where we want to use a custom ForkJoinPool? Common operations If we want to do an addition from 1 to 1000, we can use parallel stream like this. 1 2 3 4 5 List<Integer> integerList= IntStream.range(1,1000).boxed().collect(Collectors.toList()); ForkJoinPool customThreadPool = new ForkJoinPool(4); Integer total= integerList.

Cloud Native Compiler - Java Cloud Compiler

Azul has introduced a new cloud-native compiler, Java Cloud Compiler, which offloads Java JIT compilation from local systems to elastic resources, reducing the amount of resources needed to run applications and shortening the time to peak performance. Understanding JIT and AOT The Java Runtime is a completely self-reliant system designed to run and improve code on a single system. The runtime works through just-in-time (JIT) compilation, using native resources that convert Java bytecode (JAR and class files) into native code to improve speed and memory.

Java Virtual Threads

Virtual threading is something I’m really excited about. It’s a long-awaited feature in the language and we’ve made very few attempts to implement it in the past, but it’s finally here and it’s been merged into Java 19. This means that it will be included as a preview feature and we will be able to use it as soon as JDK 19 is released. Most of the content on the virtual (green) threads is written by non-Java developers, why is that?

How to avoid memory leaks in java programs

Although jvm has a garbage collection mechanism, if the program is written without paying attention to some specific rules, it can still lead to memory leaks in java programs, which may end up with OutOfMemory exceptions. 1. Causes of memory leaks in Java Objects in java are divided into 2 types in terms of usage, referenced and unreferenced. Garbage collection only recovers objects that are not referenced. Referenced objects, even if they are no longer used, are not recycled.

ElasticSearch new version of JavaClient using the introduction

The java client used by ElasticSearch before version 7.17 was the Java REST Client, but since version 7.17, the Java REST Client has been officially marked as deprecated and the new version of the Java Client is recommended. This article introduces the new version of the ElasticSearch Java Client’s basic usage. The specific code reference Example project. I. Overview Elasticsearch 7.17 version of the new Java API Client has the following advantages.