Home > Back-end >  Of new questions: Java access request protocol using HTTP post requests into the get, use the HTTPS
Of new questions: Java access request protocol using HTTP post requests into the get, use the HTTPS

Time:09-15

Package com. SXT. Server;

import java.io.IOException;
Import the Java. IO. InputStream;
The import java.net.ServerSocket;
The import java.net.Socket;

/* *
* goal: use ServerSocket build browser connection, get request protocol
* @ author Administrator
*
*/
Public class Server01 {
Private ServerSocket ServerSocket.
Public static void main (String [] args) {
Server01 server=new Server01 ();
Server. The start ();
}
//start the service
Public void the start () {
Try {
ServerSocket=new serverSocket (8888);
The receive ();
} the catch (IOException e) {
e.printStackTrace();
System. The out. Println (" server startup failure ");
}
}
//accept connections processing
Public void the receive () {
Try {
The Socket client=serverSocket. The accept ();
System. Out.println (" a client connection is established... ");
//get request protocol
InputStream is=client. GetInputStream ();

Byte [] datas=new byte (1024 * 1024),
Int len=is. Read (datas);
String requestInfo=new String (datas, 0, len);
System. The out. Println (requestInfo);
} the catch (IOException e) {
e.printStackTrace();
System. The out. Println (" the client error ");
}
}
//stop service
Public void the stop () {

}
}



Here is the HTML file



Log in & lt;/title> <br/></head> <br/><body> <br/><h1> The use of the form & lt;/h1> <br/><Pre> <br/>Post: submitted, based on the HTTP protocol of large amount of different url request parameter is not visible security <br/>The get: by default, access, small amount of HTTP protocol based on different url request parameter is unsafe <br/>Action: request to the web server's resource URL <br/>Name: used as the back-end, distinguish the only request data server does not exist, cannot submit <br/>Id: used as a front end, distinguish the only <br/></pre> <br/><The form mathod="post" action="https://localhost:8888/index.html" & gt; <br/>User name: & lt; Input type="text" name="uname" id="uname" & gt; <br/>Password: & lt; Input type="password" name="PWD" id="PWD" & gt; <br/><Input type="submit" value="https://bbs.csdn.net/topics/login & gt;" <br/></form> <br/></body> <br/></html> <br/><p class="article - content rp"> CodePudding user response: </p>Serversocket use TCP protocol, page sends the HTTP protocol, certainly not receive, <br/>If you want to use the page request will first have to do is to learn to write a servlet JavaEE<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 1/f, don't drink coffee love tea response: <legend> <blockquote> serversocket use TCP protocol, page sends the HTTP protocol, certainly not receive, <br/>If you want to use the page request will first have to do is to learn to write a servlet JavaEE </blockquote> <fieldset> how to write? I just according to the teaching video, HTTP access to post directly display the post by the teacher, then own HTTP access to post directly into the get, to HTTPS gibberish<p class="article - content rp"> CodePudding user response: </p>What teaching video teaching writing web applications in the socket.<p class="article - content rp"> CodePudding user response: </p>The <fieldset> <legend> reference 3 floor response: don't drink coffee love drinking tea </legend> <blockquote> teaching video to teach you writing web applications in the socket? </blockquote> <fieldset> b wars that Java teaching video, if is the highest amount of play<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 4 floor qq_35989854 response: <legend> <blockquote> <fieldset> <legend> Quote: don't drink coffee love tea reference 3 floor response: <legend> <blockquote> what teaching video teaching writing web applications in the socket. </blockquote> <fieldset> b wars that Java teaching video, if is the highest amount of play </blockquote> <fieldset> <br/>If is a novice, I suggest you to change the basic video to see a little, or, I know big team did more than 5 years completely don't understand you write this, under normal circumstances, of course, also don't have to<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> refer to the second floor qq_35989854 response: <legend> <blockquote> <fieldset> <legend> Quote: reference 1/f, don't drink coffee love tea response: <legend> <blockquote> serversocket use TCP protocol, page sends the HTTP protocol, certainly not receive, <br/>If you want to use the page request will first have to do is to learn to write a servlet JavaEE </blockquote> <fieldset> how to write? I just according to the teaching video, HTTP access to post directly display the post by the teacher, then own HTTP access to post directly into the get, to HTTPS is stil </blockquote> <fieldset> <br/><br/>This should be the socket was used to simulate the HTTP server accepts HTTP requests, HTTPS is certainly not s is encryption mode, you will only get garbled <br/><br/><br/><p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> refer to 6th floor qq_39936465 response: <legend> <blockquote> <fieldset> <legend> Quote: refer to the second floor qq_35989854 response: <legend> <blockquote> <fieldset> <legend> Quote: reference 1/f, don't drink coffee love tea response: <legend> <blockquote> serversocket use TCP protocol, page sends the HTTP protocol, certainly not receive, <br/>If you want to use the page request will first have to do is to learn to write a servlet JavaEE </blockquote> <fieldset> how to write? I just according to the teaching video, HTTP access to post directly display the post by the teacher, then own HTTP access to post directly into the get, to HTTPS is stil </blockquote> <fieldset> <br/><br/>This should be the socket was used to simulate the HTTP server accepts HTTP requests, HTTPS is certainly not s is encryption mode, you will only get garbled <br/><br/><br/></blockquote> <fieldset> but I according to the knock in the video ah, the teacher using HTTP post no problem, I have this problem, became the get and head<p class="article - content rp"> CodePudding user response: </p>Is I type wrong,,,,,,, <img SRC="https://img.codepudding.com/202009/72897151805231.gif" Alt=""/>... Method="post" into a mathod="post"<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> refer to the eighth floor qq_35989854 response: <legend> <blockquote> knock is my wrong,,,,,,, <img SRC="https://img.codepudding.com/202009/72897151805231.gif" Alt=""/>... Method="post" as the mathod="post" </blockquote> <fieldset> <br/><br/>No programming tools, want to take an examination of choice. The <img SRC="https://img.codepudding.com/202009/72897151805232.gif" Alt=""/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/406.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/406.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/405.html'>Web project create login servlet, using the correct password and account cannot log in, ask the grea</a></div> <div class="detail-arr-right">Next:<a href='/Backend/407.html'>How about test jobs</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Java+related' target='_blank'>Java related</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>