/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.IO;
using System.Web;
namespace Everest.CmsServices.Extension.Module{
/// <summary>
///
/// </summary>
public class ModuleHttpResponse : HttpResponseWrapper
{
private string wrapperControlId;
private TextWriter _output;
/// <summary>
/// Initializes a new instance of the <see cref="ModuleHttpResponse"/> class.
/// </summary>
/// <param name="httpResponse">The HTTP response.</param>
/// <param name="output">The output.</param>
public ModuleHttpResponse(HttpResponse httpResponse, string wrapperControlId)
: base(httpResponse)
{
this.wrapperControlId = wrapperControlId;
}
/// <summary>
/// Gets the output.
/// </summary>
/// <value>The output.</value>
public override TextWriter Output
{
get
{
return _output;
}
}
/// <summary>
/// Sets the output.
/// </summary>
/// <param name="textWriter">The text writer.</param>
public void SetOutput(TextWriter textWriter)
{
this._output = textWriter;
}
/// <summary>
/// Applies the app path modifier.
/// </summary>
/// <param name="virtualPath">The virtual path.</param>
/// <returns></returns>
public override string ApplyAppPathModifier(string virtualPath)
{
var removedApplicationPath = virtualPath;
var applicationPath = ModuleRequestContext.HttpContext.Request.ApplicationPath;
if (applicationPath != "/")
{
removedApplicationPath = virtualPath.Replace(applicationPath, "");
}
return ModuleRequestContext.ModuleUrlConvertor.ToPageUrl(ModuleRequestContext.ParentPageContext.UrlHelper
, ModuleRequestContext.PageRouteData, wrapperControlId, HttpUtility.UrlDecode(removedApplicationPath));
}
public ModuleRequestContext ModuleRequestContext { get; set; }
}
}
|