|
- <%@ Language="VBScript" %>
- <% Option Explicit %>
- <%
- Dim route, httpMethod, logDir, ctx, app, applicationName, statusLine, contentType, body, allowHeader
-
- route = Request.QueryString("route")
- httpMethod = Request.ServerVariables("REQUEST_METHOD")
- applicationName = "production"
- ' logs/ deliberately lives outside the served "public" webroot (IIS site
- ' physical path = public/), so a parent-relative MapPath is required here -
- ' requires enableParentPaths=true for this site. See docs/DECISIONS.md.
- logDir = Server.MapPath("../logs")
-
- Set ctx = Nothing
- On Error Resume Next
- Set ctx = Server.CreateObject("WscMvc.RequestContext")
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- Response.Status = "500 Internal Server Error"
- Response.ContentType = "text/plain; charset=utf-8"
- Response.Write "Internal Server Error"
- Response.End
- End If
- On Error Goto 0
-
- On Error Resume Next
- ctx.Initialize route, httpMethod, logDir
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- Set ctx = Nothing
- Response.Status = "500 Internal Server Error"
- Response.ContentType = "text/plain; charset=utf-8"
- Response.Write "Internal Server Error"
- Response.End
- End If
- On Error Goto 0
-
- Set app = Nothing
- On Error Resume Next
- Set app = Server.CreateObject("WscMvc.Application")
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- Set ctx = Nothing
- Response.Status = "500 Internal Server Error"
- Response.ContentType = "text/plain; charset=utf-8"
- Response.Write "Internal Server Error"
- Response.End
- End If
- On Error Goto 0
-
- statusLine = ""
- contentType = ""
- body = ""
- allowHeader = ""
-
- On Error Resume Next
- app.Run ctx, applicationName, statusLine, contentType, body, allowHeader
- If Err.Number <> 0 Then
- Err.Clear
- On Error Goto 0
- Set app = Nothing
- Set ctx = Nothing
- Response.Status = "500 Internal Server Error"
- Response.ContentType = "text/plain; charset=utf-8"
- Response.Write "Internal Server Error"
- Response.End
- End If
- On Error Goto 0
-
- Response.Status = statusLine
- Response.ContentType = contentType
- If Len(allowHeader) > 0 Then
- Response.AddHeader "Allow", allowHeader
- End If
- Response.Write body
-
- Set app = Nothing
- Set ctx = Nothing
- %>
|