fixed SPRNET-1018

This commit is contained in:
eeichinger
2009-03-04 21:42:08 +00:00
parent b50390f7cb
commit be16181bdb
4 changed files with 47 additions and 6 deletions

View File

@@ -2501,15 +2501,19 @@ private void SetLanguage(object sender, CommandEventArgs e)
<itemizedlist>
<listitem>
<para>redirect</para>
<para><literal>redirect</literal>: calls Response.Redirect(string)</para>
</listitem>
<listitem>
<para>transfer</para>
<para><literal>redirectNoAbort</literal>: calls Response.Redirect(string, false)</para>
</listitem>
<listitem>
<para>TransferNoPreserve</para>
<para><literal>transfer</literal>: calls Server.Transfer(string)</para>
</listitem>
<listitem>
<para><literal>TransferNoPreserve</literal>: calls Server.Transfer(string, false)</para>
</listitem>
</itemizedlist>

View File

@@ -227,13 +227,21 @@ namespace Spring.Web.Support
}
/// <summary>
/// Indicates, if <see cref="HttpServerUtility.Transfer(string,bool)"/> should be called with preserverForm='true' | 'false'. Only relevant for ResultMode.TransferXXXX modes.
/// Indicates, if <see cref="HttpServerUtility.Transfer(string,bool)"/> should be called with preserveForm='true' | 'false'. Only relevant for ResultMode.TransferXXXX modes.
/// </summary>
public bool PreserveForm
{
get { return (Mode == ResultMode.Transfer); }
}
/// <summary>
/// Indicates, if <see cref="HttpServerUtility.Redirect(string,bool)"/> should be called with endResponse='true' | 'false'. Only relevant for ResultMode.RedirectXXXX modes.
/// </summary>
public bool EndResponse
{
get { return (Mode == ResultMode.Redirect); }
}
#endregion
/// <summary>
@@ -249,6 +257,7 @@ namespace Spring.Web.Support
switch (Mode)
{
case ResultMode.Redirect:
case ResultMode.RedirectNoAbort:
DoRedirect( context );
break;
case ResultMode.Transfer:
@@ -312,7 +321,7 @@ namespace Spring.Web.Support
/// <seealso cref="System.Web.HttpResponse.Redirect(string)"/>
protected virtual void DoRedirect( object context )
{
HttpContext.Current.Response.Redirect( GetRedirectUri( context ) );
HttpContext.Current.Response.Redirect( GetRedirectUri( context ), EndResponse );
}
/// <summary>

View File

@@ -68,6 +68,19 @@ namespace Spring.Web.Support
/// </p>
/// </remarks>
/// <seealso cref="System.Web.HttpServerUtility.Transfer(string,bool)"/>
TransferNoPreserve = 2
TransferNoPreserve = 2,
/// <summary>
/// A redirect.
/// </summary>
/// <remarks>
/// <p>
/// Issues a redirect (to the user-agent - typically a browser) using
/// the <see cref="System.Web.HttpResponse.Redirect(string, bool)"/> method.
/// </p>
/// </remarks>
/// <seealso cref="System.Web.HttpResponse.Redirect(string, bool)"/>
RedirectNoAbort = 3
}
}

View File

@@ -140,6 +140,21 @@ namespace Spring.Web.Support
Result result = new Result("redirect:" + ExpectedTargetPageName);
Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " +
"from the result string passed into the ctor.");
Assert.IsTrue(result.EndResponse);
Assert.IsNull(result.Parameters,
"No parameters were passed but the Parameters property appears to be set to a non-null value anyway.");
Assert.AreEqual(ExpectedTargetPageName, result.TargetPage,
"The TargetPage property is not being correctly extracted " +
"from the result string passed into the ctor.");
}
[Test]
public void WithRedirectNoAbortResultMode()
{
Result result = new Result("redirectnoabort:" + ExpectedTargetPageName);
Assert.AreEqual(ResultMode.RedirectNoAbort, result.Mode, "Not extracting the correct ResultMode " +
"from the result string passed into the ctor.");
Assert.IsFalse(result.EndResponse);
Assert.IsNull(result.Parameters,
"No parameters were passed but the Parameters property appears to be set to a non-null value anyway.");
Assert.AreEqual(ExpectedTargetPageName, result.TargetPage,