Mega Code Archive

 
Categories / Delphi / Ide Indy
 

Delphi + WAP = CGI Expert

Title: Delphi + WAP = CGI Expert Question: Building WAP applications with Delphi Answer: Building WAP applications with Delphi have never been easier since CGI Expert 5.5 was released. TWapSupport =========== The component suite now includes a new component, "TWapSupport", that will make your web applications written for HTML browsers, accessible from a WAP browser. This is possible since the component includes a built in HTML to WML converter. Simply drop the TWapSupport component on the same form or datamodule as the THttpEngine descedent component (TGeneralHttpEngine, TCGIStdEngine, etc) and your application can be accessed by a WAP browser. Using HTML instead of WML (Markup Language for WAP brosers) will bring you the following advantages: - You don't need to learn a new markup language. - Future versions of WAP are considering to drop WML for a XHTML ! - HTML is a forgiving language, while a single error in a WML page will spoil the whole content. This is what you do to build a simple WAP enabled WEB application using the new TWapSupport component: 1) Drop a "THttpEngine" and a TWapSupport component on a form or datamodule. 2) Enter the following code in the event procedure of "THttpEngine": procedure TForm1.GeneralHttpEngine1ExecRequest(Sender: TObject); begin PutLine('Mini'); PutLine('Hello WAP and WEB !'); PutLine(''); end; 3) Your CGI or ISAPI application can now be called (via a webserver) from any web or wap browser !!! TWapSupport - Customizing clients ================================= Since mobile devices have a wide range of resolutions and capabilities and since highly graphical and complicated HTML pages are nearly impossible to convert to small mobile devices, there is a need to customize the content from a web page based on what device it was requested by. The WapConverter will give you a wide range of possibilities to tune this: 1) You will be able to group devices into "device group", each having a customised profile based on the resolution and capabilities. 2) You will be able to setup a profile for each single device. 3) Mobile Converter can run in two modes: "All text is by default visible in WAP devices" or "No text is by default visible in WAP devices" You use the following tags to customize the HTML code depending on what device it was requested by: a) Specify what device group(s) or device(s) the content of the tag shall be sent to: Parameters: device - The device group(s) or device(s) for which the content of this tag will be visible. b) Specify what device group(s) or device(s) the content of the tag shall not be sent to. Parameters: device - The device group(s) or device(s) for which the content of this tag will not be visible. Device groups and clients are setup in the file WapLibrary.cfg WapLibrary.cfg. HTML example: Text Exclude This text is only visible in HTML browsers. This text is visible in all browsers. ... Excluded text ... ; inside your html code, will exclude text from all WAP devices. WAP Limitations =============== The following must be considered when building your WAP-applications: 1) Most WAP-clients will only accept 1400 BYTES !! This mean that: a) The byte coded WML page must not be larger than 1400 bytes (Rough estimation: Consider each tag name as 1 byte and each character as 1 byte) b) Images must not be larger than 1400 bytes. 2) WBMP images are the only mandatory image format supported by a WAP browser, meaning that gif images is not supported by all browsers ! 3) WML is a more limited language than HTML, thus only a subset of HTML tags is supported by the HTML to WML converter. 4) Nested table tags are not allowed, due to limitations in the WAP specifications !!! 5) Sometimes it seems like WAP-browsers will cache everything, so you have to do test all possible tricks to avoid the cache ;-)