zoukankan      html  css  js  c++  java
  • 读书笔记Review: HTTP and HttpServletRequest

    1. The HttpServlet's doGet() and doPost() methods take an HttpServletRequest and an HttpServletResponse.
    2. The service() method determines whether doGet() or doPost() runs base on the HTTP Method(GET,POST,etc.) of the HTTP request.
    3. POST requests have a body;GET requests do not,althogh GET requests can have request parameters appended to the request URL(sometimes called "the query string").
    4. GET requests inherently(according to the HTTP spec) idempotent.They should be able to run multipe times without causing any side effects on the server.GET requests shouldn't chanage anything on the server.But you could write a bad,no-idempotent doGet() method.
    5. POST is inherently not idempotent,so it's up to you to design and code your app in such a way that if the client sends a request twice by mistake,you can handle it.
    6. If an HTML from does not explicitly say "method=POST",the request is sent as a GET,not a POST.If you do not have doGet() in your servlet,the request will fail.
    7. You can get parameters from the request with the getParameter('paramname") method.The return value is always a String.
    8. You can get other things from the request object including headers,cookies,a session,the query string,and an input stream.
  • 相关阅读:
    java如何编写多线程
    Java调用dll动态库
    HashMap源码解析
    LinkedList源码解析
    ArrayList源码解析
    springboot配置cxf
    java生成二维码
    原生js--跨域消息传递
    原生js--应用程序存储和离线web应用
    原生js--userData
  • 原文地址:https://www.cnblogs.com/yql1986/p/2001379.html
Copyright © 2011-2022 走看看