HTTP protocol and java Protocol
After listening to a teacher's course, I felt that I was not familiar enough with HTTP. Therefore, I decided to write this blog post.
First, you can refer to this article: http://blog.csdn.net/gueter/article/details/1524447
Part 1: communication process between the browser and the server:
Part 2: Introduction to HTTP requests:
Part 3: HTTP Response
Which book is better at getting started with java?
I also think that many classic java books are not suitable for beginners, such as Thinking in Java and JAVA core technologies. Because they are too meticulous, you will only see them more and more chaotic, you cannot tell the primary and secondary nodes.
I suggest you start with a lot of well-evaluated university textbooks in China. Although they are written by Chinese people, although they are rough, they can at least show you the general java framework, you can also familiarize yourself with some basic syntaxes. A simple exercise after the book is done is mainly used to consolidate the work. Don't forget it if you have read it.
After reading a book like this and having a concept of java, you can look back at the classics outside China. At this time, the details are to supplement the rough points of the domestic textbooks. it is not difficult for you to understand them, nor to get lost in the endless details.
After reading one or two classics, you should be familiar with J2SE, and then turn to J2EE or j2s to look at your hobbies. According to the current market conditions, J2EE is better, that is, web development. Of course, at this time, we will learn other excellent open-source frameworks, such as the famous SSH (struts + spring + hibernate). We 'd better learn a scripting language (ruby, python, js, and php, it is mainly to understand the essence of the script language, the syntax is cloudification), and then it should be okay to find a good job.
This is the path to outsourcing companies, soft banks, IBM, and Internet companies.
Java interfaces use http to transmit data
5.1 request program code
Public void sendMessage () throws Exception {
System. out. println ("Start of calling servlet ==================== ");
StringBuffer sendStr = new StringBuffer ();
SendStr. append ("<? Xml version = \ "1.0 \" encoding = \ "UTF-8 \"?> ");
SendStr. append ("<report_data> ");
SendStr. append ("<request_req> 953943547334 </request_req> ");
SendStr. append ("<request_time> 2012040211394324 </request_time> ");
SendStr. append ("<request_param> ");
SendStr. append ("<query_month> 201203 </query_month> ");
SendStr. append ("</request_param> ");
SendStr. append ("</report_data> ");
BufferedReader reader = null;
Try {
String strMessage = "";
StringBuffer buffer = new StringBuffer ();
// Address of the received message
URL uploadServlet = new URL (
"Localhost: 9090/TestTransfers ");
HttpURLConnection servletConnection = (HttpURLConnection) uploadServlet
. OpenConnection ();
// Set connection Parameters
ServletConnection. setRequestMethod ("POST ");
ServletConnection. setDoOutput (true );
ServletConnection. setDoInput (... the remaining full text>