Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix ws after re-clone

  • Loading branch information...
commit bb159fcaaf1e76848068c288d044ff86227263b5 1 parent 1896980
Demis Bellot mythz authored
Showing with 15,305 additions and 15,305 deletions.
  1. +173 −173 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/IndexOperationsControl.cs
  2. +237 −237 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/OperationControl.cs
  3. +86 −86 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/OperationsControl.cs
  4. +40 −40 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/Soap11OperationControl.cs
  5. +39 −39 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/Soap12OperationControl.cs
  6. +70 −70 src/ServiceStack/WebHost.Endpoints/Support/Metadata/WsdlMetadataHandlerBase.cs
  7. +8 −8 src/ServiceStack/WebHost.Endpoints/Support/Metadata/XsdTypeNames.cs
  8. +18 −18 src/ServiceStack/WebHost.Endpoints/Support/Metadata/XsdTypes.cs
  9. +84 −84 src/ServiceStack/WebHost.Endpoints/Support/Mocks/HttpRequestMock.cs
  10. +118 −118 src/ServiceStack/WebHost.Endpoints/Support/Mocks/HttpResponseMock.cs
  11. +94 −94 src/ServiceStack/WebHost.Endpoints/Support/RedirectHttpHandler.cs
  12. +174 −174 src/ServiceStack/WebHost.Endpoints/Support/RequestInfoHandler.cs
  13. +215 −215 src/ServiceStack/WebHost.Endpoints/Support/SoapHandler.cs
  14. +292 −292 src/ServiceStack/WebHost.Endpoints/Support/StaticFileHandler.cs
  15. +61 −61 src/ServiceStack/WebHost.Endpoints/Support/Templates/ListTemplate.cs
  16. +91 −91 src/ServiceStack/WebHost.Endpoints/Support/Templates/Soap11WsdlTemplate.cs
  17. +91 −91 src/ServiceStack/WebHost.Endpoints/Support/Templates/Soap12WsdlTemplate.cs
  18. +189 −189 src/ServiceStack/WebHost.Endpoints/Support/Templates/WsdlTemplateBase.cs
  19. +96 −96 src/ServiceStack/WebHost.Endpoints/Utils/FilterAttributeCache.cs
  20. +61 −61 src/ServiceStack/WebHost.Endpoints/Utils/XsdUtils.cs
  21. +20 −20 src/ServiceStack/WebHost.Endpoints/XmlSyncReplyHandler.cs
  22. +4 −4 src/packages/repositories.config
  23. +1 −1  tests/MasterHost/Global.asax
  24. +95 −95 tests/MasterHost/Global.asax.cs
  25. +158 −158 tests/MasterHost/MasterHost.csproj
  26. +35 −35 tests/MasterHost/Properties/AssemblyInfo.cs
  27. +73 −73 tests/MasterHost/ReportTests.cs
  28. +123 −123 tests/MasterHost/ReportsService.cs
  29. +163 −163 tests/MasterHost/RunReportsService.cs
  30. +151 −151 tests/MasterHost/RunRequestInfoService.cs
  31. +126 −126 tests/MasterHost/Web.config
  32. +9 −9 tests/MasterHost/default.htm
  33. +28 −28 tests/RazorRockstars.Console.Files/AppHost.cs
  34. +124 −124 tests/RazorRockstars.Console.Files/Benchmarks.cs
  35. +31 −31 tests/RazorRockstars.Console.Files/DynamicJsonTests.cs
  36. +167 −167 tests/RazorRockstars.Console.Files/MsgPackServiceTests.cs
  37. +225 −225 tests/RazorRockstars.Console.Files/RazorRockstars.Console.Files.csproj
  38. +235 −235 tests/RazorRockstars.Console.Files/RazorRockstars_FilesTests.cs
  39. +48 −48 tests/RazorRockstars.Console.Files/Web.config
  40. +17 −17 tests/RazorRockstars.Console/AppHost.cs
  41. +144 −144 tests/RazorRockstars.Console/RazorRockstars.Console.csproj
  42. +155 −155 tests/RazorRockstars.Console/RazorRockstars_EmbeddedFilesTests.cs
  43. +48 −48 tests/RazorRockstars.Console/Web.config
  44. +1 −1  tests/RazorRockstars.Web/Global.asax
  45. +12 −12 tests/RazorRockstars.Web/Global.asax.cs
  46. +35 −35 tests/RazorRockstars.Web/Properties/AssemblyInfo.cs
  47. +179 −179 tests/RazorRockstars.Web/RazorRockstars_WebTests.cs
  48. +70 −70 tests/RazorRockstars.Web/Web.config
  49. +25 −25 tests/ServiceStack.Auth.Tests/App.config
  50. +176 −176 tests/ServiceStack.Auth.Tests/RazorAppHost.cs
  51. +3 −3 tests/ServiceStack.Auth.Tests/SecureTests.cs
  52. +109 −109 tests/ServiceStack.Auth.Tests/ServiceStack.Auth.Tests.csproj
  53. +31 −31 tests/ServiceStack.Auth.Tests/TestBase.cs
  54. +117 −117 tests/ServiceStack.Common.Tests/IdUtilsTests.cs
  55. +150 −150 tests/ServiceStack.Common.Tests/MappingTests.cs
  56. +60 −60 tests/ServiceStack.Common.Tests/MessagingTests.cs
  57. +183 −183 tests/ServiceStack.Common.Tests/Models/ModelWithFieldsOfDifferentTypes.cs
  58. +84 −84 tests/ServiceStack.Common.Tests/OAuth/CredentialsServiceTests.cs
  59. +57 −57 tests/ServiceStack.Common.Tests/OAuth/MockAuthHttpGateway.cs
  60. +316 −316 tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTests.cs
  61. +243 −243 tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTestsBase.cs
  62. +96 −96 tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionWithoutTestSourceTests.cs
  63. +53 −53 tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs
  64. +145 −145 tests/ServiceStack.Common.Tests/OAuth/RegistrationServiceTests.cs
  65. +82 −82 tests/ServiceStack.Common.Tests/OAuth/RequiredRolesTests.cs
  66. +5 −5 tests/ServiceStack.Common.Tests/Perf/TextSerializerComparisons.cs
  67. +109 −109 tests/ServiceStack.Common.Tests/PerfTestBase.cs
  68. +37 −37 tests/ServiceStack.Common.Tests/Properties/Settings.Designer.cs
  69. +81 −81 tests/ServiceStack.Common.Tests/ReflectionExtensionsTests.cs
  70. +264 −264 tests/ServiceStack.Common.Tests/ReflectionUtilTests.cs
  71. +258 −258 tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj
  72. +75 −75 tests/ServiceStack.Common.Tests/StreamExtensionsTests.cs
  73. +6 −6 tests/ServiceStack.Common.Tests/StringExtensionTests.cs
  74. +76 −76 tests/ServiceStack.Common.Tests/Text/AdhocJsTests.cs
  75. +9 −9 tests/ServiceStack.Common.Tests/app.config
  76. +93 −93 tests/ServiceStack.Messaging.Tests/MessageSerializationTests.cs
  77. +152 −152 tests/ServiceStack.Messaging.Tests/ServiceStack.Messaging.Tests.csproj
  78. +9 −9 tests/ServiceStack.Messaging.Tests/Services/MessagingServiceBase.cs
  79. +122 −122 tests/ServiceStack.Messaging.Tests/TransientServiceMessagingTests.cs
  80. +1 −1  tests/ServiceStack.RazorHostTests/Global.asax
  81. +171 −171 tests/ServiceStack.RazorHostTests/Global.asax.cs
  82. +35 −35 tests/ServiceStack.RazorHostTests/Properties/AssemblyInfo.cs
  83. +214 −214 tests/ServiceStack.RazorHostTests/ServiceStack.RazorHostTests.csproj
  84. +29 −29 tests/ServiceStack.RazorHostTests/Web.Debug.config
  85. +30 −30 tests/ServiceStack.RazorHostTests/Web.Release.config
  86. +57 −57 tests/ServiceStack.RazorHostTests/Web.config
  87. +1 −1  tests/ServiceStack.RazorNancyTests/Global.asax
  88. +54 −54 tests/ServiceStack.RazorNancyTests/Global.asax.cs
  89. +35 −35 tests/ServiceStack.RazorNancyTests/Properties/AssemblyInfo.cs
  90. +128 −128 tests/ServiceStack.RazorNancyTests/ServiceStack.RazorNancyTests.csproj
  91. +35 −35 tests/ServiceStack.RazorNancyTests/Web.config
  92. +5 −5 tests/ServiceStack.RazorNancyTests/packages.config
  93. +27 −27 tests/ServiceStack.ServiceHost.Tests/App.config
  94. +19 −19 tests/ServiceStack.ServiceHost.Tests/AppData/FormatHelpers.cs
  95. +207 −207 tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindCustomers.cs
  96. +26 −26 tests/ServiceStack.ServiceHost.Tests/AppData/NorthwindHelpers.cs
  97. +242 −242 tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionExampleTests.cs
  98. +330 −330 tests/ServiceStack.ServiceHost.Tests/Formats/IntroductionLayoutTests.cs
  99. +22 −22 tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatExtensions.cs
  100. +114 −114 tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownFormatTests.cs
  101. +66 −66 tests/ServiceStack.ServiceHost.Tests/Formats/MarkdownTestBase.cs
  102. +63 −63 tests/ServiceStack.ServiceHost.Tests/Formats/MockClass.cs
  103. +17 −17 tests/ServiceStack.ServiceHost.Tests/Formats/TemplateExtentionTests.cs
  104. +934 −934 tests/ServiceStack.ServiceHost.Tests/Formats/TemplateTests.cs
  105. +203 −203 tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockTests.cs
  106. +16 −16 tests/ServiceStack.ServiceHost.Tests/Formats/TextBlockUtils.cs
  107. +214 −214 tests/ServiceStack.ServiceHost.Tests/Formats/UseCaseTests.cs
  108. +293 −293 tests/ServiceStack.ServiceHost.Tests/Formats/ViewTests.cs
  109. +10 −10 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/CustomRazorBasePage.cs
  110. +210 −210 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionExampleRazorTests.cs
  111. +348 −348 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/IntroductionLayoutRazorTests.cs
  112. +109 −109 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorEngineTests.cs
  113. +91 −91 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/RazorTestBase.cs
  114. +899 −899 tests/ServiceStack.ServiceHost.Tests/Formats_Razor/TemplateTests.cs
  115. +67 −67 tests/ServiceStack.ServiceHost.Tests/IoCTests.cs
  116. +54 −54 tests/ServiceStack.ServiceHost.Tests/RequestContextExtensionsTest.cs
  117. +194 −194 tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs
  118. +65 −65 tests/ServiceStack.ServiceHost.Tests/Routes/ServiceRoutesTests.cs
  119. +16 −16 tests/ServiceStack.ServiceHost.Tests/Routes/SimpleRestServices.cs
  120. +98 −98 tests/ServiceStack.ServiceHost.Tests/ServiceCreationTests.cs
  121. +254 −254 tests/ServiceStack.ServiceHost.Tests/ServiceStack.ServiceHost.Tests.csproj
  122. +90 −90 tests/ServiceStack.ServiceHost.Tests/ServiceStackHandlerPathTests.cs
  123. +143 −143 tests/ServiceStack.ServiceHost.Tests/ServiceStackHandlerUrlTests.cs
  124. +2 −2 tests/ServiceStack.ServiceHost.Tests/Support/AutoWireService.cs
  125. +107 −107 tests/ServiceStack.ServiceHost.Tests/TypeFactory/ReflectionTypeFunqContainer.cs
  126. +24 −24 tests/ServiceStack.ServiceModel.Tests/DataContracts/Operations/GetCustomers.cs
  127. +27 −27 tests/ServiceStack.ServiceModel.Tests/DataContracts/Operations/GetCustomersResponse.cs
  128. +67 −67 tests/ServiceStack.ServiceModel.Tests/ServiceModelSerializerTests.cs
  129. +152 −152 tests/ServiceStack.ServiceModel.Tests/ServiceStack.ServiceModel.Tests.csproj
  130. +49 −49 tests/ServiceStack.WebHost.Endpoints.Tests/AppHostConfigTests.cs
  131. +213 −213 tests/ServiceStack.WebHost.Endpoints.Tests/AppHostHttpListenerLongRunningBaseTests.cs
  132. +235 −235 tests/ServiceStack.WebHost.Endpoints.Tests/AppHostListenerBaseTests.cs
  133. +173 −173 tests/ServiceStack.WebHost.Endpoints.Tests/AsyncRestClientTests.cs
  134. +80 −80 tests/ServiceStack.WebHost.Endpoints.Tests/AsyncServiceClientTests.cs
