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.

83 line
2.3KB

  1. <%@ Language="VBScript" %>
  2. <% Option Explicit %>
  3. <%
  4. ' This test app owns its bootstrap and explicitly selects only the test route
  5. ' set in the shared framework. Production's bootstrap selects "production".
  6. ' Keeping this value inside each app prevents direct Default.asp?route=...
  7. ' requests from crossing the application boundary.
  8. Dim route, httpMethod, logDir, ctx, app, applicationName, statusLine, contentType, body
  9. route = Request.QueryString("route")
  10. httpMethod = Request.ServerVariables("REQUEST_METHOD")
  11. applicationName = "tests"
  12. ' logs/ deliberately lives outside the served "public" webroot (IIS site
  13. ' physical path = public/), so a parent-relative MapPath is required here -
  14. ' requires enableParentPaths=true for this site. See docs/DECISIONS.md.
  15. logDir = Server.MapPath("../logs")
  16. Set ctx = Nothing
  17. On Error Resume Next
  18. Set ctx = Server.CreateObject("WscMvc.RequestContext")
  19. If Err.Number <> 0 Then
  20. Err.Clear
  21. On Error Goto 0
  22. Response.Status = "500 Internal Server Error"
  23. Response.ContentType = "text/plain; charset=utf-8"
  24. Response.Write "Internal Server Error"
  25. Response.End
  26. End If
  27. On Error Goto 0
  28. On Error Resume Next
  29. ctx.Initialize route, httpMethod, logDir
  30. If Err.Number <> 0 Then
  31. Err.Clear
  32. On Error Goto 0
  33. Set ctx = Nothing
  34. Response.Status = "500 Internal Server Error"
  35. Response.ContentType = "text/plain; charset=utf-8"
  36. Response.Write "Internal Server Error"
  37. Response.End
  38. End If
  39. On Error Goto 0
  40. Set app = Nothing
  41. On Error Resume Next
  42. Set app = Server.CreateObject("WscMvc.Application")
  43. If Err.Number <> 0 Then
  44. Err.Clear
  45. On Error Goto 0
  46. Set ctx = Nothing
  47. Response.Status = "500 Internal Server Error"
  48. Response.ContentType = "text/plain; charset=utf-8"
  49. Response.Write "Internal Server Error"
  50. Response.End
  51. End If
  52. On Error Goto 0
  53. statusLine = ""
  54. contentType = ""
  55. body = ""
  56. On Error Resume Next
  57. app.Run ctx, applicationName, statusLine, contentType, body
  58. If Err.Number <> 0 Then
  59. Err.Clear
  60. On Error Goto 0
  61. Set app = Nothing
  62. Set ctx = Nothing
  63. Response.Status = "500 Internal Server Error"
  64. Response.ContentType = "text/plain; charset=utf-8"
  65. Response.Write "Internal Server Error"
  66. Response.End
  67. End If
  68. On Error Goto 0
  69. Response.Status = statusLine
  70. Response.ContentType = contentType
  71. Response.Write body
  72. Set app = Nothing
  73. Set ctx = Nothing
  74. %>

Powered by TurnKey Linux.