summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Core')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs18
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/ProtocolFaultResponseException.cs18
-rw-r--r--src/DotNetOpenAuth.Core/Strings.Designer.cs20
-rw-r--r--src/DotNetOpenAuth.Core/Strings.resx10
4 files changed, 49 insertions, 17 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
index 67eccce..9ef89e9 100644
--- a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
@@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Messaging {
using System.IO;
using System.Net;
using System.Net.Mime;
+ using System.ServiceModel.Web;
using System.Text;
using System.Threading;
using System.Web;
@@ -213,6 +214,23 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Submits this response to a WCF response context. Only available when no response body is included.
+ /// </summary>
+ /// <param name="responseContext">The response context to apply the response to.</param>
+ public virtual void Respond(OutgoingWebResponseContext responseContext) {
+ Requires.NotNull(responseContext, "responseContext");
+ if (this.ResponseStream != null) {
+ throw new NotSupportedException(Strings.ResponseBodyNotSupported);
+ }
+
+ responseContext.StatusCode = this.Status;
+ responseContext.SuppressEntityBody = true;
+ foreach (string header in this.Headers) {
+ responseContext.Headers[header] = this.Headers[header];
+ }
+ }
+
+ /// <summary>
/// Automatically sends the appropriate response to the user agent.
/// </summary>
/// <param name="response">The response to set to this message.</param>
diff --git a/src/DotNetOpenAuth.Core/Messaging/ProtocolFaultResponseException.cs b/src/DotNetOpenAuth.Core/Messaging/ProtocolFaultResponseException.cs
index 515414b..f03ebdb 100644
--- a/src/DotNetOpenAuth.Core/Messaging/ProtocolFaultResponseException.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/ProtocolFaultResponseException.cs
@@ -22,11 +22,6 @@ namespace DotNetOpenAuth.Messaging {
private readonly Channel channel;
/// <summary>
- /// A cached value for the <see cref="ErrorResponse"/> property.
- /// </summary>
- private OutgoingWebResponse response;
-
- /// <summary>
/// Initializes a new instance of the <see cref="ProtocolFaultResponseException"/> class
/// such that it can be sent as a protocol message response to a remote caller.
/// </summary>
@@ -63,16 +58,11 @@ namespace DotNetOpenAuth.Messaging {
public IDirectResponseProtocolMessage ErrorResponseMessage { get; private set; }
/// <summary>
- /// Gets the HTTP response to forward to the client to report the error.
+ /// Creates the HTTP response to forward to the client to report the error.
/// </summary>
- public OutgoingWebResponse ErrorResponse {
- get {
- if (this.response == null) {
- this.response = this.channel.PrepareResponse(this.ErrorResponseMessage);
- }
-
- return this.response;
- }
+ public OutgoingWebResponse CreateErrorResponse() {
+ var response = this.channel.PrepareResponse(this.ErrorResponseMessage);
+ return response;
}
}
}
diff --git a/src/DotNetOpenAuth.Core/Strings.Designer.cs b/src/DotNetOpenAuth.Core/Strings.Designer.cs
index 21411a1..b0e66d2 100644
--- a/src/DotNetOpenAuth.Core/Strings.Designer.cs
+++ b/src/DotNetOpenAuth.Core/Strings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.17291
+// Runtime Version:4.0.30319.17622
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -106,6 +106,24 @@ namespace DotNetOpenAuth {
}
/// <summary>
+ /// Looks up a localized string similar to The property {0} must be set before this operation is allowed..
+ /// </summary>
+ internal static string RequiredPropertyNotYetPreset {
+ get {
+ return ResourceManager.GetString("RequiredPropertyNotYetPreset", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This object contains a response body, which is not supported..
+ /// </summary>
+ internal static string ResponseBodyNotSupported {
+ get {
+ return ResourceManager.GetString("ResponseBodyNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to No current HttpContext was detected, so an {0} instance must be explicitly provided or specified in the .config file. Call the constructor overload that takes an {0}..
/// </summary>
internal static string StoreRequiredWhenNoHttpContextAvailable {
diff --git a/src/DotNetOpenAuth.Core/Strings.resx b/src/DotNetOpenAuth.Core/Strings.resx
index 1c69ef7..f4d61d1 100644
--- a/src/DotNetOpenAuth.Core/Strings.resx
+++ b/src/DotNetOpenAuth.Core/Strings.resx
@@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ConfigurationTypeMustBePublic" xml:space="preserve">
<value>The configuration-specified type {0} must be public, and is not.</value>
@@ -135,4 +135,10 @@
<data name="InvalidArgument" xml:space="preserve">
<value>The argument has an unexpected value.</value>
</data>
+ <data name="RequiredPropertyNotYetPreset" xml:space="preserve">
+ <value>The property {0} must be set before this operation is allowed.</value>
+ </data>
+ <data name="ResponseBodyNotSupported" xml:space="preserve">
+ <value>This object contains a response body, which is not supported.</value>
+ </data>
</root> \ No newline at end of file