unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPServer,
IdCustomHTTPServer, IdHTTPServer; type
TForm1 = class(TForm)
btn1: TButton;
IdHTTPServer1: TIdHTTPServer;
mmo1: TMemo;
procedure btn1Click(Sender: TObject);
procedure IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject);
begin
try
IdHTTPServer1.Bindings.Clear;
//要绑定的端口,一定设置此项,这是真正要绑定的端口;
IdHTTPServer1.DefaultPort:=;
IdHTTPServer1.Bindings.Add.IP := '192.168.1.100';
//启动服务器
IdHTTPServer1.Active := True;
mmo1.Lines.Add('启动');
except
showmessage('启动失败!');
end; end; procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin mmo1.Lines.Add(ARequestInfo.Document);
// mmo1.Lines.Add(ARequestInfo.QueryParams);
// mmo1.Lines.Add(ARequestInfo.Params.Values['Par1'] );
// mmo1.Lines.Add(ARequestInfo.Params.Values['Par2'] );
// mmo1.Lines.Add(ARequestInfo.Command); //mmo1.Lines.Add(ARequestInfo.u); AResponseInfo.ContentType :='text/json';
AResponseInfo.ContentText:='a:1,b:2'; { AResponseInfo.ContentEncoding:='utf-8';
AResponseInfo.ContentType :='text/html';
AResponseInfo.ContentText:='<html><body>好</body></html>'; } // AResponseInfo.ContentEncoding:='utf-8';
// AResponseInfo.ContentType :='text/html';
// AResponseInfo.ContentText:='<html><body>好</body></html>'; //发html文件
{AResponseInfo.ContentEncoding:='utf-8';
AResponseInfo.ContentType :='text/html';
AResponseInfo.ContentText:='<html><body>好</body></html>'; }
//发xml文件
{AResponseInfo.ContentType :='text/xml';
AResponseInfo.ContentText:='<?xml version="1.0" encoding="utf-8"?>'
+'<students>'
+'<student sex = "male"><name>'+AnsiToUtf8('陈')+'</name><age>14</age></student>'
+'<student sex = "female"><name>bb</name><age>16</age></student>'
+'</students>';} end; end.

idHttpServer接收类型的更多相关文章

  1. Java定义接口变量为接收类型有什么好处(面向接口编程)

    个人理解:定义接口变量为接收类型属于面向接口的编程,通过接口的抽象能减少类之间的耦合,增加可复用性. 面向接口编程: 一种规范约束 制定者(或者叫协调者),实现者(或者叫生产者),调用者(或者叫消费者 ...

  2. XCode请求数据中接收类型的后台与前台处理(本机模拟)

      Xcode报错问题如下:   解决办法如下: 0x1 ->请求数据时加上缺少的类型 AFHTTPSessionManager *manager = [selfAFHTTPSessionMan ...

  3. Delphi idHttpServer接收Http Get请求解码问题

    引用 Httpapp单元,使用Httpdecode函数进行解码 procedure TFrmMain.HTTPServerCommandGet(AThread: TIdPeerThread; AReq ...

  4. 使用MyBatis时接收值和返回值选择Map类型或者实体类型

    MyBatis作为现近JavaEE企业级项目开发中常用的持久层框架之一,以其简洁高效的ORM映射和高度的SQL的自由性被广大开发人员认可.Mybatis在接收系统传来的参数和返回的参数时主要可以有Ma ...

  5. springmvc接收参数为日期类型

    用单个Date类型接收日期类型时,会出现报错,加上initBinder的方法 意思是将所有传入的参数都通过此方法,如果过是日期通过日期格式化器进行格式化 如果是接收类型为对象内的属性为Date类型时 ...

  6. Android中实现APP文本内容的分享发送与接收方法简述

    谨记(指定选择器Intent.createChooser()) 开始今天的内容前,先闲聊一下: (1)突然有一天头脑风暴,对很多问题有了新的看法和见解,迫不及待的想要分享给大家,文档已经写好了,我需要 ...

  7. 二:Go编程语言规范-类型

    1.类型 布尔值,数值与字符串类型的实例的命名是预声明的. 数组,结构,指针,函数,接口,切片,映射和信道这些复合类型可由类型字面构造. 每个类型 T 都有一个 基本类型:若 T 为预声明类型或类型字 ...

  8. .net core 1.1.0 MVC 控制器接收Json字串 (JObject对象) (二)

    .net core 1.1.0 MVC 控制器接收Json字串 (JObject对象) (二) .net core 1.1.0 MVC 控制器接收Json字串 (JObject对象) (一) 上一篇主 ...

  9. C#的类型、变量和值

    大学学了C#,工作也是使用C#,虽然在日常的开发中没什么大的问题,但个人觉得在C#的理解还不是很清晰,所以决定花一定的时间来理一理学过的知识,顺便革新下脑袋里的知识,因为坑爹的学校在教.net的时候, ...

随机推荐

  1. docker 后台运行和进入后台运行的容器

    先创建并进入一个新的被命名为newos的新容器    docker run -it --name newos docker.io/centos #创建并指定端口号映射 docker run -d -p ...

  2. 3种python调用其他脚本的方法,你还知道其他的方法吗?

    1.用python调用python脚本 #!/usr/local/bin/python3.7 import time import os count = 0 str = ('python b.py') ...

  3. js如何操作或是更改sass里的变量

    /*上网搜索了好多方法,最终只有这一种比较适合*/ 参考: https://blog.csdn.net/weixin_44392565/article/details/85755592 https:/ ...

  4. 用cat写入

    $ cat >> gzip_work.sh <<EOF > mkdir gzip/workshell > EOF

  5. jmeter --- 压测时,如何让串联压测多个接口

    1.新建测试计划,在测试计划里勾选“独立运行每个线程组” 2.分别在每个线程组,添加聚合报告,以得到每个线程组的压测结果 3.设置不同接口压测的vu等,并为每个线程组,设置合理的启动延迟时间

  6. HDU - 1114 Piggy-Bank(完全背包讲解)

    题意:背包重量为F-E,有N种硬币,价值为Pi,重量为Wi,硬币个数enough(无穷多个),问若要将背包完全塞满,最少需要多少钱,若塞不满输出“This is impossible.”. 分析:完全 ...

  7. java获取键盘事件

    转 <script type="text/javascript" language=JavaScript charset="UTF-8"> docu ...

  8. centos6.7搭建局域网ntp服务器

    修改/etc/ntp.conf文件 restrict xxx nomodify notrap nopeer noquery             #xxx 此处配置本地IP地址restrict 12 ...

  9. php添加openssl扩展

    很多时候都会用到openssl组件,下面就介绍一下linux下php安装openssl扩展: 安 装openssl组件,一般php安装目录中都有许多扩展组件的安装包,当然也包括openssl,例如我的 ...

  10. JDK1.8 HashMap学习

    1:源码分析 1.1:构造方法 public HashMap(int initialCapacity, float loadFactor) { ) throw new IllegalArgumentE ...