260 likes | 1.4k Views
Session #2006 Presented by Jason Southwell Arcana Technologies. Web Application Development in IntraWeb. Who am I?. Delphi Developer since 1995 President of Arcana Consultant Freelance Author Member of A-Team, TeamZed Indy Core FreeCLX, CrossFPC. Who are You???. IntraWeb.
E N D
Session #2006 Presented by Jason Southwell Arcana Technologies Web Application Development in IntraWeb
Who am I? • Delphi Developer since 1995 • President of Arcana • Consultant • Freelance Author • Member of • A-Team, TeamZed • Indy Core • FreeCLX, CrossFPC
IntraWeb • Radically simple web development • Application Based Framework • Process Identical to VCL Development • Cross-platform / Cross-environment • Included in Delphi 7 (IW 5.1) and Delphi 2005 (IW 7.2) • No need for HTML / JS / CSS • But the knowledge will help you...
Component Usage • All non-visual thread-safe components • IntraWeb forms are a special type of form and require custom IW specific visual components • Most standard VCL visual components have IW replacements • Powerful 3rd Party IW Components • TMS - www.tmssoftware.com • Arcana - www.arcanatech.com
Structure of a Project • DPR • Varies depending on whether you are building a Service, Standalone, ISAPI or DSO • ServerController • Global server settings • UserSession • Session based data module • Unit1 • Your first visual IW form
Deployment • ISAPI • IIS, Omni, Apache, others • Standalone • Custom Indy based web server • Service • Custom Indy based web server • DSO • Apache (not supported in D2005/2006)
Deployment Requirements • Standalone / Service • Upload exe and execute (or install service). • ISAPI • Upload to scripts folder on web server or configure script application on IIS • DSO • Upload to web server & edit Apache config file May require additional files: • Images • Flash Animation, Movies • StyleSheets/Script • The “Files” & “Cache” subdirectories
Layout Options • Delphi Form Designer • Most like VCL development • Anchors & Alignment • Compatible with Delphi Frames • Form Inheritance • Regions (panels) • Visual changes require recompile
Layout Options • Runtime HTML Templates • Requires HTML/JS/CSS knowledge • Design HTML files and “embed” IW controls • HTML files with {% %} tags • Visual changes do not require recompile • Hand off visual design to web designers. • Design-time HTML Designer • Design-time Template editor • Embeds Templates in dfm file • Visual changes require recompile
Database Connectivity • Nearly any Database components • ADO • dbExpress • IBX / IBO / FreeIB • Zeos • DBISAM / NexusDB • BDE (but not recommended) • UserSession based DataModule
Design Considerations • No Global Variables • Thread-safety • Report Delivery • Resource Management • Custom Components • Missing Events
Maximizing Scalability • Reduce Page Response Time • Decrease Memory Footprint • Release forms when not in use • Don't overuse UserSession for storage • Improve Code Efficiency • http://arcanatech.com/optimalcode.html • Use a replacement Memory Manager • NexusDB Memory Manager 3 • FastMM4 (free)
Maximizing Scalability • Beware Synchronization Objects • Reduce Bandwidth Requirements • Partial Updates • Increase Server Specs • Memory/CPU/Bandwidth • Add Additional Server Machines • Software Switch – Octagate • Hardware Switch – Layer 5-7 • DNS Round Robin
Database Pooling • Built-in pooling support • DataModule Based Pool • Positives • Improves Responsiveness • Reduces Memory Usage • Improves Scalability • Simplifies DB access from Threads & ServerController • Negatives • Makes Working with data-aware components more difficult, though not impossible.
Reducing Session Count • Termination • User must initiate termination • Or wait for session timeout • Re-entry • Limits duplicate sessions • Returns user to last viewed form & state • Single Instance Sessions • Limits duplicate sessions • Limits user's multi-tasking capabilities
Page Based Modes • Page Mode • Based on WebBroker • Can Integrate WebSnap / WebServices • No Session/State Management • Series of “disconnected” pages • Like a compiled ASP, PHP or ASP.NET • PageMode included with D7 / D2005 Pro • IWP Mode • Page Mode with static page delivery. • Static Page
Render Modes • 3.2 Mode • Works in all HTML browsers • Does not require Javascript • Requires use of Templates • WAP Mode • Renders to WML • Works in cellphone browsers • Can use WML Templates, but not required
JavaScript Integration • Javascript Resources • www.dynamicdrive.com • www.javascriptcity.com • www.codelifter.com • IWTop() • FindElem() • SubmitClick(), SubmitClickConfirm()
User Authentication • HTTP Authentication • Web Standard • Plain Text Passwords • Simple to Implement • Custom Login Forms • More Flexible • Plain Text Passwords • Have Secured and Unsecured Pages • Variable Session Timeouts
Secure Applications • HTTPS • Authenticates Server • Encrypts Web Traffic • Cert.pem & Key.pem • Indy Specific OpenSSL Libraries • SSL Certificates • Verisign / GEOTrust / RapidSSL • Self-signed Certs • SSL Buddy
Custom Components • Base Objects • TComponent – Non-visual • TIWControl – Visual • Interfaces • IIWBaseComponent, IIWBaseControl, IIWBaseContainer • IIWInputControl, IIWSubmitControl • IIWTabOrder • IIWSubmitInvisible • IIWUpdateNotified
Custom Components • Important Method Overrides • InitControl() • SupportsInput() • RenderHTML() • Submit() • SetValue() • IWPaint() • Important Helper Objects • RenderContext, PageContext • TIWHTMLTag
Custom Components • Default Paint Handlers • File Upload, RadioButton, RadioGroup • Rectangle, Label, Button, Edit • Checkbox, ComboBox, ListBox • Memo, Link, Text, Image, HRule • List, DBNavigator, ProgressBar, Region • TabControl, TabPage