|
- <?xml version="1.0"?>
- <?component error="true" debug="false"?>
- <component>
- <registration
- description="WscMvc Application bootstrap"
- progid="WscMvc.Application"
- version="1.00"
- classid="{851C7763-1638-42FE-A166-BF3DD3A96A88}">
- </registration>
-
- <public>
- <method name="Run">
- <parameter name="pathInfo"/>
- <parameter name="statusLine"/>
- <parameter name="contentType"/>
- <parameter name="body"/>
- </method>
- </public>
-
- <script language="VBScript">
- <![CDATA[
- Option Explicit
-
- ' Primitive-only contract: scalars in, scalars out by reference.
- ' No ASP intrinsic objects (Request/Response/Server/Session) are referenced here.
- Sub Run(pathInfo, statusLine, contentType, body)
- Dim ctrl, helloBody
-
- If pathInfo = "/hello" Then
- Set ctrl = Nothing
- On Error Resume Next
- Set ctrl = CreateObject("WscMvc.HomeController")
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- statusLine = "500 Internal Server Error"
- contentType = "text/plain; charset=utf-8"
- body = "Internal Server Error"
- Exit Sub
- End If
- On Error Goto 0
-
- helloBody = ""
- On Error Resume Next
- ctrl.Hello helloBody
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- statusLine = "500 Internal Server Error"
- contentType = "text/plain; charset=utf-8"
- body = "Internal Server Error"
- Set ctrl = Nothing
- Exit Sub
- End If
- On Error Goto 0
-
- statusLine = "200 OK"
- contentType = "text/html; charset=utf-8"
- body = helloBody
- Set ctrl = Nothing
- Else
- statusLine = "404 Not Found"
- contentType = "text/plain; charset=utf-8"
- body = "Not Found"
- End If
- End Sub
- ]]>
- </script>
- </component>
|