Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

87 řádky
2.4KB

  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, allowHeader
  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. allowHeader = ""
  57. On Error Resume Next
  58. app.Run ctx, applicationName, statusLine, contentType, body, allowHeader
  59. If Err.Number <> 0 Then
  60. Err.Clear
  61. On Error Goto 0
  62. Set app = Nothing
  63. Set ctx = Nothing
  64. Response.Status = "500 Internal Server Error"
  65. Response.ContentType = "text/plain; charset=utf-8"
  66. Response.Write "Internal Server Error"
  67. Response.End
  68. End If
  69. On Error Goto 0
  70. Response.Status = statusLine
  71. Response.ContentType = contentType
  72. If Len(allowHeader) > 0 Then
  73. Response.AddHeader "Allow", allowHeader
  74. End If
  75. Response.Write body
  76. Set app = Nothing
  77. Set ctx = Nothing
  78. %>

Powered by TurnKey Linux.