preface

as everyone knows ,Web Applications are deployed to Web Running in server , about Java For developers , understand Web The principle of server is very necessary . This series of articles mainly records how bloggers can write simple Web The server , The content includes knowledge points :Java Reflex mechanism ,XML analysis ,Http agreement , as well as Java
Web Basics .

Java reflex

Reflection can be said to be Java The most powerful technology in , It has too many uses . such as , Let the program build objects of any class at runtime , You can understand the class to which any object belongs , Understanding member variables and methods of a class , Call methods of arbitrary objects . The reflex is Java The key to dynamic language . Many excellent frameworks are used Java reflex , of course ,Web The server also needs reflection to complete .

Class class

be careful , This is about Class class , no class keyword .Class Class can be said to be Java The core of reflection mechanism . Objects of any class can get their corresponding Class Class object , It stores information related to this class , For example, member variables , Methods, etc . obtain Class There are three methods for class objects :

The first , Through the getClass() Method to get , An example is as follows :
// Mode 1 Person person = new Person(); Class<Person> clazz1 = (Class<Person>)
person.getClass();
The second , adopt Class name .class obtain , An example is as follows :
// Mode 2 Class<Person> clazz2 = Person.class;
The third , adopt Class.forName(“ Full path of class ”) Method acquisition , An example is as follows :
// Mode 3 Class<Person> clazz3 = (Class<Person>)
Class.forName("com.miguel.entity.Person");
under normal conditions , We're using a third approach , But pay attention , If this class does not exist , Will throw ClassNotFoundException abnormal , At this time, we need to do a good job of corresponding treatment .

 

This is my first blog , It will be updated later , Mainly some of my own learning notes and experience summary , For beginners , Big bulls light spray !

Technology
©2019-2020 Toolsou All rights reserved,
be based on STM32 Design of infrared obstacle avoidance car ( There is a code )( Essence )2020 year 6 month 26 day C# Class library Log help class ( Essence )2020 year 6 month 26 day C# Class library File read and write operation help class python primitive -- lock LockiPhone 12 price , Configure full exposure : Cut it off 64GB, Battery 2227mAh start vue monitor Treeselect Change of options ( Essence )2020 year 7 month 30 day Wechat applet Use of modules Map---Java judge Map Contains a key( Essence )2020 year 8 month 2 day TypeScript The use of generics jmeter-while Summary of controller use