|
- <%
- Class GreetController
- Private m_App
- Private m_Name
- Private m_Id
-
- Public Sub Init(ByRef app, ByRef routeParams)
- Set m_App = app
-
- ' IsObject(Nothing) is True in VBScript, so it can't detect "no object"
- ' on its own - it must be paired with an explicit "Is Nothing" check.
- If Not (routeParams Is Nothing) Then
- If routeParams.Exists("name") Then
- m_Name = Trim(CStr(routeParams.Item("name")))
- End If
- If routeParams.Exists("id") Then
- m_Id = Trim(CStr(routeParams.Item("id")))
- End If
- End If
-
- If Len(m_Name) = 0 Then
- m_Name = "there"
- End If
- End Sub
-
- Public Sub Execute()
- ' Nothing further to prepare - the name/id are already resolved in Init.
- End Sub
-
- Public Property Get App()
- Set App = m_App
- End Property
-
- Public Property Get Name()
- Name = m_Name
- End Property
-
- Public Property Get Id()
- Id = m_Id
- End Property
-
- ' True only when the route matched /greet/{name}/{id} - the shorter
- ' /greet/{name} pattern never captures an "id".
- Public Property Get HasId()
- HasId = (Len(m_Id) > 0)
- End Property
- End Class
- %>
|