zoukankan      html  css  js  c++  java
  • get方式和post方式的区别

        1.请求的URL地址不同:
                post:"http://192.168.13.83:8080/itheima74/servlet/LoginServlet"
                get:http://192.168.13.83:8080/itheima74/servlet/LoginServlet?username=root&pwd=123

            2.请求头不同:
                post方式多了几个请求头:Content-Length   Cache-Control  Origin

                openConnection.setRequestProperty("Content-Length", body.length()+"");
                openConnection.setRequestProperty("Cache-Control", "max-age=0");
                openConnection.setRequestProperty("Origin", "http://192.168.13.83:8080");

                 post方式还多了请求的内容:username=root&pwd=123

                 //设置UrlConnection可以写请求的内容
                openConnection.setDoOutput(true);
                //获取一个outputstream,并将内容写入该流
                openConnection.getOutputStream().write(body.getBytes());

             3.请求时携带的内容大小不同
                get:1k 
                post:理论无限制

  • 相关阅读:
    原子核壳模型程序 BigStick 的用法
    c++ 中的下三角阵矩阵元标记
    BCS方程和Bogoliubov变换
    圆膜振动问题
    核结构单体跃迁算符
    python画球谐函数
    gnuplot 绘制球谐函数图
    shell 脚本小知识集锦
    6.12学习总结
    PHP网上商城
  • 原文地址:https://www.cnblogs.com/xufengyuan/p/5807193.html
Copyright © 2011-2022 走看看