URLRouter_frMain.fmx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. object frMain: TfrMain
  2. Left = 0
  3. Top = 0
  4. Caption = 'HTTP router example'
  5. ClientHeight = 220
  6. ClientWidth = 360
  7. Position = DesktopCenter
  8. FormFactor.Width = 320
  9. FormFactor.Height = 480
  10. FormFactor.Devices = [Desktop]
  11. DesignerMasterStyle = 0
  12. object lbLink: TLabel
  13. Align = Top
  14. AutoSize = True
  15. Cursor = crHandPoint
  16. Enabled = False
  17. StyledSettings = [Family, Size]
  18. HitTest = True
  19. Margins.Left = 6.000000000000000000
  20. Margins.Top = 6.000000000000000000
  21. Margins.Right = 6.000000000000000000
  22. Margins.Bottom = 6.000000000000000000
  23. Position.X = 6.000000000000000000
  24. Position.Y = 69.000000000000000000
  25. Size.Width = 348.000000000000000000
  26. Size.Height = 16.000000000000000000
  27. Size.PlatformDefault = False
  28. TextSettings.Font.StyleExt = {04040000000000000004000000}
  29. TextSettings.FontColor = claBlue
  30. TextSettings.WordWrap = False
  31. Text = 'http://localhost'
  32. TabOrder = 1
  33. OnClick = lbLinkClick
  34. OnMouseEnter = lbLinkMouseEnter
  35. OnMouseLeave = lbLinkMouseLeave
  36. end
  37. object pnTop: TPanel
  38. Align = Top
  39. Margins.Left = 6.000000000000000000
  40. Margins.Top = 6.000000000000000000
  41. Margins.Right = 6.000000000000000000
  42. Margins.Bottom = 6.000000000000000000
  43. Position.X = 6.000000000000000000
  44. Position.Y = 6.000000000000000000
  45. Size.Width = 348.000000000000000000
  46. Size.Height = 51.000000000000000000
  47. Size.PlatformDefault = False
  48. TabOrder = 0
  49. object lbPort: TLabel
  50. Align = Left
  51. AutoSize = True
  52. StyledSettings = [Family, Size, FontColor]
  53. Margins.Top = 10.000000000000000000
  54. Margins.Right = 4.000000000000000000
  55. Margins.Bottom = 10.000000000000000000
  56. Position.Y = 10.000000000000000000
  57. Size.Width = 39.000000000000000000
  58. Size.Height = 31.000000000000000000
  59. Size.PlatformDefault = False
  60. TextSettings.Font.StyleExt = {00070000000000000004000000}
  61. TextSettings.HorzAlign = Trailing
  62. Text = '&Port:'
  63. TabOrder = 0
  64. end
  65. object edPort: TNumberBox
  66. Touch.InteractiveGestures = [LongTap, DoubleTap]
  67. Align = Left
  68. TabOrder = 1
  69. Cursor = crIBeam
  70. Max = 65535.000000000000000000
  71. TextSettings.HorzAlign = Trailing
  72. Position.X = 43.000000000000000000
  73. Position.Y = 14.000000000000000000
  74. Margins.Top = 14.000000000000000000
  75. Margins.Right = 10.000000000000000000
  76. Margins.Bottom = 14.000000000000000000
  77. Size.Width = 80.000000000000000000
  78. Size.Height = 23.000000000000000000
  79. Size.PlatformDefault = False
  80. OnChange = edPortChange
  81. OnChangeTracking = edPortChangeTracking
  82. end
  83. object btStart: TButton
  84. Action = acStart
  85. Align = Left
  86. Cursor = crHandPoint
  87. Enabled = True
  88. ImageIndex = -1
  89. Margins.Left = 10.000000000000000000
  90. Margins.Top = 10.000000000000000000
  91. Margins.Bottom = 10.000000000000000000
  92. Position.X = 143.000000000000000000
  93. Position.Y = 10.000000000000000000
  94. Size.Width = 80.000000000000000000
  95. Size.Height = 31.000000000000000000
  96. Size.PlatformDefault = False
  97. TabOrder = 2
  98. end
  99. object btStop: TButton
  100. Action = acStop
  101. Align = Left
  102. Cursor = crHandPoint
  103. Enabled = False
  104. ImageIndex = -1
  105. Margins.Left = 10.000000000000000000
  106. Margins.Top = 10.000000000000000000
  107. Margins.Right = 10.000000000000000000
  108. Margins.Bottom = 10.000000000000000000
  109. Position.X = 233.000000000000000000
  110. Position.Y = 10.000000000000000000
  111. Size.Width = 80.000000000000000000
  112. Size.Height = 31.000000000000000000
  113. Size.PlatformDefault = False
  114. TabOrder = 3
  115. end
  116. end
  117. object alMain: TActionList
  118. Left = 48
  119. Top = 120
  120. object acStart: TAction
  121. Category = 'HTTP server'
  122. Text = '&Start'
  123. ShortCut = 120
  124. OnExecute = acStartExecute
  125. end
  126. object acStop: TAction
  127. Category = 'HTTP server'
  128. Text = 'S&top'
  129. Enabled = False
  130. ShortCut = 121
  131. OnExecute = acStopExecute
  132. end
  133. end
  134. object BrookHTTPServer1: TBrookHTTPServer
  135. NoFavicon = True
  136. OnRequest = BrookHTTPServer1Request
  137. OnRequestError = BrookHTTPServer1RequestError
  138. OnStart = BrookHTTPServer1Start
  139. OnStop = BrookHTTPServer1Stop
  140. Left = 168
  141. Top = 120
  142. end
  143. object BrookURLRouter1: TBrookURLRouter
  144. Routes = <
  145. item
  146. Default = True
  147. Pattern = '/home'
  148. Methods = [rmGET]
  149. OnRequest = BrookURLRouter1Routes0Request
  150. end
  151. item
  152. Pattern = '/download/(?P<file>[a-z]+)'
  153. Methods = [rmGET]
  154. OnRequest = BrookURLRouter1Routes1Request
  155. end
  156. item
  157. Pattern = '/page/([0-9]+)'
  158. Methods = [rmGET]
  159. OnRequest = BrookURLRouter1Routes2Request
  160. end>
  161. OnNotFound = BrookURLRouter1NotFound
  162. Left = 288
  163. Top = 120
  164. end
  165. end