Today the company Santa Claus gave each of us a nice apple gift box, with apples and Dove chocolate inside (unfortunately I don’t have a lucky note), deliciously.

###What did you do today

  • Cross-site Request Forgery (CSRF) is a common programming vulnerability. For applications or websites with CSPF vulnerability, an attacker can construct a URL in advance. Once the victim user has accessed the URL, the background will modify the user parameters in the database without the user’s knowledge.

  • Thread.yield() causes the current Thread to voluntarily yield the timeslice and causes the OS to schedule other threads in the Runnable state to use the timeslice. A call to yield only puts the current Thread on the ready queue, not the blocking queue. If no other ready Thread is found, the current Thread continues to run, faster than thread.sleep (0), allowing threads below the current priority to run.

  • Earlier I wrote a Filter, all to implement the Filter interface. It’s not a good way to find out today. Inheriting the abstract OncePerRequestFilter class is a good choice, which is compatible with a variety of runtime environments and versions. OncePerRequestFilter ensures that only one Filter is passed in a request, and no repeat execution is required. In servlet-2.3, Filter will Filter all requests, including forward and include cases. In servlet-2.4, Filter by default only blocks requests submitted externally. Forward and include internal forwards are not filtered, but Filter is sometimes used when forward requests are needed.

  • CAS has three operands: the memory value V, the old expected value A, and the value B to be modified. If and only if the expected value A and the memory value V are the same, change the memory value to B and return true, otherwise do nothing and return false.

  • Volatile prevents multiple threads from being visible. Volatile prevents variable synchronization for multiple writes. Volatile prevents thread safety for multiple writes. AtomicInteger count = new AtomicInteger(); Count. AddAndGet (10).

  • If the return type is the basic data type and return is the packaging data type, an NPE may be generated during automatic unpacking. We used the Optional class in JDK8 to prevent NPE problems.

  • Why use Integer to map database fields of type INT to entity classes? This in The Alibaba Java development specification manual and the major Java pen test questions, as well as the major company’s Java development specifications have been mentioned. Because the default value for int is 0 and the default value for Integer is null, an error is reported for int, but not for Integer. (Novice note)

  • I haven’t touched the code of the SpringMVC project for a long time and found a lot of bugs today. For example, “404, no suitable Handler was found for mapping”, this error is caused by the < MVC :annotation-driven /> configuration in spring-servlet. XML, which will be explained in the next blog.


###What to do tomorrow

  • Today, the Filter, Listener and Interceptor codes are basically completed, but I will get off work at 4 o ‘clock today and catch a train in the evening, so I have no time to record specific details. I will write another blog when I return to Guangzhou on Monday. (Delay one day) I was going to finish writing this blog and then get off work, but my girlfriend urged me to get off work.

  • The demo on Spring Security is delayed for another day (already delayed for two days)

  • I will return to Wuhan tomorrow.


###Summary

I have to say, I’m pretty inefficient. Start planning your schedule next week.