Sorry, we could not display the entire diff because it was too big.
346 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/IndexOperationsControl.cs
View
@@ -1,174 +1,174 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Web.UI;
-using ServiceStack.ServiceHost;
-using ServiceStack.WebHost.Endpoints.Support.Templates;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
-{
- internal class IndexOperationsControl : System.Web.UI.Control
- {
- public IHttpRequest HttpRequest { get; set; }
- public string Title { get; set; }
- public List<string> OperationNames { get; set; }
- public string MetadataPageBodyHtml { get; set; }
- public IDictionary<int, string> Xsds { get; set; }
- public int XsdServiceTypesIndex { get; set; }
- public ServiceEndpointsMetadataConfig MetadataConfig { get; set; }
-
- protected override void Render(HtmlTextWriter output)
- {
- var parentPath = HttpRequest.GetParentAbsolutePath();
- var ignoreFormats = EndpointHost.Config.IgnoreFormatsInMetadata;
- var opTemplate = new StringBuilder("<li><span>{0}</span>");
- if (MetadataConfig.Xml != null && !ignoreFormats.Contains("xml"))
- opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">XML</a>", parentPath + MetadataConfig.Xml.DefaultMetadataUri);
- if (MetadataConfig.Json != null && !ignoreFormats.Contains("json"))
- opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">JSON</a>", parentPath + MetadataConfig.Json.DefaultMetadataUri);
- if (MetadataConfig.Jsv != null && !ignoreFormats.Contains("jsv"))
- opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">JSV</a>", parentPath + MetadataConfig.Jsv.DefaultMetadataUri);
-
- if (MetadataConfig.Custom != null)
- {
- foreach (var format in EndpointHost.ContentTypeFilter.ContentTypeFormats.Keys)
- {
- if (ignoreFormats.Contains(format)) continue;
-
- var uri = parentPath + string.Format(MetadataConfig.Custom.DefaultMetadataUri, format);
- opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">{1}</a>", uri, format.ToUpper());
- }
- }
-
- if (MetadataConfig.Soap11 != null && !ignoreFormats.Contains("soap11"))
- opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">SOAP 1.1</a>", parentPath + MetadataConfig.Soap11.DefaultMetadataUri);
- if (MetadataConfig.Soap12 != null && !ignoreFormats.Contains("soap12"))
- opTemplate.AppendFormat(@"<a class=""last"" href=""{0}?op={{0}}"">SOAP 1.2</a>", parentPath + MetadataConfig.Soap12.DefaultMetadataUri);
-
- opTemplate.Append("</li>");
-
- var operationsPart = new ListTemplate {
- Title = "Operations:",
- ListItems = this.OperationNames,
- ForEachListItem = operation => string.Format(opTemplate.ToString(), operation)
- }.ToString();
-
- var xsdsPart = new ListTemplate {
- Title = "XSDS:",
- ListItemsIntMap = this.Xsds,
- ListItemTemplate = @"<li><a href=""?xsd={0}"">{1}</a></li>"
- }.ToString();
-
- var wsdlTemplate = new StringBuilder();
- if (MetadataConfig.Soap11 != null || MetadataConfig.Soap12 != null)
- {
- wsdlTemplate.AppendLine("<h3>WSDLS:</h3>");
- wsdlTemplate.AppendLine("<ul>");
- if (MetadataConfig.Soap11 != null)
- {
- wsdlTemplate.AppendFormat(
- @"<li><a href=""{0}"">{0}</a></li>",
- MetadataConfig.Soap11.WsdlMetadataUri);
- }
- if (MetadataConfig.Soap12 != null)
- {
- wsdlTemplate.AppendFormat(
- @"<li><a href=""{0}"">{0}</a></li>",
- MetadataConfig.Soap12.WsdlMetadataUri);
- }
- wsdlTemplate.AppendLine("<ul>");
- }
-
- var renderedTemplate = string.Format(
- PageTemplate, this.Title, this.MetadataPageBodyHtml, this.XsdServiceTypesIndex,
- operationsPart, xsdsPart, wsdlTemplate);
-
- output.Write(renderedTemplate);
- }
-
- #region Page Template
- private const string PageTemplate = @"
-<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
-
-<html xmlns=""http://www.w3.org/1999/xhtml"" >
-<head>
- <title>{0}</title>
- <style type=""text/css"">
- BODY {{
- background-color:white;
- color:#000000;
- font-family:Verdana;
- margin: 0;
- }}
- H1 {{
- background-color: #036;
- color: #FFF;
- font-family: Tahoma;
- font-size: 26px;
- font-weight: normal;
- margin: 0;
- padding: 10px 0 3px 15px;
- }}
- FORM {{
- font-size: 0.7em;
- margin-left: 20px;
- padding-bottom: 2em;
- }}
- UL {{
- margin: 10px 0 0 10px;
- padding: 0px 0px 0px 10px;
- }}
- LI {{
- clear: left;
- margin-top: 10px;
- }}
- LI A {{
- color: #369;
- font-weight: bold;
- text-decoration: underline;
- }}
- LI A:hover {{
- color: #C30;
- }}
- .operations UL {{
- list-style: none;
- }}
- .operations SPAN {{
- float: left;
- display: block;
- width: 27em;
- }}
- .operations A {{
- border-right: 1px solid #CCC;
- margin-right: 1em;
- padding-right: 1em;
- }}
- .operations A.last {{
- border:none;
- }}
- </style>
-</head>
-<body>
- <h1>{0}</h1>
-
- <form id=""form1"">
- <p>The following operations are supported. For a formal definition, please review the Service <a href=""?xsd={2}"">XSD</a>.
- </p>
-
- <div class=""operations"">
- {3}
- </div>
-
- {1}
-
- {4}
-
- {5}
-
- </form>
-</body>
-</html>";
- #endregion
-
- }
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web.UI;
+using ServiceStack.ServiceHost;
+using ServiceStack.WebHost.Endpoints.Support.Templates;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
+{
+ internal class IndexOperationsControl : System.Web.UI.Control
+ {
+ public IHttpRequest HttpRequest { get; set; }
+ public string Title { get; set; }
+ public List<string> OperationNames { get; set; }
+ public string MetadataPageBodyHtml { get; set; }
+ public IDictionary<int, string> Xsds { get; set; }
+ public int XsdServiceTypesIndex { get; set; }
+ public ServiceEndpointsMetadataConfig MetadataConfig { get; set; }
+
+ protected override void Render(HtmlTextWriter output)
+ {
+ var parentPath = HttpRequest.GetParentAbsolutePath();
+ var ignoreFormats = EndpointHost.Config.IgnoreFormatsInMetadata;
+ var opTemplate = new StringBuilder("<li><span>{0}</span>");
+ if (MetadataConfig.Xml != null && !ignoreFormats.Contains("xml"))
+ opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">XML</a>", parentPath + MetadataConfig.Xml.DefaultMetadataUri);
+ if (MetadataConfig.Json != null && !ignoreFormats.Contains("json"))
+ opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">JSON</a>", parentPath + MetadataConfig.Json.DefaultMetadataUri);
+ if (MetadataConfig.Jsv != null && !ignoreFormats.Contains("jsv"))
+ opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">JSV</a>", parentPath + MetadataConfig.Jsv.DefaultMetadataUri);
+
+ if (MetadataConfig.Custom != null)
+ {
+ foreach (var format in EndpointHost.ContentTypeFilter.ContentTypeFormats.Keys)
+ {
+ if (ignoreFormats.Contains(format)) continue;
+
+ var uri = parentPath + string.Format(MetadataConfig.Custom.DefaultMetadataUri, format);
+ opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">{1}</a>", uri, format.ToUpper());
+ }
+ }
+
+ if (MetadataConfig.Soap11 != null && !ignoreFormats.Contains("soap11"))
+ opTemplate.AppendFormat(@"<a href=""{0}?op={{0}}"">SOAP 1.1</a>", parentPath + MetadataConfig.Soap11.DefaultMetadataUri);
+ if (MetadataConfig.Soap12 != null && !ignoreFormats.Contains("soap12"))
+ opTemplate.AppendFormat(@"<a class=""last"" href=""{0}?op={{0}}"">SOAP 1.2</a>", parentPath + MetadataConfig.Soap12.DefaultMetadataUri);
+
+ opTemplate.Append("</li>");
+
+ var operationsPart = new ListTemplate {
+ Title = "Operations:",
+ ListItems = this.OperationNames,
+ ForEachListItem = operation => string.Format(opTemplate.ToString(), operation)
+ }.ToString();
+
+ var xsdsPart = new ListTemplate {
+ Title = "XSDS:",
+ ListItemsIntMap = this.Xsds,
+ ListItemTemplate = @"<li><a href=""?xsd={0}"">{1}</a></li>"
+ }.ToString();
+
+ var wsdlTemplate = new StringBuilder();
+ if (MetadataConfig.Soap11 != null || MetadataConfig.Soap12 != null)
+ {
+ wsdlTemplate.AppendLine("<h3>WSDLS:</h3>");
+ wsdlTemplate.AppendLine("<ul>");
+ if (MetadataConfig.Soap11 != null)
+ {
+ wsdlTemplate.AppendFormat(
+ @"<li><a href=""{0}"">{0}</a></li>",
+ MetadataConfig.Soap11.WsdlMetadataUri);
+ }
+ if (MetadataConfig.Soap12 != null)
+ {
+ wsdlTemplate.AppendFormat(
+ @"<li><a href=""{0}"">{0}</a></li>",
+ MetadataConfig.Soap12.WsdlMetadataUri);
+ }
+ wsdlTemplate.AppendLine("<ul>");
+ }
+
+ var renderedTemplate = string.Format(
+ PageTemplate, this.Title, this.MetadataPageBodyHtml, this.XsdServiceTypesIndex,
+ operationsPart, xsdsPart, wsdlTemplate);
+
+ output.Write(renderedTemplate);
+ }
+
+ #region Page Template
+ private const string PageTemplate = @"
+<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
+
+<html xmlns=""http://www.w3.org/1999/xhtml"" >
+<head>
+ <title>{0}</title>
+ <style type=""text/css"">
+ BODY {{
+ background-color:white;
+ color:#000000;
+ font-family:Verdana;
+ margin: 0;
+ }}
+ H1 {{
+ background-color: #036;
+ color: #FFF;
+ font-family: Tahoma;
+ font-size: 26px;
+ font-weight: normal;
+ margin: 0;
+ padding: 10px 0 3px 15px;
+ }}
+ FORM {{
+ font-size: 0.7em;
+ margin-left: 20px;
+ padding-bottom: 2em;
+ }}
+ UL {{
+ margin: 10px 0 0 10px;
+ padding: 0px 0px 0px 10px;
+ }}
+ LI {{
+ clear: left;
+ margin-top: 10px;
+ }}
+ LI A {{
+ color: #369;
+ font-weight: bold;
+ text-decoration: underline;
+ }}
+ LI A:hover {{
+ color: #C30;
+ }}
+ .operations UL {{
+ list-style: none;
+ }}
+ .operations SPAN {{
+ float: left;
+ display: block;
+ width: 27em;
+ }}
+ .operations A {{
+ border-right: 1px solid #CCC;
+ margin-right: 1em;
+ padding-right: 1em;
+ }}
+ .operations A.last {{
+ border:none;
+ }}
+ </style>
+</head>
+<body>
+ <h1>{0}</h1>
+
+ <form id=""form1"">
+ <p>The following operations are supported. For a formal definition, please review the Service <a href=""?xsd={2}"">XSD</a>.
+ </p>
+
+ <div class=""operations"">
+ {3}
+ </div>
+
+ {1}
+
+ {4}
+
+ {5}
+
+ </form>
+</body>
+</html>";
+ #endregion
+
+ }
}
474 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/OperationControl.cs
View
@@ -1,238 +1,238 @@
-using System.Web;
-using System.Web.UI;
-using ServiceStack.Common;
-using ServiceStack.Common.Web;
-using ServiceStack.ServiceHost;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
-{
- public class OperationControl
- {
- public ServiceEndpointsMetadataConfig MetadataConfig { get; set; }
-
- public EndpointType EndpointType
- {
- set
- {
- this.ContentType = Common.Web.ContentType.GetContentType(value);
- this.ContentFormat = Common.Web.ContentType.GetContentFormat(value);
- }
- }
-
- public IHttpRequest HttpRequest { get; set; }
- public string ContentType { get; set; }
- public string ContentFormat { get; set; }
-
- public string Title { get; set; }
- public string OperationName { get; set; }
- public string HostName { get; set; }
- public string RequestMessage { get; set; }
- public string ResponseMessage { get; set; }
- public string RestPaths { get; set; }
-
- public string DescriptionHtml { get; set; }
-
- public virtual string RequestUri
- {
- get
- {
- var endpointConfig = MetadataConfig.GetEndpointConfig(ContentType);
- var endpontPath = ResponseMessage != null
- ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
- return string.Format("{0}/{1}", endpontPath, OperationName);
- }
- }
-
- public void Render(HtmlTextWriter output)
- {
- var renderedTemplate = string.Format(PageTemplate,
- Title,
- HttpRequest.GetParentAbsolutePath().ToParentPath() + MetadataConfig.DefaultMetadataUri,
- ContentFormat.ToUpper(),
- OperationName,
- HttpRequestTemplate,
- ResponseTemplate,
- RestPathsTemplate,
- DescriptionHtml);
-
- output.Write(renderedTemplate);
- }
-
- protected const string PageTemplate =
-@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
-<html xmlns=""http://www.w3.org/1999/xhtml"" >
-<head>
- <title>{0}</title>
- <style type=""text/css"">
- BODY {{
- background-color:white;
- color:#000000;
- font-family:Verdana;
- margin: 0;
- }}
- #desc{{
- margin: 0;
- padding: 0 0 15px 20px;
- font-size: 16px;
- }}
- #desc P {{
- margin: 5px 0;
- padding: 0;
- line-height: 20px;
- color: #444;
- }}
- H1 {{
- background-color: #036;
- color: #FFF;
- font-family: Tahoma;
- font-size: 26px;
- font-weight: normal;
- margin: 0;
- padding: 10px 0 3px 15px;
- }}
- FORM {{
- font-size: 0.7em;
- margin-left: 20px;
- padding-bottom: 2em;
- }}
- UL {{
- margin: 10px 0 0 20px;
- }}
- LI {{
- margin-top: 10px;
- }}
- LI A {{
- color: #369;
- font-weight: bold;
- text-decoration: underline;
- }}
- LI A:hover {{
- color: #C30;
- }}
-
- H2 {{
- border-top: 1px solid #003366;
- color: #036;
- font-size: 1.5em;
- font-weight: bold;
- margin: 25px 0 20px 0;
- }}
- .example {{
- padding-left: 15px;
- }}
- .example h3 {{
- color:#000000;
- font-size:1.1em;
- margin: 10px 0 0 -15px;
- }}
- .example pre {{
- background-color: #E5E5CC;
- border: 1px solid #F0F0E0;
- font-family: Courier New;
- font-size: small;
- padding: 5px;
- margin-right: 15px;
- white-space: pre-wrap;
- }}
- .example .value {{
- color: blue;
- }}
- </style>
-</head>
-<body>
- <h1>{0}</h1>
-
- <form>
- <div>
- <p><a href=""{1}"">&lt;back to all web services</a></p>
- <h2>{3}</h2>
-
- {7}
-
- <div class=""example"">
-<!-- REST Examples -->
-{6}
-
- <h3>HTTP + {2}</h3>
- <p> The following are sample HTTP requests and responses.
- The placeholders shown need to be replaced with actual values.</p>
-
-<div class=""request"">
-<pre>
-{4}
-</pre>
-</div>
-
-{5}
-
- </div>
- </div>
- </form>
-</body>
-</html>";
-
- public virtual string HttpRequestTemplate
- {
- get
- {
- return string.Format(
-@"POST {0} HTTP/1.1
-Host: {1}
-Content-Type: {2}
-Content-Length: <span class=""value"">length</span>
-
-{3}", RequestUri, HostName, ContentType, HttpUtility.HtmlEncode(RequestMessage));
- }
- }
-
- public virtual string ResponseTemplate
- {
- get
- {
- var httpResponse = this.HttpResponseTemplate;
- return string.IsNullOrEmpty(httpResponse) ? null : string.Format(@"
-<div class=""response"">
-<pre>
-{0}
-</pre>
-</div>
-", httpResponse);
- }
- }
-
- public virtual string HttpResponseTemplate
- {
- get
- {
- if (string.IsNullOrEmpty(ResponseMessage)) return null;
- return string.Format(
-@"HTTP/1.1 200 OK
-Content-Type: {0}
-Content-Length: length
-
-{1}", ContentType, HttpUtility.HtmlEncode(ResponseMessage));
- }
- }
-
- public virtual string RestPathsTemplate
- {
- get
- {
- var jsonp = ContentFormat == "json"
- ? "<p>To embed the response in a <b>jsonp</b> callback, append <b>?callback=myCallback</b></p>"
- : "";
-
- return string.IsNullOrEmpty(RestPaths) ? null : string.Format(
-@"
-<h3>REST Paths</h3>
-<p>The following REST paths are available for this service.</p>
-<div class=""restpaths"">
-<pre>{0}</pre>
-<p>To override the Content-type in your clients HTTP <b>Accept</b> Header, append <b>?format={1}</b></p>
-{2}
-</div>
-", RestPaths, ContentFormat, jsonp);
- }
- }
- }
+using System.Web;
+using System.Web.UI;
+using ServiceStack.Common;
+using ServiceStack.Common.Web;
+using ServiceStack.ServiceHost;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
+{
+ public class OperationControl
+ {
+ public ServiceEndpointsMetadataConfig MetadataConfig { get; set; }
+
+ public EndpointType EndpointType
+ {
+ set
+ {
+ this.ContentType = Common.Web.ContentType.GetContentType(value);
+ this.ContentFormat = Common.Web.ContentType.GetContentFormat(value);
+ }
+ }
+
+ public IHttpRequest HttpRequest { get; set; }
+ public string ContentType { get; set; }
+ public string ContentFormat { get; set; }
+
+ public string Title { get; set; }
+ public string OperationName { get; set; }
+ public string HostName { get; set; }
+ public string RequestMessage { get; set; }
+ public string ResponseMessage { get; set; }
+ public string RestPaths { get; set; }
+
+ public string DescriptionHtml { get; set; }
+
+ public virtual string RequestUri
+ {
+ get
+ {
+ var endpointConfig = MetadataConfig.GetEndpointConfig(ContentType);
+ var endpontPath = ResponseMessage != null
+ ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
+ return string.Format("{0}/{1}", endpontPath, OperationName);
+ }
+ }
+
+ public void Render(HtmlTextWriter output)
+ {
+ var renderedTemplate = string.Format(PageTemplate,
+ Title,
+ HttpRequest.GetParentAbsolutePath().ToParentPath() + MetadataConfig.DefaultMetadataUri,
+ ContentFormat.ToUpper(),
+ OperationName,
+ HttpRequestTemplate,
+ ResponseTemplate,
+ RestPathsTemplate,
+ DescriptionHtml);
+
+ output.Write(renderedTemplate);
+ }
+
+ protected const string PageTemplate =
+@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
+<html xmlns=""http://www.w3.org/1999/xhtml"" >
+<head>
+ <title>{0}</title>
+ <style type=""text/css"">
+ BODY {{
+ background-color:white;
+ color:#000000;
+ font-family:Verdana;
+ margin: 0;
+ }}
+ #desc{{
+ margin: 0;
+ padding: 0 0 15px 20px;
+ font-size: 16px;
+ }}
+ #desc P {{
+ margin: 5px 0;
+ padding: 0;
+ line-height: 20px;
+ color: #444;
+ }}
+ H1 {{
+ background-color: #036;
+ color: #FFF;
+ font-family: Tahoma;
+ font-size: 26px;
+ font-weight: normal;
+ margin: 0;
+ padding: 10px 0 3px 15px;
+ }}
+ FORM {{
+ font-size: 0.7em;
+ margin-left: 20px;
+ padding-bottom: 2em;
+ }}
+ UL {{
+ margin: 10px 0 0 20px;
+ }}
+ LI {{
+ margin-top: 10px;
+ }}
+ LI A {{
+ color: #369;
+ font-weight: bold;
+ text-decoration: underline;
+ }}
+ LI A:hover {{
+ color: #C30;
+ }}
+
+ H2 {{
+ border-top: 1px solid #003366;
+ color: #036;
+ font-size: 1.5em;
+ font-weight: bold;
+ margin: 25px 0 20px 0;
+ }}
+ .example {{
+ padding-left: 15px;
+ }}
+ .example h3 {{
+ color:#000000;
+ font-size:1.1em;
+ margin: 10px 0 0 -15px;
+ }}
+ .example pre {{
+ background-color: #E5E5CC;
+ border: 1px solid #F0F0E0;
+ font-family: Courier New;
+ font-size: small;
+ padding: 5px;
+ margin-right: 15px;
+ white-space: pre-wrap;
+ }}
+ .example .value {{
+ color: blue;
+ }}
+ </style>
+</head>
+<body>
+ <h1>{0}</h1>
+
+ <form>
+ <div>
+ <p><a href=""{1}"">&lt;back to all web services</a></p>
+ <h2>{3}</h2>
+
+ {7}
+
+ <div class=""example"">
+<!-- REST Examples -->
+{6}
+
+ <h3>HTTP + {2}</h3>
+ <p> The following are sample HTTP requests and responses.
+ The placeholders shown need to be replaced with actual values.</p>
+
+<div class=""request"">
+<pre>
+{4}
+</pre>
+</div>
+
+{5}
+
+ </div>
+ </div>
+ </form>
+</body>
+</html>";
+
+ public virtual string HttpRequestTemplate
+ {
+ get
+ {
+ return string.Format(
+@"POST {0} HTTP/1.1
+Host: {1}
+Content-Type: {2}
+Content-Length: <span class=""value"">length</span>
+
+{3}", RequestUri, HostName, ContentType, HttpUtility.HtmlEncode(RequestMessage));
+ }
+ }
+
+ public virtual string ResponseTemplate
+ {
+ get
+ {
+ var httpResponse = this.HttpResponseTemplate;
+ return string.IsNullOrEmpty(httpResponse) ? null : string.Format(@"
+<div class=""response"">
+<pre>
+{0}
+</pre>
+</div>
+", httpResponse);
+ }
+ }
+
+ public virtual string HttpResponseTemplate
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(ResponseMessage)) return null;
+ return string.Format(
+@"HTTP/1.1 200 OK
+Content-Type: {0}
+Content-Length: length
+
+{1}", ContentType, HttpUtility.HtmlEncode(ResponseMessage));
+ }
+ }
+
+ public virtual string RestPathsTemplate
+ {
+ get
+ {
+ var jsonp = ContentFormat == "json"
+ ? "<p>To embed the response in a <b>jsonp</b> callback, append <b>?callback=myCallback</b></p>"
+ : "";
+
+ return string.IsNullOrEmpty(RestPaths) ? null : string.Format(
+@"
+<h3>REST Paths</h3>
+<p>The following REST paths are available for this service.</p>
+<div class=""restpaths"">
+<pre>{0}</pre>
+<p>To override the Content-type in your clients HTTP <b>Accept</b> Header, append <b>?format={1}</b></p>
+{2}
+</div>
+", RestPaths, ContentFormat, jsonp);
+ }
+ }
+ }
}
172 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/OperationsControl.cs
View
@@ -1,87 +1,87 @@
-using System.Collections.Generic;
-using System.Web.UI;
-using ServiceStack.WebHost.Endpoints.Support.Templates;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
-{
- internal class OperationsControl : System.Web.UI.Control
- {
- public string Title { get; set; }
- public List<string> OperationNames { get; set; }
- public string MetadataOperationPageBodyHtml { get; set; }
-
- protected override void Render(HtmlTextWriter output)
- {
- var operationsPart = new ListTemplate
- {
- ListItems = this.OperationNames,
- ListItemTemplate = @"<li><a href=""?op={0}"">{0}</a></li>"
- }.ToString();
- var renderedTemplate = string.Format(PageTemplate,
- this.Title, this.MetadataOperationPageBodyHtml, operationsPart);
- output.Write(renderedTemplate);
- }
-
- #region Page Template
- private const string PageTemplate =
-@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
-
-<html xmlns=""http://www.w3.org/1999/xhtml"" >
-<head>
- <title>{0}</title>
- <style type=""text/css"">
- BODY {{
- background-color:white;
- color:#000000;
- font-family:Verdana;
- margin: 0;
- }}
- H1 {{
- background-color: #036;
- color: #FFF;
- font-family: Tahoma;
- font-size: 26px;
- font-weight: normal;
- margin: 0;
- padding: 10px 0 3px 15px;
- }}
- FORM {{
- font-size: 0.7em;
- margin-left: 20px;
- padding-bottom: 2em;
- }}
- UL {{
- margin: 10px 0 0 20px;
- }}
- LI {{
- margin-top: 10px;
- }}
- LI A {{
- color: #369;
- font-weight: bold;
- text-decoration: underline;
- }}
- LI A:hover {{
- color: #C30;
- }}
- </style>
-</head>
-<body>
- <h1>{0}</h1>
-
- <form>
- <p> The following operations are supported.
- For a more information please view the <a href=""../../Metadata"">Service Documentation</a>.
- </p>
-
- {2}
-
- {1}
-
- </form>
-</body>
-</html>";
- #endregion
-
- }
+using System.Collections.Generic;
+using System.Web.UI;
+using ServiceStack.WebHost.Endpoints.Support.Templates;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
+{
+ internal class OperationsControl : System.Web.UI.Control
+ {
+ public string Title { get; set; }
+ public List<string> OperationNames { get; set; }
+ public string MetadataOperationPageBodyHtml { get; set; }
+
+ protected override void Render(HtmlTextWriter output)
+ {
+ var operationsPart = new ListTemplate
+ {
+ ListItems = this.OperationNames,
+ ListItemTemplate = @"<li><a href=""?op={0}"">{0}</a></li>"
+ }.ToString();
+ var renderedTemplate = string.Format(PageTemplate,
+ this.Title, this.MetadataOperationPageBodyHtml, operationsPart);
+ output.Write(renderedTemplate);
+ }
+
+ #region Page Template
+ private const string PageTemplate =
+@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
+
+<html xmlns=""http://www.w3.org/1999/xhtml"" >
+<head>
+ <title>{0}</title>
+ <style type=""text/css"">
+ BODY {{
+ background-color:white;
+ color:#000000;
+ font-family:Verdana;
+ margin: 0;
+ }}
+ H1 {{
+ background-color: #036;
+ color: #FFF;
+ font-family: Tahoma;
+ font-size: 26px;
+ font-weight: normal;
+ margin: 0;
+ padding: 10px 0 3px 15px;
+ }}
+ FORM {{
+ font-size: 0.7em;
+ margin-left: 20px;
+ padding-bottom: 2em;
+ }}
+ UL {{
+ margin: 10px 0 0 20px;
+ }}
+ LI {{
+ margin-top: 10px;
+ }}
+ LI A {{
+ color: #369;
+ font-weight: bold;
+ text-decoration: underline;
+ }}
+ LI A:hover {{
+ color: #C30;
+ }}
+ </style>
+</head>
+<body>
+ <h1>{0}</h1>
+
+ <form>
+ <p> The following operations are supported.
+ For a more information please view the <a href=""../../Metadata"">Service Documentation</a>.
+ </p>
+
+ {2}
+
+ {1}
+
+ </form>
+</body>
+</html>";
+ #endregion
+
+ }
}
80 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/Soap11OperationControl.cs
View
@@ -1,41 +1,41 @@
-using System.Collections.Generic;
-using System.Web;
-using System.Web.UI;
-using ServiceStack.Common.Web;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
-{
- internal class Soap11OperationControl : OperationControl
- {
- public Soap11OperationControl()
- {
- EndpointType = EndpointType.Soap11;
- }
-
- public override string RequestUri
- {
- get
- {
- var endpointConfig = MetadataConfig.GetEndpointConfig(this.ContentType);
- var endpontPath = ResponseMessage != null ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
- return string.Format("/{0}", endpontPath);
- }
- }
-
- public override string HttpRequestTemplate
- {
- get
- {
- return string.Format(
-@"POST {0} HTTP/1.1
-Host: {1}
-Content-Type: text/xml; charset=utf-8
-Content-Length: <span class=""value"">length</span>
-SOAPAction: {2}
-
-{3}", RequestUri, HostName, base.OperationName, HttpUtility.HtmlEncode(RequestMessage));
- }
- }
-
- }
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using ServiceStack.Common.Web;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
+{
+ internal class Soap11OperationControl : OperationControl
+ {
+ public Soap11OperationControl()
+ {
+ EndpointType = EndpointType.Soap11;
+ }
+
+ public override string RequestUri
+ {
+ get
+ {
+ var endpointConfig = MetadataConfig.GetEndpointConfig(this.ContentType);
+ var endpontPath = ResponseMessage != null ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
+ return string.Format("/{0}", endpontPath);
+ }
+ }
+
+ public override string HttpRequestTemplate
+ {
+ get
+ {
+ return string.Format(
+@"POST {0} HTTP/1.1
+Host: {1}
+Content-Type: text/xml; charset=utf-8
+Content-Length: <span class=""value"">length</span>
+SOAPAction: {2}
+
+{3}", RequestUri, HostName, base.OperationName, HttpUtility.HtmlEncode(RequestMessage));
+ }
+ }
+
+ }
}
78 src/ServiceStack/WebHost.Endpoints/Support/Metadata/Controls/Soap12OperationControl.cs
View
@@ -1,40 +1,40 @@
-using System.Collections.Generic;
-using System.Web;
-using System.Web.UI;
-using ServiceStack.Common.Web;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
-{
- internal class Soap12OperationControl : OperationControl
- {
- public Soap12OperationControl()
- {
- EndpointType = EndpointType.Soap12;
- }
-
- public override string RequestUri
- {
- get
- {
- var endpointConfig = MetadataConfig.GetEndpointConfig(this.ContentType);
- var endpontPath = ResponseMessage != null ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
- return string.Format("/{0}", endpontPath);
- }
- }
-
- public override string HttpRequestTemplate
- {
- get
- {
- return string.Format(
-@"POST {0} HTTP/1.1
-Host: {1}
-Content-Type: text/xml; charset=utf-8
-Content-Length: <span class=""value"">length</span>
-
-{2}", RequestUri, HostName, HttpUtility.HtmlEncode(RequestMessage));
- }
- }
-
- }
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using ServiceStack.Common.Web;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata.Controls
+{
+ internal class Soap12OperationControl : OperationControl
+ {
+ public Soap12OperationControl()
+ {
+ EndpointType = EndpointType.Soap12;
+ }
+
+ public override string RequestUri
+ {
+ get
+ {
+ var endpointConfig = MetadataConfig.GetEndpointConfig(this.ContentType);
+ var endpontPath = ResponseMessage != null ? endpointConfig.SyncReplyUri : endpointConfig.AsyncOneWayUri;
+ return string.Format("/{0}", endpontPath);
+ }
+ }
+
+ public override string HttpRequestTemplate
+ {
+ get
+ {
+ return string.Format(
+@"POST {0} HTTP/1.1
+Host: {1}
+Content-Type: text/xml; charset=utf-8
+Content-Length: <span class=""value"">length</span>
+
+{2}", RequestUri, HostName, HttpUtility.HtmlEncode(RequestMessage));
+ }
+ }
+
+ }
}
140 src/ServiceStack/WebHost.Endpoints/Support/Metadata/WsdlMetadataHandlerBase.cs
View
@@ -1,71 +1,71 @@
-using System;
-using System.Web;
-using ServiceStack.ServiceHost;
-using ServiceStack.Text;
-using ServiceStack.Logging;
-using ServiceStack.WebHost.Endpoints.Extensions;
-using ServiceStack.WebHost.Endpoints.Metadata;
-using ServiceStack.WebHost.Endpoints.Support.Templates;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata
-{
- public abstract class WsdlMetadataHandlerBase : HttpHandlerBase
- {
- private readonly ILog log = LogManager.GetLogger(typeof(WsdlMetadataHandlerBase));
-
- protected abstract WsdlTemplateBase GetWsdlTemplate();
-
- public override void Execute(HttpContext context)
- {
- EndpointHost.Config.AssertFeatures(Feature.Metadata);
-
- context.Response.ContentType = "text/xml";
-
- var baseUri = context.Request.GetParentBaseUrl();
- var optimizeForFlash = context.Request.QueryString["flash"] != null;
- var includeAllTypesInAssembly = context.Request.QueryString["includeAllTypes"] != null;
- var operations = includeAllTypesInAssembly ? EndpointHost.AllServiceOperations : EndpointHost.ServiceOperations;
-
- try
- {
- var wsdlTemplate = GetWsdlTemplate(operations, baseUri, optimizeForFlash, includeAllTypesInAssembly, context.Request.GetBaseUrl());
- context.Response.Write(wsdlTemplate.ToString());
- }
- catch (Exception ex)
- {
- log.Error("Autogeneration of WSDL failed.", ex);
-
- context.Response.Write("Autogenerated WSDLs are not supported "
- + (Env.IsMono ? "on Mono" : "with this configuration"));
- }
- }
-
- public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl)
- {
- var xsd = new XsdGenerator {
- OperationTypes = operations.AllOperations.Types,
- OptimizeForFlash = optimizeForFlash,
- IncludeAllTypesInAssembly = includeAllTypesInAssembly,
- }.ToString();
-
- var wsdlTemplate = GetWsdlTemplate();
- wsdlTemplate.Xsd = xsd;
- wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names;
- wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names;
-
- if (rawUrl.ToLower().StartsWith(baseUri))
- {
- wsdlTemplate.ReplyEndpointUri = rawUrl;
- wsdlTemplate.OneWayEndpointUri = rawUrl;
- }
- else
- {
- var suffix = GetType().Name.StartsWith("Soap11") ? "soap11" : "soap12";
- wsdlTemplate.ReplyEndpointUri = baseUri + suffix;
- wsdlTemplate.OneWayEndpointUri = baseUri + suffix;
- }
-
- return wsdlTemplate;
- }
- }
+using System;
+using System.Web;
+using ServiceStack.ServiceHost;
+using ServiceStack.Text;
+using ServiceStack.Logging;
+using ServiceStack.WebHost.Endpoints.Extensions;
+using ServiceStack.WebHost.Endpoints.Metadata;
+using ServiceStack.WebHost.Endpoints.Support.Templates;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata
+{
+ public abstract class WsdlMetadataHandlerBase : HttpHandlerBase
+ {
+ private readonly ILog log = LogManager.GetLogger(typeof(WsdlMetadataHandlerBase));
+
+ protected abstract WsdlTemplateBase GetWsdlTemplate();
+
+ public override void Execute(HttpContext context)
+ {
+ EndpointHost.Config.AssertFeatures(Feature.Metadata);
+
+ context.Response.ContentType = "text/xml";
+
+ var baseUri = context.Request.GetParentBaseUrl();
+ var optimizeForFlash = context.Request.QueryString["flash"] != null;
+ var includeAllTypesInAssembly = context.Request.QueryString["includeAllTypes"] != null;
+ var operations = includeAllTypesInAssembly ? EndpointHost.AllServiceOperations : EndpointHost.ServiceOperations;
+
+ try
+ {
+ var wsdlTemplate = GetWsdlTemplate(operations, baseUri, optimizeForFlash, includeAllTypesInAssembly, context.Request.GetBaseUrl());
+ context.Response.Write(wsdlTemplate.ToString());
+ }
+ catch (Exception ex)
+ {
+ log.Error("Autogeneration of WSDL failed.", ex);
+
+ context.Response.Write("Autogenerated WSDLs are not supported "
+ + (Env.IsMono ? "on Mono" : "with this configuration"));
+ }
+ }
+
+ public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl)
+ {
+ var xsd = new XsdGenerator {
+ OperationTypes = operations.AllOperations.Types,
+ OptimizeForFlash = optimizeForFlash,
+ IncludeAllTypesInAssembly = includeAllTypesInAssembly,
+ }.ToString();
+
+ var wsdlTemplate = GetWsdlTemplate();
+ wsdlTemplate.Xsd = xsd;
+ wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names;
+ wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names;
+
+ if (rawUrl.ToLower().StartsWith(baseUri))
+ {
+ wsdlTemplate.ReplyEndpointUri = rawUrl;
+ wsdlTemplate.OneWayEndpointUri = rawUrl;
+ }
+ else
+ {
+ var suffix = GetType().Name.StartsWith("Soap11") ? "soap11" : "soap12";
+ wsdlTemplate.ReplyEndpointUri = baseUri + suffix;
+ wsdlTemplate.OneWayEndpointUri = baseUri + suffix;
+ }
+
+ return wsdlTemplate;
+ }
+ }
}
16 src/ServiceStack/WebHost.Endpoints/Support/Metadata/XsdTypeNames.cs
View
@@ -1,9 +1,9 @@
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata
-{
- internal enum XsdTypeNames
- {
- WcfTypes = 0,
- ServiceTypes = 1,
- WcfCollectionTypes = 2,
- }
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata
+{
+ internal enum XsdTypeNames
+ {
+ WcfTypes = 0,
+ ServiceTypes = 1,
+ WcfCollectionTypes = 2,
+ }
}
36 src/ServiceStack/WebHost.Endpoints/Support/Metadata/XsdTypes.cs
View
@@ -1,19 +1,19 @@
-using System.Collections.Generic;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Metadata
-{
- internal static class XsdTypes
- {
- public static IDictionary<int, string> Xsds { get; private set; }
-
- static XsdTypes()
- {
- Xsds = new Dictionary<int, string>
- {
- {1, "Service Types"},
- {0, "Wcf Data Types"},
- {2, "Wcf Collection Types"},
- };
- }
- }
+using System.Collections.Generic;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Metadata
+{
+ internal static class XsdTypes
+ {
+ public static IDictionary<int, string> Xsds { get; private set; }
+
+ static XsdTypes()
+ {
+ Xsds = new Dictionary<int, string>
+ {
+ {1, "Service Types"},
+ {0, "Wcf Data Types"},
+ {2, "Wcf Collection Types"},
+ };
+ }
+ }
}
168 src/ServiceStack/WebHost.Endpoints/Support/Mocks/HttpRequestMock.cs
View
@@ -1,21 +1,21 @@
-using System;
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
-using System.Net;
-using ServiceStack.ServiceHost;
-
-namespace ServiceStack.WebHost.Endpoints.Support.Mocks
-{
+using System.Net;
+using ServiceStack.ServiceHost;
+
+namespace ServiceStack.WebHost.Endpoints.Support.Mocks
+{
public class HttpRequestMock : IHttpRequest
{
public HttpRequestMock()
- {
- this.Headers = new NameValueCollection();
- this.Cookies = new Dictionary<string, Cookie>();
- this.FormData = new NameValueCollection();
- this.QueryString = new NameValueCollection();
- this.Items = new Dictionary<string, object>();
+ {
+ this.Headers = new NameValueCollection();
+ this.Cookies = new Dictionary<string, Cookie>();
+ this.FormData = new NameValueCollection();
+ this.QueryString = new NameValueCollection();
+ this.Items = new Dictionary<string, object>();
}
public HttpRequestMock(string operationName, string httpMethod,
@@ -24,91 +24,91 @@ public HttpRequestMock()
: this()
{
this.OperationName = operationName;
- this.HttpMethod = httpMethod;
- this.ContentType = contentType;
+ this.HttpMethod = httpMethod;
+ this.ContentType = contentType;
this.PathInfo = pathInfo;
this.QueryString = queryString;
this.FormData = formData;
this.InputStream = inputStream;
- }
-
- public object OriginalRequest
- {
- get { return null; }
- }
-
- public T TryResolve<T>()
- {
- return EndpointHost.AppHost.TryResolve<T>();
- }
-
+ }
+
+ public object OriginalRequest
+ {
+ get { return null; }
+ }
+
+ public T TryResolve<T>()
+ {
+ return EndpointHost.AppHost.TryResolve<T>();
+ }
+
public string OperationName { get; set; }
public string ContentType { get; set; }
- public string HttpMethod { get; set; }
- public string UserAgent { get; set; }
-
- public IDictionary<string, Cookie> Cookies { get; set; }
-
- private string responseContentType;
- public string ResponseContentType
- {
- get { return responseContentType ?? this.ContentType ?? Common.Web.ContentType.Json; }
- set { responseContentType = value; }
- }
-
- public NameValueCollection Headers { get; set; }
-
+ public string HttpMethod { get; set; }
+ public string UserAgent { get; set; }
+
+ public IDictionary<string, Cookie> Cookies { get; set; }
+
+ private string responseContentType;
+ public string ResponseContentType
+ {
+ get { return responseContentType ?? this.ContentType ?? Common.Web.ContentType.Json; }
+ set { responseContentType = value; }
+ }
+
+ public NameValueCollection Headers { get; set; }
+
public NameValueCollection QueryString { get; set; }
- public NameValueCollection FormData { get; set; }
-
- public Dictionary<string, object> Items
- {
- get; private set;
- }
-
+ public NameValueCollection FormData { get; set; }
+
+ public Dictionary<string, object> Items
+ {
+ get; private set;
+ }
+
private string rawBody;
public string GetRawBody()
- {
+ {
if (rawBody != null) return rawBody;
- if (InputStream == null) return null;
-
- //Keep the stream alive in-case it needs to be read twice (i.e. ContentLength)
- rawBody = new StreamReader(InputStream).ReadToEnd();
- InputStream.Position = 0;
- return rawBody;
+ if (InputStream == null) return null;
+
+ //Keep the stream alive in-case it needs to be read twice (i.e. ContentLength)
+ rawBody = new StreamReader(InputStream).ReadToEnd();
+ InputStream.Position = 0;
+ return rawBody;
+ }
+
+ public string RawUrl { get; set; }
+
+ public string AbsoluteUri
+ {
+ get { return "http://localhost" + this.PathInfo; }
}
- public string RawUrl { get; set; }
-
- public string AbsoluteUri
- {
- get { return "http://localhost" + this.PathInfo; }
- }
-
- public string UserHostAddress { get; set; }
-
- public string RemoteIp { get; set; }
-
+ public string UserHostAddress { get; set; }
+
+ public string RemoteIp { get; set; }
+
public bool IsSecureConnection { get; set; }
public string[] AcceptTypes { get; set; }
public string PathInfo { get; set; }
- public Stream InputStream { get; set; }
-
- public long ContentLength
- {
- get
- {
- var body = GetRawBody();
- return body != null ? body.Length : 0;
- }
- }
-
- public IFile[] Files { get; set; }
-
- public string ApplicationFilePath
- {
- get { throw new NotImplementedException(); }
- }
- }
+ public Stream InputStream { get; set; }
+
+ public long ContentLength
+ {
+ get
+ {
+ var body = GetRawBody();
+ return body != null ? body.Length : 0;
+ }
+ }
+
+ public IFile[] Files { get; set; }
+
+ public string ApplicationFilePath
+ {
+ get { throw new NotImplementedException(); }
+ }
+ }
}
236 src/ServiceStack/WebHost.Endpoints/Support/Mocks/HttpResponseMock.cs
View
@@ -1,119 +1,119 @@
-using System;
-using System.Collections.Specialized;
-using System.IO;
-using System.Text;
-using ServiceStack.Common.Web;
-using ServiceStack.ServiceHost;
-
-namespace ServiceStack.WebHost.Endpoints.Tests.Mocks
-{
- public class HttpResponseMock
- : IHttpResponse
- {
- public HttpResponseMock()
- {
- this.Headers = new NameValueCollection();
- this.OutputStream = new MemoryStream();
- this.TextWritten = new StringBuilder();
- this.Cookies = new Cookies(this);
- }
-
- public object OriginalResponse
- {
- get { return null; }
- }
-
- public string GetOutputStreamAsString()
- {
- this.OutputStream.Seek(0, SeekOrigin.Begin);
- using (var reader = new StreamReader(this.OutputStream))
- {
- return reader.ReadToEnd();
- }
- }
-
- public byte[] GetOutputStreamAsBytes()
- {
- var ms = (MemoryStream)this.OutputStream;
- return ms.ToArray();
- }
-
- public StringBuilder TextWritten
- {
- get;
- set;
- }
-
- public int StatusCode { get; set; }
-
- private string statusDescription = string.Empty;
- public string StatusDescription
- {
- get
- {
- return statusDescription;
- }
- set
- {
- statusDescription = value;
- }
- }
-
- public string ContentType
- {
- get;
- set;
- }
-
- public NameValueCollection Headers
- {
- get;
- private set;
- }
-
- public ICookies Cookies { get; set; }
-
- public void AddHeader(string name, string value)
- {
- this.Headers.Add(name, value);
- }
-
- public void Redirect(string url)
- {
- this.Headers.Add(HttpHeaders.Location, url.MapServerPath());
- }
-
- public Stream OutputStream
- {
- get;
- private set;
- }
-
- public void Write(string text)
- {
- this.TextWritten.Append(text);
- }
-
- public void Close()
- {
- this.IsClosed = true;
- OutputStream.Position = 0;
- }
-
- public void End()
- {
- Close();
- }
-
- public void Flush()
- {
- OutputStream.Flush();
- }
-
- public bool IsClosed
- {
- get;
- private set;
- }
- }
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using ServiceStack.Common.Web;
+using ServiceStack.ServiceHost;
+
+namespace ServiceStack.WebHost.Endpoints.Tests.Mocks
+{
+ public class HttpResponseMock
+ : IHttpResponse
+ {
+ public HttpResponseMock()
+ {
+ this.Headers = new NameValueCollection();
+ this.OutputStream = new MemoryStream();
+ this.TextWritten = new StringBuilder();
+ this.Cookies = new Cookies(this);
+ }
+
+ public object OriginalResponse
+ {
+ get { return null; }
+ }
+
+ public string GetOutputStreamAsString()
+ {
+ this.OutputStream.Seek(0, SeekOrigin.Begin);
+ using (var reader = new StreamReader(this.OutputStream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
+
+ public byte[] GetOutputStreamAsBytes()
+ {
+ var ms = (MemoryStream)this.OutputStream;
+ return ms.ToArray();
+ }
+
+ public StringBuilder TextWritten
+ {
+ get;
+ set;
+ }
+
+ public int StatusCode { get; set; }
+
+ private string statusDescription = string.Empty;
+ public string StatusDescription
+ {
+ get
+ {
+ return statusDescription;
+ }
+ set
+ {
+ statusDescription = value;
+ }
+ }
+
+ public string ContentType
+ {
+ get;
+ set;
+ }
+
+ public NameValueCollection Headers
+ {
+ get;
+ private set;
+ }
+
+ public ICookies Cookies { get; set; }
+
+ public void AddHeader(string name, string value)
+ {
+ this.Headers.Add(name, value);
+ }
+
+ public void Redirect(string url)
+ {
+ this.Headers.Add(HttpHeaders.Location, url.MapServerPath());
+ }
+
+ public Stream OutputStream
+ {
+ get;
+ private set;
+ }
+
+ public void Write(string text)
+ {
+ this.TextWritten.Append(text);
+ }
+
+ public void Close()
+ {
+ this.IsClosed = true;
+ OutputStream.Position = 0;
+ }
+
+ public void End()
+ {
+ Close();
+ }
+
+ public void Flush()
+ {
+ OutputStream.Flush();
+ }
+
+ public bool IsClosed
+ {
+ get;
+ private set;
+ }
+ }
}
188 src/ServiceStack/WebHost.Endpoints/Support/RedirectHttpHandler.cs
View
@@ -1,95 +1,95 @@
-using System;
-using System.Net;
-using System.Web;
-using ServiceStack.Common;
-using ServiceStack.Common.Web;
-using ServiceStack.ServiceHost;
-using ServiceStack.Text;
-using ServiceStack.WebHost.Endpoints.Extensions;
-
-namespace ServiceStack.WebHost.Endpoints.Support
-{
- public class RedirectHttpHandler
- : IServiceStackHttpHandler, IHttpHandler
- {
- public string RelativeUrl { get; set; }
-
- public string AbsoluteUrl { get; set; }
-
- /// <summary>
- /// Non ASP.NET requests
- /// </summary>
- /// <param name="request"></param>
- /// <param name="response"></param>
- /// <param name="operationName"></param>
- public void ProcessRequest(IHttpRequest request, IHttpResponse response, string operationName)
- {
- if (string.IsNullOrEmpty(RelativeUrl) && string.IsNullOrEmpty(AbsoluteUrl))
- throw new ArgumentNullException("RelativeUrl or AbsoluteUrl");
-
- if (!string.IsNullOrEmpty(AbsoluteUrl))
- {
- response.StatusCode = (int)HttpStatusCode.Redirect;
- response.AddHeader(HttpHeaders.Location, this.AbsoluteUrl);
- }
- else
- {
- var absoluteUrl = request.GetApplicationUrl();
- if (!string.IsNullOrEmpty(RelativeUrl))
- {
- if (this.RelativeUrl.StartsWith("/"))
- absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl);
- else if (this.RelativeUrl.StartsWith("~/"))
- absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl.Replace("~/", ""));
- else
- absoluteUrl = request.AbsoluteUri.CombineWith(this.RelativeUrl);
- }
- response.StatusCode = (int)HttpStatusCode.Redirect;
- response.AddHeader(HttpHeaders.Location, absoluteUrl);
- }
-
- response.EndHttpRequest(skipClose:true);
- }
-
- /// <summary>
- /// ASP.NET requests
- /// </summary>
- /// <param name="context"></param>
- public void ProcessRequest(HttpContext context)
- {
- var request = context.Request;
- var response = context.Response;
-
- if (string.IsNullOrEmpty(RelativeUrl) && string.IsNullOrEmpty(AbsoluteUrl))
- throw new ArgumentNullException("RelativeUrl or AbsoluteUrl");
-
- if (!string.IsNullOrEmpty(AbsoluteUrl))
- {
- response.StatusCode = (int)HttpStatusCode.Redirect;
- response.AddHeader(HttpHeaders.Location, this.AbsoluteUrl);
- }
- else
- {
- var absoluteUrl = request.GetApplicationUrl();
- if (!string.IsNullOrEmpty(RelativeUrl))
- {
- if (this.RelativeUrl.StartsWith("/"))
- absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl);
- else if (this.RelativeUrl.StartsWith("~/"))
- absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl.Replace("~/", ""));
- else
- absoluteUrl = request.Url.AbsoluteUri.CombineWith(this.RelativeUrl);
- }
- response.StatusCode = (int)HttpStatusCode.Redirect;
- response.AddHeader(HttpHeaders.Location, absoluteUrl);
- }
-
- response.EndHttpRequest(closeOutputStream:true);
- }
-
- public bool IsReusable
- {
- get { return true; }
- }
- }
+using System;
+using System.Net;
+using System.Web;
+using ServiceStack.Common;
+using ServiceStack.Common.Web;
+using ServiceStack.ServiceHost;
+using ServiceStack.Text;
+using ServiceStack.WebHost.Endpoints.Extensions;
+
+namespace ServiceStack.WebHost.Endpoints.Support
+{
+ public class RedirectHttpHandler
+ : IServiceStackHttpHandler, IHttpHandler
+ {
+ public string RelativeUrl { get; set; }
+
+ public string AbsoluteUrl { get; set; }
+
+ /// <summary>
+ /// Non ASP.NET requests
+ /// </summary>
+ /// <param name="request"></param>
+ /// <param name="response"></param>
+ /// <param name="operationName"></param>
+ public void ProcessRequest(IHttpRequest request, IHttpResponse response, string operationName)
+ {
+ if (string.IsNullOrEmpty(RelativeUrl) && string.IsNullOrEmpty(AbsoluteUrl))
+ throw new ArgumentNullException("RelativeUrl or AbsoluteUrl");
+
+ if (!string.IsNullOrEmpty(AbsoluteUrl))
+ {
+ response.StatusCode = (int)HttpStatusCode.Redirect;
+ response.AddHeader(HttpHeaders.Location, this.AbsoluteUrl);
+ }
+ else
+ {
+ var absoluteUrl = request.GetApplicationUrl();
+ if (!string.IsNullOrEmpty(RelativeUrl))
+ {
+ if (this.RelativeUrl.StartsWith("/"))
+ absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl);
+ else if (this.RelativeUrl.StartsWith("~/"))
+ absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl.Replace("~/", ""));
+ else
+ absoluteUrl = request.AbsoluteUri.CombineWith(this.RelativeUrl);
+ }
+ response.StatusCode = (int)HttpStatusCode.Redirect;
+ response.AddHeader(HttpHeaders.Location, absoluteUrl);
+ }
+
+ response.EndHttpRequest(skipClose:true);
+ }
+
+ /// <summary>
+ /// ASP.NET requests
+ /// </summary>
+ /// <param name="context"></param>
+ public void ProcessRequest(HttpContext context)
+ {
+ var request = context.Request;
+ var response = context.Response;
+
+ if (string.IsNullOrEmpty(RelativeUrl) && string.IsNullOrEmpty(AbsoluteUrl))
+ throw new ArgumentNullException("RelativeUrl or AbsoluteUrl");
+
+ if (!string.IsNullOrEmpty(AbsoluteUrl))
+ {
+ response.StatusCode = (int)HttpStatusCode.Redirect;
+ response.AddHeader(HttpHeaders.Location, this.AbsoluteUrl);
+ }
+ else
+ {
+ var absoluteUrl = request.GetApplicationUrl();
+ if (!string.IsNullOrEmpty(RelativeUrl))
+ {
+ if (this.RelativeUrl.StartsWith("/"))
+ absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl);
+ else if (this.RelativeUrl.StartsWith("~/"))
+ absoluteUrl = absoluteUrl.CombineWith(this.RelativeUrl.Replace("~/", ""));
+ else
+ absoluteUrl = request.Url.AbsoluteUri.CombineWith(this.RelativeUrl);
+ }
+ response.StatusCode = (int)HttpStatusCode.Redirect;
+ response.AddHeader(HttpHeaders.Location, absoluteUrl);
+ }
+
+ response.EndHttpRequest(closeOutputStream:true);
+ }
+
+ public bool IsReusable
+ {
+ get { return true; }
+ }
+ }
}
348 src/ServiceStack/WebHost.Endpoints/Support/RequestInfoHandler.cs
View
@@ -1,175 +1,175 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Net;
-using System.Runtime.Serialization;
-using System.Web;
-using ServiceStack.Common.Web;
-using ServiceStack.ServiceHost;
-using ServiceStack.Text;
-using ServiceStack.WebHost.Endpoints.Extensions;
-
-namespace ServiceStack.WebHost.Endpoints.Support
-{
- [DataContract]
- public class RequestInfo { }
-
- [DataContract]
- public class RequestInfoResponse
- {
- [DataMember]
- public string Host { get; set; }
-
- [DataMember]
- public DateTime Date { get; set; }
-
- [DataMember]
- public string ServiceName { get; set; }
-
- [DataMember]
- public string HandlerPath { get; set; }
-
- [DataMember]
- public string UserHostAddress { get; set; }
-
- [DataMember]
- public string HttpMethod { get; set; }
-
- [DataMember]
- public string PathInfo { get; set; }
-
- [DataMember]
- public string ResolvedPathInfo { get; set; }
-
- [DataMember]
- public string Path { get; set; }
-
- [DataMember]
- public string AbsoluteUri { get; set; }
-
- [DataMember]
- public string ApplicationPath { get; set; }
-
- [DataMember]
- public string HandlerFactoryArgs { get; set; }
-
- [DataMember]
- public string RawUrl { get; set; }
-
- [DataMember]
- public string Url { get; set; }
-
- [DataMember]
- public string ContentType { get; set; }
-
- [DataMember]
- public int Status { get; set; }
-
- [DataMember]
- public long ContentLength { get; set; }
-
- [DataMember]
- public Dictionary<string, string> Headers { get; set; }
-
- [DataMember]
- public Dictionary<string, string> QueryString { get; set; }
-
- [DataMember]
- public Dictionary<string, string> FormData { get; set; }
-
- [DataMember]
- public List<string> AcceptTypes { get; set; }
-
- [DataMember]
- public string OperationName { get; set; }
-
- [DataMember]
- public string ResponseContentType { get; set; }
-
- [DataMember]
- public string ErrorCode { get; set; }
-
- [DataMember]
- public string ErrorMessage { get; set; }
-
- [DataMember]
- public string DebugString { get; set; }
- }
-
- public class RequestInfoHandler
- : IServiceStackHttpHandler, IHttpHandler
- {
- public const string RestPath = "_requestinfo";
-
- public RequestInfoResponse RequestInfo { get; set; }
-
- public void ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
- {
- var response = this.RequestInfo ?? GetRequestInfo(httpReq);
- response.HandlerFactoryArgs = ServiceStackHttpHandlerFactory.DebugLastHandlerArgs;
- response.DebugString = "";
- if (HttpContext.Current != null)
- {
- response.DebugString += HttpContext.Current.Request.GetType().FullName
- + "|" + HttpContext.Current.Response.GetType().FullName;
- }
-
- var json = JsonSerializer.SerializeToString(response);
- httpRes.ContentType = ContentType.Json;
- httpRes.Write(json);
- }
-
- public void ProcessRequest(HttpContext context)
- {
- ProcessRequest(
- new HttpRequestWrapper(typeof(RequestInfo).Name, context.Request),
- new HttpResponseWrapper(context.Response),
- typeof(RequestInfo).Name);
- }
-
- public static Dictionary<string, string> ToDictionary(NameValueCollection nvc)
- {
- var map = new Dictionary<string, string>();
- for (var i = 0; i < nvc.Count; i++)
- {
- map[nvc.GetKey(i)] = nvc.Get(i);
- }
- return map;
- }
-
- public static string ToString(NameValueCollection nvc)
- {
- var map = ToDictionary(nvc);
- return TypeSerializer.SerializeToString(map);
- }
-
- public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
- {
- var response = new RequestInfoResponse
- {
- Host = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.ServiceStackVersion + "_" + EndpointHost.Config.ServiceName,
- Date = DateTime.UtcNow,
- ServiceName = EndpointHost.Config.ServiceName,
- UserHostAddress = httpReq.UserHostAddress,
- HttpMethod = httpReq.HttpMethod,
- AbsoluteUri = httpReq.AbsoluteUri,
- RawUrl = httpReq.RawUrl,
- ResolvedPathInfo = httpReq.PathInfo,
- ContentType = httpReq.ContentType,
- Headers = ToDictionary(httpReq.Headers),
- QueryString = ToDictionary(httpReq.QueryString),
- FormData = ToDictionary(httpReq.FormData),
- AcceptTypes = new List<string>(httpReq.AcceptTypes ?? new string[0]),
- ContentLength = httpReq.ContentLength,
- OperationName = httpReq.OperationName,
- ResponseContentType = httpReq.ResponseContentType,
- };
- return response;
- }
-
- public bool IsReusable
- {
- get { return false; }
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Net;
+using System.Runtime.Serialization;
+using System.Web;
+using ServiceStack.Common.Web;
+using ServiceStack.ServiceHost;
+using ServiceStack.Text;
+using ServiceStack.WebHost.Endpoints.Extensions;
+
+namespace ServiceStack.WebHost.Endpoints.Support
+{
+ [DataContract]
+ public class RequestInfo { }
+
+ [DataContract]
+ public class RequestInfoResponse
+ {
+ [DataMember]
+ public string Host { get; set; }
+
+ [DataMember]
+ public DateTime Date { get; set; }
+
+ [DataMember]
+ public string ServiceName { get; set; }
+
+ [DataMember]
+ public string HandlerPath { get; set; }
+
+ [DataMember]
+ public string UserHostAddress { get; set; }
+
+ [DataMember]
+ public string HttpMethod { get; set; }
+
+ [DataMember]
+ public string PathInfo { get; set; }
+
+ [DataMember]
+ public string ResolvedPathInfo { get; set; }
+
+ [DataMember]
+ public string Path { get; set; }
+
+ [DataMember]
+ public string AbsoluteUri { get; set; }
+
+ [DataMember]
+ public string ApplicationPath { get; set; }
+
+ [DataMember]
+ public string HandlerFactoryArgs { get; set; }
+
+ [DataMember]
+ public string RawUrl { get; set; }
+
+ [DataMember]
+ public string Url { get; set; }
+
+ [DataMember]
+ public string ContentType { get; set; }
+
+ [DataMember]
+ public int Status { get; set; }
+
+ [DataMember]
+ public long ContentLength { get; set; }
+
+ [DataMember]
+ public Dictionary<string, string> Headers { get; set; }
+
+ [DataMember]
+ public Dictionary<string, string> QueryString { get; set; }
+
+ [DataMember]
+ public Dictionary<string, string> FormData { get; set; }
+
+ [DataMember]
+ public List<string> AcceptTypes { get; set; }
+
+ [DataMember]
+ public string OperationName { get; set; }
+
+ [DataMember]
+ public string ResponseContentType { get; set; }
+
+ [DataMember]
+ public string ErrorCode { get; set; }
+
+ [DataMember]
+ public string ErrorMessage { get; set; }
+
+ [DataMember]
+ public string DebugString { get; set; }
+ }
+
+ public class RequestInfoHandler
+ : IServiceStackHttpHandler, IHttpHandler
+ {
+ public const string RestPath = "_requestinfo";
+
+ public RequestInfoResponse RequestInfo { get; set; }
+
+ public void ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
+ {
+ var response = this.RequestInfo ?? GetRequestInfo(httpReq);
+ response.HandlerFactoryArgs = ServiceStackHttpHandlerFactory.DebugLastHandlerArgs;
+ response.DebugString = "";
+ if (HttpContext.Current != null)
+ {
+ response.DebugString += HttpContext.Current.Request.GetType().FullName
+ + "|" + HttpContext.Current.Response.GetType().FullName;
+ }
+
+ var json = JsonSerializer.SerializeToString(response);
+ httpRes.ContentType = ContentType.Json;
+ httpRes.Write(json);
+ }
+
+ public void ProcessRequest(HttpContext context)
+ {
+ ProcessRequest(
+ new HttpRequestWrapper(typeof(RequestInfo).Name, context.Request),
+ new HttpResponseWrapper(context.Response),
+ typeof(RequestInfo).Name);
+ }
+
+ public static Dictionary<string, string> ToDictionary(NameValueCollection nvc)
+ {
+ var map = new Dictionary<string, string>();
+ for (var i = 0; i < nvc.Count; i++)
+ {
+ map[nvc.GetKey(i)] = nvc.Get(i);
+ }
+ return map;
+ }
+
+ public static string ToString(NameValueCollection nvc)
+ {
+ var map = ToDictionary(nvc);
+ return TypeSerializer.SerializeToString(map);
+ }
+
+ public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
+ {
+ var response = new RequestInfoResponse
+ {
+ Host = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.ServiceStackVersion + "_" + EndpointHost.Config.ServiceName,
+ Date = DateTime.UtcNow,
+ ServiceName = EndpointHost.Config.ServiceName,
+ UserHostAddress = httpReq.UserHostAddress,
+ HttpMethod = httpReq.HttpMethod,
+ AbsoluteUri = httpReq.AbsoluteUri,
+ RawUrl = httpReq.RawUrl,
+ ResolvedPathInfo = httpReq.PathInfo,
+ ContentType = httpReq.ContentType,
+ Headers = ToDictionary(httpReq.Headers),
+ QueryString = ToDictionary(httpReq.QueryString),
+ FormData = ToDictionary(httpReq.FormData),
+ AcceptTypes = new List<string>(httpReq.AcceptTypes ?? new string[0]),
+ ContentLength = httpReq.ContentLength,
+ OperationName = httpReq.OperationName,
+ ResponseContentType = httpReq.ResponseContentType,
+ };
+ return response;
+ }
+
+ public bool IsReusable
+ {
+ get { return false; }
+ }
+ }
}
430 src/ServiceStack/WebHost.Endpoints/Support/SoapHandler.cs
View
@@ -1,216 +1,216 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.ServiceModel.Channels;
-using System.Web;
-using System.Xml;
-using ServiceStack.Common.Web;
-using ServiceStack.ServiceClient.Web;
-using ServiceStack.ServiceHost;
-using ServiceStack.ServiceModel.Serialization;
-using ServiceStack.Text;
-using ServiceStack.WebHost.Endpoints.Extensions;
-using ServiceStack.WebHost.Endpoints.Utils;
-
-namespace ServiceStack.WebHost.Endpoints.Support
-{
- public class SoapHandler : EndpointHandlerBase, IOneWay, ISyncReply
- {
- public SoapHandler(EndpointAttributes soapType)
- {
- this.HandlerAttributes = soapType;
- }
-
- public void SendOneWay(Message requestMsg)
- {
- var endpointAttributes = EndpointAttributes.AsyncOneWay | this.HandlerAttributes;
-
- ExecuteMessage(requestMsg, endpointAttributes);
- }
-
- public Message Send(Message requestMsg)
- {
- var endpointAttributes = EndpointAttributes.SyncReply | this.HandlerAttributes;
-
- return ExecuteMessage(requestMsg, endpointAttributes);
- }
-
- public Message EmptyResponse(Message requestMsg, Type requestType)
- {
- var responseType = AssemblyUtils.FindType(requestType.FullName + "Response");
- var response = (responseType ?? typeof(object)).CreateInstance();
-
- return requestMsg.Headers.Action == null
- ? Message.CreateMessage(requestMsg.Version, null, response)
- : Message.CreateMessage(requestMsg.Version, requestType.Name + "Response", response);
- }
-
- protected Message ExecuteMessage(Message requestMsg, EndpointAttributes endpointAttributes)
- {
- if ((EndpointAttributes.Soap11 & this.HandlerAttributes) == EndpointAttributes.Soap11)
- EndpointHost.Config.AssertFeatures(Feature.Soap11);
- else if ((EndpointAttributes.Soap12 & this.HandlerAttributes) == EndpointAttributes.Soap12)
- EndpointHost.Config.AssertFeatures(Feature.Soap12);
-
- string requestXml;
- using (var reader = requestMsg.GetReaderAtBodyContents())
- {
- requestXml = reader.ReadOuterXml();
- }
-
- var requestType = GetRequestType(requestMsg, requestXml);
- try
- {
- var request = DataContractDeserializer.Instance.Parse(requestXml, requestType);
- var requiresSoapMessage = request as IRequiresSoapMessage;
- if (requiresSoapMessage != null)
- {
- requiresSoapMessage.Message = requestMsg;
- }
-
- var httpReq = HttpContext.Current != null
- ? new HttpRequestWrapper(requestType.Name, HttpContext.Current.Request)
- : null;
- var httpRes = HttpContext.Current != null
- ? new HttpResponseWrapper(HttpContext.Current.Response)
- : null;
-
- if (EndpointHost.ApplyPreRequestFilters(httpReq, httpRes))
- return EmptyResponse(requestMsg, requestType);
-
- var hasRequestFilters = EndpointHost.RequestFilters.Count > 0
- || FilterAttributeCache.GetRequestFilterAttributes(request.GetType()).Any();
-
- if (hasRequestFilters && EndpointHost.ApplyRequestFilters(httpReq, httpRes, request))
- return EmptyResponse(requestMsg, requestType);
-
- var response = ExecuteService(request, endpointAttributes, httpReq, httpRes);
-
- var hasResponseFilters = EndpointHost.ResponseFilters.Count > 0
- || FilterAttributeCache.GetResponseFilterAttributes(response.GetType()).Any();
-
- if (hasResponseFilters && EndpointHost.ApplyResponseFilters(httpReq, httpRes, response))
- return EmptyResponse(requestMsg, requestType);
-
- var httpResult = response as IHttpResult;
- if (httpResult != null)
- response = httpResult.Response;
-
- return requestMsg.Headers.Action == null
- ? Message.CreateMessage(requestMsg.Version, null, response)
- : Message.CreateMessage(requestMsg.Version, requestType.Name + "Response", response);
- }
- catch (Exception ex)
- {
- throw new SerializationException("3) Error trying to deserialize requestType: "
- + requestType
- + ", xml body: " + requestXml, ex);
- }
- }
-
- protected static Message GetSoap12RequestMessage(HttpContext context)
- {
- return GetRequestMessage(context, MessageVersion.Soap12WSAddressingAugust2004);
- }
-
- protected static Message GetSoap11RequestMessage(HttpContext context)
- {
- return GetRequestMessage(context, MessageVersion.Soap11WSAddressingAugust2004);
- }
-
- protected static Message GetRequestMessage(HttpContext context, MessageVersion msgVersion)
- {
- using (var sr = new StreamReader(context.Request.InputStream))
- {
- var requestXml = sr.ReadToEnd();
-
- var doc = new XmlDocument();
- doc.LoadXml(requestXml);
-
- var msg = Message.CreateMessage(new XmlNodeReader(doc), int.MaxValue,
- msgVersion);
-