You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2KB

  1. <%
  2. Class Dispatcher
  3. ' Given a Router.Match(...) result (or Nothing), resolves the controller
  4. ' key - falling back to "NotFound" when nothing matched, or when the
  5. ' matched key doesn't map to a known controller - then constructs, Inits,
  6. ' and Executes the corresponding controller. controllerKey and controller
  7. ' are ByRef outputs: Select Case controllerKey after calling this to pick
  8. ' the matching view (its filename must equal the resolved key).
  9. Public Sub Dispatch(ByRef app, ByRef routeMatch, ByRef controllerKey, ByRef controller)
  10. Dim routeParams
  11. If routeMatch Is Nothing Then
  12. controllerKey = "NotFound"
  13. Set routeParams = Nothing
  14. Else
  15. controllerKey = routeMatch.Item("ControllerName")
  16. Set routeParams = routeMatch.Item("Params")
  17. End If
  18. Select Case controllerKey
  19. Case "Home"
  20. Set controller = New HomeController
  21. Case "Greet"
  22. Set controller = New GreetController
  23. Case Else
  24. controllerKey = "NotFound"
  25. Set controller = New NotFoundController
  26. End Select
  27. controller.Init app, routeParams
  28. controller.Execute
  29. End Sub
  30. End Class
  31. %>

Powered by TurnKey Linux.