Разработка Internet-приложений: Учебно-методическое пособие

  • Published on
    13-Dec-2016

  • View
    218

  • Download
    5

Embed Size (px)

Transcript

<ul><li><p> Internet- </p><p>- 010200 </p><p> , 2003 </p></li><li><p> 2 </p><p> - __ ________ 2003 . </p><p> : .. . . , . 4 / . </p></li><li><p> 3 </p><p> , - [6-7], - Internet. , HTML. HTTP - CGI, Internet- Delphi. </p><p> 1. 3 1.1. 3 1.2. TCP/IP 6 1.3. 8 1.4. HTTP 8 1.5. Web- 10 2. Internet 11 2.1. 11 2.2. Internet- Delphi 14 26 26 1. HTML 26 2. TWebRequest 29 </p><p>1. </p><p>1.1. </p><p> , - . . ( - , , , - . . ..) . , . </p><p> . - . - - , . . , - , , . - , , . </p><p> - , , </p></li><li><p> 4 </p><p> . , , , Web- Web- HTTP (. . 1.4). </p><p> OSI (Open System Interconnection, ). - , , TCP/IP, OSI (. .). </p><p> OSI TCP/IP </p><p> WWW, FTP, Telnet, </p><p>SMTP, </p><p> TCP </p><p> IP </p><p> Ethernet </p><p> , . </p><p> OSI TCP/IP. </p><p> - . , , - .. 100Base-T, ( - 5), (RJ-45) - , 100 /. </p><p> ( , .). MAC- . Ethernet. - (Hub) (Switch), . . ( ) . , , ( ), Ethernet-. , , MAC- . - , .. . , , , . - , . </p></li><li><p> 5 </p><p> . - . MAC- , , . </p><p> , - , . - - . Internet - (Router). , - , IP- (. .1.2). , , - . - , . - IP-. </p><p> . - , - . , - , , - ( ) -. - -, . IP, TCP - , , ; - TCP- . TCP IP. , , . TCP/IP . IP- - ; (socket). - ( ) , , , - (WWW, FTP .). - . , 21 FTP , 80 WWW- , 23 telnet. </p></li><li><p> 6 </p><p> - . - , - . - SSL [4] . </p><p> . - . </p><p> . , - (, Web-), TCP, TCP-. IP-, TCP- . - , Ethernet- - ( Ethernet- ). </p><p>. ( Ethernet), Ethernet- -. </p><p> - . IP Ethernet-. TCP IP-, , , IP . - Web (), HTML- - . </p><p>1.2. TCP/IP </p><p>Internet , - TCP/IP. TCP/IP : - , IP- . (MAC-, 6 ) - , . , . - . </p><p>IP- , - . - . , IP- , ( ), </p><p>Ethernet- </p><p>IP- TCP- </p></li><li><p> 7 </p><p> . - . </p><p> IP- . - TCP/IP - (. , , - Windows). </p><p> , IP- - DHCP- [4]. IP- - , Internet, . </p><p>IP- 32- , - , , 192.168.18.5. IP- . , (), , . , IP- , , - IP- 32- . 1, IP- , . , IP- 192.168.18.5, 255.255.255.0, - 0.0.0.5 - 192.168.18.0 11000000 10101000 00010010 000000002. </p></li><li><p> 8 </p><p> IP-. </p><p> IP- , , - . ( ): ( ), - (, ), ( ) . . , - (RU, UK, US, ), (COM, ORG, NET, GOV) - . , web- www.main.vsu.ru. </p><p> TCP/IP IP- - DNS (Domain Name System) . IP- , Ethernet ARP- (Address Resolution Protocol, ARP), . 1.3. URL (Universal Resource Locator) :// _ [: ]/ / _ _ , - , . Web Http. _ IP- , Internet, , - TCP- , , , _ _ . </p><p> URL http:// _ [: ]/ / _ / ? , http://localhost/scripts/pog1.exe/p?name=Bill 1.4. HTTP </p><p>HTTP (Hyper Text Transpher Protocol, ) - , World Wide Web. [3] . </p><p> Web- : TCP- </p><p>http://www.main.vsu.ruhttp://localhost/scripts/pog1.exe/p?name=Bill</p></li><li><p> 9 </p><p> ( ) ( ) TCP- </p><p> : </p><p> : _ URL_ _HTTP </p><p> _ URL. GET, POST, HEAD, PUT . GET POST. , , , . GET (), (HTML-, .) . URL CGI- , GET, -, ( ) URL. POST , - URL, . URL_ - . . 1.3. _HTTP HTTP/ . , HTTP/1.1. </p><p> , , E-mail (. ). _ : , From: pmmtkiar@main.vsu.ru . </p><p> . </p><p> : </p><p> : _ _ , . - - , . . , , - HTTP/1.0 400 Bad Request. , 1..5, : </p><p>mailto:pmmtkiar@main.vsu.ru</p></li><li><p> 10 </p><p> 1 , - </p><p> 2 3 , -</p><p> 4 5 </p><p> , . , , , , MIME- , .[3] MIME (Multipurpose Internet Mail Extension - ) , WWW. : / . : text/html, image/gif, image/jpeg, audio/midi, audio/x-wav video/avi, video/mpeg, application/msword .. </p><p>1.5. Web- </p><p>Web- , , - Internet- . () Web- HTTP. Web- 80. , ( ) - . </p><p>Web- , , , Internet- (CGI, ASP, ISAPI .). Windows NT/2000 XP Internet Information Services (IIS). Personal Web Server (PWS) Windows 95/98. Apache, Unix, Windows. HTML- FrontPage - , . </p><p> Web-? , Internet, (. - -/ ), IP- - , , http://c1r214n09 http://196.168.18.9. c1r214n09 196.168.18.9. - Internet, IP-, Internet . </p><p>http://196.168.18.9</p></li><li><p> 11 </p><p> , ( -) , - http://lo alhost http://127.0.0.1. </p><p> -. IIS ( PWS) D:\Inetpub\wwwroot. - default.html ( IIS) in-dex.html ( Apache) . , . </p><p> HTML - URL-, , - , - DOS. . , , d:\inetpub\wwwroot\page.htm. </p><p> , index.htm page2.htm, - , , page3.htm SUBCAT - . </p><p> D:\inetpub\scripts\prog.exe D:\inetpub\WWWroot\Index.htm Index.htm . 2. Internet 2.1. Web-, - , : , - , , -. Java- , - JDBC [3]. ASP PHP, , HTML- . - , , , - - [7]. </p><p>http://127.0.0.1http://localhost/scripts/prog.exe</p></li><li><p> 12 </p><p> CGI- , - . , CGI - Perl. CGI (Common Gateway Interface) Web- . , CGI- , - , . Web- , . Web- (. .) - , ( GET) - ( POST). ( - HTML- , ) - . - Http . : 1=1&amp; 2=2 , HTML FORM, . , FORM, URL ( GET) Http- (- POST). QUERY_STRING, . - . . ( write) a) , ) , ) HTML- . - content-type: text/html, MIME- . , CGI - (, Fortran, Pascal). CGI - . - . , Name="Bill", "Hello, Bill!'. </p><p> Web- </p><p> CGI- </p><p> - </p><p> SQL </p><p>. , </p><p>. </p><p>Internet </p><p> HTTP </p></li><li><p> 13 use portlib ! . character*40 s,rmStr,sName, srvName integer i call GETENV ("request_method",rmStr) ! request_method if (rmStr.eq."POST") then ! POST read (*,*) s ! else if (rmStr.eq."GET") then ! GET CALL GETENV ("query_string",s) ! query_string end if i=scan(s,'name=')+4 ! name= sName= s(i:len(s)) ! if (sName(1:1).eq.'%') then ! .. URL- ! % call TransCode (Sname,s) ! ! sname=s end if sName='Hello, ' //sname(1:len_trim(sname)) // '!' ! write(*,*) 'content-type: text/html' ! write(*,*) ! write(*,*) sname ! ! write (*,*) ' : ' write(*,*) '' end subroutine TransCode (sName,sRes) ! implicit none character*40 sRes, sName ! - sName, - sRes character*2 s2 integer x,i,k,l i=1 k=1 sres='' ! ( Fortran' ) l=len(sName) ! do i=1,l,3 ! if (sName(i:i)=='%') then ! % s2=sName((i+1):(i+2)) read (s2,'(z3)') x ! sres(k:k)=char(x) ! k=k+1 end if end do end fp.exe d:\inetpub\scripts, pic.jpg d:\inetpub\wwwroot\images http://localhost/scripts/fp.exe?name=Bill </p><p>http://localhost/scripts/fp.exe?name=Bill</p></li><li><p> 14 </p><p> Compaq Visual Fortran 6.5. , - . </p><p>2.2. Internet- Delphi </p><p> - . Delphi , Internet - . Delphi, Internet- , , , Perl, PHP, ASP, , , - . </p><p> - , Delphi - Borland Interbase, Oracle . ( c BDE- [2,6], - , API [7].) , PHP MySQL, , , - . ASP ASP.NET - Microsoft (MS Access MS SQL Server). </p><p> - , Delphi Kylix Unix, Borland, Unix Internet. </p><p> - , Internet- Delphi - Internet, - Java Microsoft .Net. </p><p> Delphi , - . </p><p> Web-, - IIS, Personal Web Server, FrontPage Server. , HTML- FrontPage 98 FrontPage 2000. </p><p>1) InterBase, Specification : CREATE TABLE SPECIFICATION ( NUM INTEGER NOT NULL PRIMARY KEY, BRAND CHAR(10), </p></li><li><p> 15 </p><p> MODEL CHAR(20), PRICE INTEGER, $ DIAG INTEGER, , TUBE_TYPE CHAR(15), MAX_RESOLUTION CHAR(12), REFFRESH_RATE INTEGER, . , SECURITY CHAR(6), URL CHAR(20), - COMMENT BLOB SUB_TYPE 1 SEGMENT SIZE 80, PHOTO BLOB SUB_TYPE 2 SEGMENT SIZE 80 ) Monitors. </p><p>2) File-New/Web Server Application. - </p><p> CGI Stand-alone executable. ? CGI- ( - ) . ISAPI- , , API CGI. - , ISAPI , . - CGI, . </p><p> Web- ( Data- ), , . . </p></li><li><p> 16 </p><p> ppHeader, ppFooter: TPageProducer HTML- . function Content: String. -. dstMon: TDataSetTableProducer HTML- , (TTable TQuery), . - . , . ( ) - Footer Header: Tstrings. dspDetail: TdataSetPageProducer TPageProducer, , . , Num . , - OnHTMLTag. - . content: String Response: TResponse, function content: string </p></li><li><p> 17 </p><p>, , Response.Content:=DstMon.Content. 3) . TdataBaseName: Name DataBase1 AliasName Monitors DataBaseName Db1 LoginPromt False : Params . TTable: Name TbMon DataBaseName Db1 TableName Specification : - : , . . TPageProducer: Name PpHeader HtmlDoc </p><p> TPageProducer: Name PpFooter HtmlDoc () Designed by Vasya Pupkin </p><p> TQuery </p><p>: , BRAND, MODEL, DIAG, COMMENT, PHOTO, ( , ..) DisplayLabel. TdataSetTableProducer: Name DstMon DataSet TbMon </p><p> TdataSetTableProducer Response Edi-tor: </p><p>Name QrDetail DataBaseName Db1 SQL SELECT * FROM specification WHERE Num=:Num Params[0].value 0 Params[0].type Integer </p></li><li><p> 18 </p><p> Add All Fields ( ), - . . , . - , PHOTO COMMENT ( , Delete). - qrDetail dspDetail. ( - 1) , - . Web- 8. OnFormatCell ( CellData): procedure TWebModule1.DstMonFormatCell(Sender: TObject; CellRow, CellColumn: Integer; var BgColor: THTMLBgColor; var Align: THTMLAlign; var VAlign: THTMLVAlign; var CustomAttrs, CellData: String); begin if (CellRow&gt;0) and (CellColumn=8) then CellData:= ''+CellData+''; if (CellRow&gt;0) and (CellColumn=1) then CellData:=''+CellData+''; end; 1. : - , /info Num, - . </p></li><li><p> 19 </p><p>TdataSetPageProducer: Name DspDetail Dataset QrDetail </p><p>HTMLDoc -: : (): </p><p> - , - - HTMLDoc. . - . . Memo- . . procedure TWebModule1.dspDetailHTMLTag(Sender: TObject; Tag: TTag; const TagString: String; TagParams: TStrings; var ReplaceText: String); begin // TagString , // ReplaceText , with qrDetail do begin if TagString='Comment' then ReplaceText:=FieldByName('Comment').asString; if TagString='Photo' then // ReplaceText:= ''; end; end; 4) . PathInfo ( ), . </p></li><li><p> 20 </p><p> Web- - Action Editor. , Add New ( ). - , . </p><p> (Actions) Web- property Actions: TWebA...</p></li></ul>

Recommended

View more >