zoukankan      html  css  js  c++  java
  • Netty中的HttpObjectAggregator

    Http的Get,POST

    Get请求包括两个部分:

    • request line(包括method,request uri,protocol version))
    • header

    基本样式:

    GET /?name=XXG&age=23 HTTP/1.1       -----> request line
    ------------------------------------------------------------------
    Host: 127.0.0.1:8007
    Connection: keep-alive              
    Cache-Control: max-age=0             -----> header
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    Accept-Encoding: gzip, deflate, br
    Accept-Language: zh-CN,zh;q=0.9
    

    POST请求包括三个部分

    • request line(包括method,request uri,protocol version))
    • header
    • message body

    基本样式

    GET / HTTP/1.1                       -----> request line
    ------------------------------------------------------------------
    Host: 127.0.0.1:8007
    Connection: keep-alive  
    Content-Length: 15            
    Cache-Control: max-age=0             -----> header
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    Accept-Encoding: gzip, deflate, br
    Accept-Language: zh-CN,zh;q=0.9
    ------------------------------------------------------------------
    name=XXG&age=23                     ------>message body
    

    HttpObjectAggregator

    从上可以看出,当我们用POST方式请求服务器的时候,对应的参数信息是保存在message body中的,如果只是单纯的用HttpServerCodec是无法完全的解析Http POST请求的,因为HttpServerCodec只能获取uri中参数,所以需要加上HttpObjectAggregator.

  • 相关阅读:
    AWVS 安全渗透扫描
    Nmon 监控结果分析
    Jmeter 插件图表分析
    Nmon 安装
    子母钟系统(卫星时钟系统)在医院网络中的架设与设计
    从NTP网络授时到社交GPS千奇百怪的应用方式
    NTP网络时钟系统技术参数与详细介绍
    GPS北斗子母钟系统在某机场系统中的应用
    GPS北斗时间频率信号源的定义及简介
    ntp对时服务器同步网络中计算机详细配置
  • 原文地址:https://www.cnblogs.com/bihanghang/p/10218738.html
Copyright © 2011-2022 走看看