Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@ -99,7 +99,6 @@ namespace System.Web.UI
internal static List <string> FileDependencies {
get { return dependencies; }
}
#if NET_4_0
internal override Type DefaultBaseType {
get {
Type ret = PageParser.DefaultApplicationBaseType;
@ -109,7 +108,6 @@ namespace System.Web.UI
return ret;
}
}
#endif
internal override string DefaultBaseTypeName {
get { return "System.Web.HttpApplication"; }
}

View File

@ -101,11 +101,9 @@ namespace System.Web.UI
get { return slidingExpiration; }
set { slidingExpiration = value; }
}
#if NET_4_0
internal string ProviderName {
get; set;
}
#endif
internal abstract Control CreateControl ();
public override void Dispose ()
@ -119,15 +117,9 @@ namespace System.Web.UI
void RetrieveCachedContents ()
{
cacheKey = CreateKey ();
#if NET_4_0
OutputCacheProvider provider = GetProvider ();
cachedData = provider.Get (cacheKey) as string;
#else
Cache cache = HttpRuntime.InternalCache;
cachedData = cache [cacheKey] as string;
#endif
}
#if NET_4_0
OutputCacheProvider GetProvider ()
{
string providerName = ProviderName;
@ -161,18 +153,8 @@ namespace System.Web.UI
base.InitRecursive (namingContainer);
}
#else
protected internal override void OnInit (EventArgs e)
{
control = CreateControl ();
Controls.Add (control);
}
#endif
protected internal override void Render (HtmlTextWriter output)
{
#if !NET_4_0
RetrieveCachedContents ();
#endif
if (cachedData != null) {
output.Write (cachedData);
return;
@ -195,19 +177,12 @@ namespace System.Web.UI
context.Response.SetTextWriter (prev);
output.Write (text);
}
#if NET_4_0
OutputCacheProvider provider = GetProvider ();
DateTime utcExpire = DateTime.UtcNow.AddSeconds (duration);
provider.Set (cacheKey, text, utcExpire);;
context.InternalCache.Insert (cacheKey, text, dependency, utcExpire.ToLocalTime (),
Cache.NoSlidingExpiration, CacheItemPriority.Normal,
null);
#else
context.InternalCache.Insert (cacheKey, text, dependency,
DateTime.Now.AddSeconds (duration),
Cache.NoSlidingExpiration,
CacheItemPriority.Normal, null);
#endif
}
public ControlCachePolicy CachePolicy

View File

@ -641,9 +641,7 @@ namespace System.Web.UI
return;
writer.WriteLine ();
#if NET_4_0
writer.AddAttribute (HtmlTextWriterAttribute.Class, "aspNetHidden");
#endif
writer.RenderBeginTag (HtmlTextWriterTag.Div);
int oldIndent = writer.Indent;
writer.Indent = 0;

View File

@ -34,7 +34,6 @@ namespace System.Web.UI
{
sealed class CodeRenderBuilder : CodeBuilder
{
#if NET_4_0
public bool HtmlEncode {
get; private set;
}
@ -44,7 +43,6 @@ namespace System.Web.UI
{
this.HtmlEncode = doHtmlEncode;
}
#endif
public CodeRenderBuilder (string code, bool isAssign, ILocation location)
: base (code, isAssign, location)

View File

@ -49,9 +49,7 @@ using System.Web.UI.Adapters;
using System.Web.UI.WebControls;
using System.Web.Util;
#if NET_4_0
using System.Web.Routing;
#endif
namespace System.Web.UI
{
@ -107,13 +105,11 @@ namespace System.Web.UI
TemplateControl _templateControl;
bool _isChildControlStateCleared;
string _templateSourceDirectory;
#if NET_4_0
ViewStateMode viewStateMode;
ClientIDMode? clientIDMode;
ClientIDMode? effectiveClientIDMode;
Version renderingCompatibility;
bool? renderingCompatibilityOld;
#endif
/*************/
int stateMask;
const int ENABLE_VIEWSTATE = 1;
@ -149,9 +145,7 @@ namespace System.Web.UI
stateMask = ENABLE_VIEWSTATE | VISIBLE | AUTOID | BINDING_CONTAINER | AUTO_EVENT_WIREUP;
if (this is INamingContainer)
stateMask |= IS_NAMING_CONTAINER;
#if NET_4_0
viewStateMode = ViewStateMode.Inherit;
#endif
}
ControlAdapter adapter;
@ -198,9 +192,7 @@ namespace System.Web.UI
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
#if NET_4_0
[Bindable (false)]
#endif
public Control BindingContainer {
get {
Control container = NamingContainer;
@ -218,16 +210,11 @@ namespace System.Web.UI
get {
if (clientID != null)
return clientID;
#if NET_4_0
clientID = GetClientID ();
#else
clientID = UniqueID2ClientID (UniqueID);
#endif
stateMask |= ID_SET;
return clientID;
}
}
#if NET_4_0
[Bindable (false)]
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
@ -455,7 +442,6 @@ namespace System.Web.UI
sb.Append (value.ToString ());
}
}
#endif
internal string UniqueID2ClientID (string uniqueId)
{
if (String.IsNullOrEmpty (uniqueId))
@ -527,11 +513,9 @@ namespace System.Web.UI
for (Control control = this; control != null; control = control.Parent) {
if (!control.EnableViewState)
return false;
#if NET_4_0
ViewStateMode vsm = control.ViewStateMode;
if (vsm != ViewStateMode.Inherit)
return vsm == ViewStateMode.Enabled;
#endif
}
return true;
@ -545,9 +529,7 @@ namespace System.Web.UI
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
[WebSysDescription ("The container that this control is part of. The control's name has to be unique within the container.")]
#if NET_4_0
[Bindable (false)]
#endif
public virtual Control NamingContainer {
get {
if (_namingContainer == null && _parent != null) {
@ -582,9 +564,7 @@ namespace System.Web.UI
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
[WebSysDescription ("The parent control of this control.")]
#if NET_4_0
[Bindable (false)]
#endif
public virtual Control Parent { //DIT
get { return _parent; }
}
@ -599,9 +579,7 @@ namespace System.Web.UI
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
#if NET_4_0
[Bindable (false)]
#endif
public TemplateControl TemplateControl {
get { return TemplateControlInternal; }
@ -619,7 +597,6 @@ namespace System.Web.UI
}
}
#if !TARGET_J2EE
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
[WebSysDescription ("A virtual directory containing the parent of the control.")]
@ -655,7 +632,6 @@ namespace System.Web.UI
return _templateSourceDirectory;
}
}
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
@ -673,10 +649,6 @@ namespace System.Web.UI
string prefix = container.UniqueID;
if (container == Page || prefix == null) {
uniqueID = _userId;
#if TARGET_J2EE
if (getFacesContext () != null)
uniqueID = getFacesContext ().getExternalContext ().encodeNamespace (uniqueID);
#endif
return uniqueID;
}
@ -819,11 +791,7 @@ namespace System.Web.UI
void NullifyUniqueID ()
{
uniqueID = null;
#if NET_4_0
ClearCachedClientID ();
#else
clientID = null;
#endif
if (!HasControls ())
return;
@ -1553,37 +1521,6 @@ namespace System.Web.UI
if (relativeUrl.Length == 0)
return String.Empty;
#if TARGET_J2EE
relativeUrl = ResolveClientUrlInternal (relativeUrl);
javax.faces.context.FacesContext faces = getFacesContext ();
if (faces == null)
return relativeUrl;
string url;
if (relativeUrl.IndexOf (':') >= 0)
url = ResolveAppRelativeFromFullPath (relativeUrl);
else if (VirtualPathUtility.IsAbsolute (relativeUrl))
url = VirtualPathUtility.ToAppRelative (relativeUrl);
else
return faces.getApplication ().getViewHandler ().getResourceURL (faces, relativeUrl);
if (VirtualPathUtility.IsAppRelative (url)) {
url = url.Substring (1);
url = url.Length == 0 ? "/" : url;
return faces.getApplication ().getViewHandler ().getResourceURL (faces, url);
}
return relativeUrl;
}
string ResolveClientUrlInternal (string relativeUrl) {
if (relativeUrl.StartsWith (J2EE.J2EEConsts.ACTION_URL_PREFIX, StringComparison.Ordinal))
return CreateActionUrl (relativeUrl.Substring (J2EE.J2EEConsts.ACTION_URL_PREFIX.Length));
if (relativeUrl.StartsWith (J2EE.J2EEConsts.RENDER_URL_PREFIX, StringComparison.Ordinal))
return ResolveClientUrl (relativeUrl.Substring (J2EE.J2EEConsts.RENDER_URL_PREFIX.Length));
#endif
if (VirtualPathUtility.IsAbsolute (relativeUrl) || relativeUrl.IndexOf (':') >= 0)
return relativeUrl;
@ -1719,11 +1656,7 @@ namespace System.Web.UI
stateMask |= PRERENDERED;
}
#if NET_4_0
internal virtual
#else
internal
#endif
void InitRecursive (Control namingContainer)
{
#if MONO_TRACE
@ -2118,7 +2051,6 @@ namespace System.Web.UI
return false;
}
}
#if NET_4_0
[ThemeableAttribute(false)]
[DefaultValue (ViewStateMode.Inherit)]
public virtual ViewStateMode ViewStateMode {
@ -2184,6 +2116,5 @@ namespace System.Web.UI
return UniqueID.Substring (idx + 1);
}
#endif
}
}

View File

@ -81,7 +81,6 @@ namespace System.Web.UI
bpcc.Duration = value.Minutes;
}
}
#if NET_4_0
public string ProviderName {
get {
AssertBasePartialCachingControl ();
@ -93,7 +92,6 @@ namespace System.Web.UI
bpcc.ProviderName = value;
}
}
#endif
public bool SupportsCaching
{
get {

View File

@ -44,15 +44,6 @@ namespace System.Web.UI
public override void Load ()
{
#if TARGET_J2EE
if (Page.FacesContext != null) {
if (Page.PageState != null) {
ViewState = Page.PageState.First;
ControlState = Page.PageState.Second;
}
return;
}
#endif
string rawViewState = Page.RawViewState;
IStateFormatter formatter = StateFormatter;
if (!String.IsNullOrEmpty (rawViewState)) {
@ -66,13 +57,6 @@ namespace System.Web.UI
public override void Save ()
{
#if TARGET_J2EE
if (Page.FacesContext != null) {
if (ViewState != null || ControlState != null)
Page.PageState = new Pair (ViewState, ControlState);
return;
}
#endif
IStateFormatter formatter = StateFormatter;
Page.RawViewState = formatter.Serialize (new Pair (ViewState, ControlState));
}

View File

@ -1,222 +0,0 @@
//
// System.Web.UI/KeyedList.cs
//
// Author: Todd Berman <tberman@gentoo.org>
//
// (C) 2003 Todd Berman
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Specialized;
namespace System.Web.UI
{
class KeyedList : IOrderedDictionary
#if !NET_4_0
, IStateManager // why do we implement it at all?
#endif
{
Hashtable objectTable = new Hashtable ();
ArrayList objectList = new ArrayList ();
public void Add (object key, object value)
{
objectTable.Add (key, value);
objectList.Add (new DictionaryEntry (key, value));
}
public void Clear ()
{
objectTable.Clear ();
objectList.Clear ();
}
public bool Contains (object key)
{
return objectTable.Contains (key);
}
public void CopyTo (Array array, int idx)
{
objectTable.CopyTo (array, idx);
}
public void Insert (int idx, object key, object value)
{
if (idx > Count)
throw new ArgumentOutOfRangeException ("index");
objectTable.Add (key, value);
objectList.Insert (idx, new DictionaryEntry (key, value));
}
public void Remove (object key)
{
objectTable.Remove (key);
int index = IndexOf (key);
if (index >= 0)
objectList.RemoveAt (index);
}
public void RemoveAt (int idx)
{
if (idx >= Count)
throw new ArgumentOutOfRangeException ("index");
objectTable.Remove ( ((DictionaryEntry)objectList[idx]).Key );
objectList.RemoveAt (idx);
}
IDictionaryEnumerator IDictionary.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
IDictionaryEnumerator IOrderedDictionary.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
#if !NET_4_0
void IStateManager.LoadViewState (object state)
{
if (state != null)
{
object[] states = (object[]) state;
if (states[0] != null) {
objectList = (ArrayList) states[0];
for (int i = 0; i < objectList.Count; i++)
{
DictionaryEntry pair = (DictionaryEntry) objectList[i];
objectTable.Add (pair.Key, pair.Value);
}
}
}
}
object IStateManager.SaveViewState ()
{
object[] ret = new object[] { objectList };
if (ret[0] == null)
return null;
return ret;
}
void IStateManager.TrackViewState ()
{
trackViewState = true;
}
#endif
public int Count {
get { return objectList.Count; }
}
public bool IsFixedSize {
get { return false; }
}
public bool IsReadOnly {
get { return false; }
}
public bool IsSynchronized {
get { return false; }
}
public object this[int idx] {
get { return ((DictionaryEntry) objectList[idx]).Value; }
set {
if (idx < 0 || idx >= Count)
throw new ArgumentOutOfRangeException ("index");
object key = ((DictionaryEntry) objectList[idx]).Key;
objectList[idx] = new DictionaryEntry (key, value);
objectTable[key] = value;
}
}
public object this[object key] {
get { return objectTable[key]; }
set {
if (objectTable.Contains (key))
{
objectTable[key] = value;
objectTable[IndexOf (key)] = new DictionaryEntry (key, value);
return;
}
Add (key, value);
}
}
public ICollection Keys {
get {
ArrayList retList = new ArrayList ();
for (int i = 0; i < objectList.Count; i++)
{
retList.Add ( ((DictionaryEntry)objectList[i]).Key );
}
return retList;
}
}
public ICollection Values {
get {
ArrayList retList = new ArrayList ();
for (int i = 0; i < objectList.Count; i++)
{
retList.Add ( ((DictionaryEntry)objectList[i]).Value );
}
return retList;
}
}
public object SyncRoot {
get { return this; }
}
#if !NET_4_0
bool trackViewState;
bool IStateManager.IsTrackingViewState {
get { return trackViewState; }
}
#endif
int IndexOf (object key)
{
for (int i = 0; i < objectList.Count; i++)
{
if (((DictionaryEntry) objectList[i]).Key.Equals (key))
{
return i;
}
}
return -1;
}
}
}

View File

@ -1,84 +0,0 @@
//
// System.Web.UI/KeyedListEnumerator.cs
//
// Author: Todd Berman <tberman@gentoo.org>
//
// (C) 2003 Todd Berman
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
namespace System.Web.UI
{
internal class KeyedListEnumerator : IDictionaryEnumerator
{
int index = -1;
ArrayList objs;
internal KeyedListEnumerator (ArrayList list)
{
objs = list;
}
public bool MoveNext ()
{
index++;
if (index >= objs.Count)
return false;
return true;
}
public void Reset ()
{
index = -1;
}
public object Current {
get {
if (index < 0 || index >= objs.Count)
throw new InvalidOperationException ();
return ((DictionaryEntry)objs[index]).Value;
}
}
public DictionaryEntry Entry {
get {
return (DictionaryEntry) Current;
}
}
public object Key {
get {
return Entry.Key;
}
}
public object Value {
get {
return Entry.Value;
}
}
}
}

View File

@ -75,30 +75,9 @@ namespace System.Web.UI {
{
if (stream == null)
throw new ArgumentNullException ("stream");
#if NET_4_0
using (StreamReader sr = new StreamReader (stream)) {
return Deserialize (sr.ReadToEnd ());
}
#else
long streamLength = -1;
if (stream.CanSeek)
streamLength = stream.Length;
MemoryStream ms = null;
if (streamLength != -1 && (stream is MemoryStream) && stream.Position == 0) {
// We save allocating a new stream and reading in this case.
ms = (MemoryStream) stream;
} else {
byte [] bytes = new byte [streamLength >= 0 ? streamLength : 2048];
ms = new MemoryStream ();
int n;
while ((n = stream.Read (bytes, 0, bytes.Length)) > 0)
ms.Write (bytes, 0, n);
streamLength = ms.Length;
}
string b64 = Encoding.ASCII.GetString (ms.GetBuffer (),
0, (int) streamLength);
return Deserialize (b64);
#endif
}
public object Deserialize (TextReader input)
@ -126,10 +105,8 @@ namespace System.Web.UI {
{
if (stream == null)
throw new ArgumentNullException ("stream");
#if NET_4_0
if (!stream.CanSeek)
throw new NotSupportedException ();
#endif
string b64 = SerializeToBase64 (value);
byte [] bytes = Encoding.ASCII.GetBytes (b64);
stream.Write (bytes, 0, bytes.Length);

View File

@ -98,7 +98,6 @@ namespace System.Web.UI
return parentMasterPage;
}
}
#if NET_4_0
public void InstantiateInContentPlaceHolder (Control contentPlaceHolder, ITemplate template)
{
// .NET compatibility...
@ -108,7 +107,6 @@ namespace System.Web.UI
if (contentPlaceHolder != null && template != null)
template.InstantiateIn (contentPlaceHolder);
}
#endif
internal static MasterPage CreateMasterPage (TemplateControl owner, HttpContext context,
string masterPageFile, IDictionary contentTemplateCollection)
{

View File

@ -32,9 +32,6 @@ namespace System.Web.UI
{
[Obsolete ("The recommended alternative is System.Convert and String.Format. http://go.microsoft.com/fwlink/?linkid=14202")]
// CAS - no InheritanceDemand here as the class is sealed
#if !NET_4_0
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
#endif
public sealed class ObjectConverter
{
public ObjectConverter ()

View File

@ -352,7 +352,7 @@ namespace System.Web.UI
public static void WriteObject (BinaryWriter w, object o, WriterContext ctx)
{
#if TRACE && !TARGET_J2EE
#if TRACE
if (o != null) {
Trace.WriteLine (String.Format ("Writing {0} (type: {1})", o, o.GetType ()));
Trace.Indent ();
@ -415,7 +415,7 @@ namespace System.Web.UI
Trace.WriteLine (String.Format ("Writing with formatter '{0}'", fmt.GetType ()));
#endif
fmt.Write (w, o, ctx);
#if TRACE && !TARGET_J2EE
#if TRACE
Trace.Unindent ();
Trace.WriteLine (String.Format ("Wrote {0} (type: {1}) {2} bytes", o, o.GetType (), w.BaseStream.Position - pos));
#endif

View File

@ -54,9 +54,7 @@ using System.Web.UI.Adapters;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Reflection;
#if NET_4_0
using System.Web.Routing;
#endif
namespace System.Web.UI
{
@ -146,13 +144,11 @@ public partial class Page : TemplateControl, IHttpHandler
string _title;
string _theme;
string _styleSheetTheme;
#if NET_4_0
string _metaDescription;
string _metaKeywords;
Control _autoPostBackControl;
bool frameworkInitialized;
#endif
Hashtable items;
bool _maintainScrollPositionOnPostBack;
@ -183,9 +179,7 @@ public partial class Page : TemplateControl, IHttpHandler
viewStateEncryptionMode = ViewStateEncryptionMode.Auto;
_viewState = true;
}
#if NET_4_0
this.ViewStateMode = ViewStateMode.Enabled;
#endif
}
#endregion
@ -442,7 +436,6 @@ public partial class Page : TemplateControl, IHttpHandler
internal IScriptManager ScriptManager {
get { return (IScriptManager) Items [typeof (IScriptManager)]; }
}
#if !TARGET_J2EE
internal string theForm {
get {
return "theForm";
@ -452,7 +445,6 @@ public partial class Page : TemplateControl, IHttpHandler
internal bool IsMultiForm {
get { return false; }
}
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
@ -566,7 +558,6 @@ public partial class Page : TemplateControl, IHttpHandler
_pageTheme.SetPage (this);
}
}
#if NET_4_0
public Control AutoPostBackControl {
get { return _autoPostBackControl; }
set { _autoPostBackControl = value; }
@ -640,7 +631,6 @@ public partial class Page : TemplateControl, IHttpHandler
htmlHeader.Keywords = value;
}
}
#endif
[Localizable (true)]
[Bindable (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
@ -737,10 +727,6 @@ public partial class Page : TemplateControl, IHttpHandler
return deflt;
CultureInfo ret = null;
if (culture.StartsWith ("auto", StringComparison.InvariantCultureIgnoreCase)) {
#if TARGET_J2EE
if (!Context.IsServletRequest)
return deflt;
#endif
string[] languages = Request.UserLanguages;
try {
if (languages != null && languages.Length > 0)
@ -798,11 +784,7 @@ public partial class Page : TemplateControl, IHttpHandler
return null;
NameValueCollection coll = null;
if (0 == String.Compare (Request.HttpMethod, "POST", true, Helpers.InvariantCulture)
#if TARGET_J2EE
|| !_context.IsServletRequest
#endif
)
if (0 == String.Compare (Request.HttpMethod, "POST", true, Helpers.InvariantCulture))
coll = req.Form;
else {
string query = Request.QueryStringRaw;
@ -821,17 +803,6 @@ public partial class Page : TemplateControl, IHttpHandler
if (coll != null && coll ["__VIEWSTATE"] == null && coll ["__EVENTTARGET"] == null)
return null;
#if TARGET_J2EE
if (getFacesContext () != null && _context.Handler != _context.CurrentHandler) {
// check if it is PreviousPage
string prevViewId = coll [PreviousPageID];
if (!String.IsNullOrEmpty (prevViewId)) {
string appPath = VirtualPathUtility.RemoveTrailingSlash (Request.ApplicationPath);
prevViewId = prevViewId.Substring (appPath.Length);
isCrossPagePostBack = String.Compare (prevViewId, getFacesContext ().getExternalContext ().getRequestPathInfo (), StringComparison.OrdinalIgnoreCase) == 0;
}
}
#endif
return coll;
}
@ -843,10 +814,6 @@ public partial class Page : TemplateControl, IHttpHandler
}
Control FindControl (string id, bool decode) {
#if TARGET_J2EE
if (decode)
id = DecodeNamespace (id);
#endif
return FindControl (id);
}
@ -1050,17 +1017,6 @@ public partial class Page : TemplateControl, IHttpHandler
ClientScript.RegisterStartupScript (typeof (Page), "MaintainScrollPositionOnPostBackStartup", script.ToString());
}
#if TARGET_J2EE
if (bool.Parse (WebConfigurationManager.AppSettings [RenderBodyContentOnlyKey] ?? "false")) {
for (Control c = this.Form; c != null; c = c.Parent) {
HtmlGenericControl ch = (c as HtmlGenericControl);
if (ch != null && ch.TagName == "body") {
ch.RenderChildren (writer);
return;
}
}
}
#endif
base.Render (writer);
}
@ -1090,13 +1046,6 @@ public partial class Page : TemplateControl, IHttpHandler
writer.WriteLine ("\tvar {0};\n\tif (document.getElementById) {{ {0} = document.getElementById ('{1}'); }}", theForm, formUniqueID);
writer.WriteLine ("\telse {{ {0} = document.{1}; }}", theForm, formUniqueID);
}
#if TARGET_J2EE
// TODO implement callback on portlet
string serverUrl = Request.RawUrl;
writer.WriteLine ("\t{0}.serverURL = {1};", theForm, ClientScriptManager.GetScriptLiteral (serverUrl));
writer.WriteLine ("\twindow.TARGET_J2EE = true;");
writer.WriteLine ("\twindow.IsMultiForm = {0};", IsMultiForm ? "true" : "false");
#endif
formScriptDeclarationRendered = true;
}
@ -1115,19 +1064,7 @@ public partial class Page : TemplateControl, IHttpHandler
}
if (handleViewState)
#if TARGET_J2EE
if (getFacesContext () != null) {
javax.faces.application.ViewHandler viewHandler = getFacesContext ().getApplication ().getViewHandler ();
javax.faces.context.ResponseWriter oldFacesWriter = SetupResponseWriter (writer);
try {
viewHandler.writeState (getFacesContext ());
}
finally {
getFacesContext ().setResponseWriter (oldFacesWriter);
}
} else
#endif
scriptManager.RegisterHiddenField ("__VIEWSTATE", _savedViewState);
scriptManager.RegisterHiddenField ("__VIEWSTATE", _savedViewState);
scriptManager.WriteHiddenFields (writer);
if (requiresPostBackScript) {
@ -1235,10 +1172,6 @@ public partial class Page : TemplateControl, IHttpHandler
public virtual void ProcessRequest (HttpContext context)
{
SetContext (context);
#if TARGET_J2EE
bool wasException = false;
IHttpHandler jsfHandler = getFacesContext () != null ? EnterThread () : null;
#endif
if (clientTarget != null)
Request.ClientTarget = clientTarget;
@ -1250,18 +1183,11 @@ public partial class Page : TemplateControl, IHttpHandler
_appCulture = Thread.CurrentThread.CurrentCulture;
_appUICulture = Thread.CurrentThread.CurrentUICulture;
FrameworkInitialize ();
#if NET_4_0
frameworkInitialized = true;
#endif
context.ErrorPage = _errorPage;
try {
InternalProcessRequest ();
#if TARGET_J2EE
} catch (Exception ex) {
wasException = true;
HandleException (ex);
#else
} catch (ThreadAbortException taex) {
if (FlagEnd.Value == taex.ExceptionState)
Thread.ResetAbort ();
@ -1269,13 +1195,7 @@ public partial class Page : TemplateControl, IHttpHandler
throw;
} catch (Exception e) {
ProcessException (e);
#endif
} finally {
#if TARGET_J2EE
if (getFacesContext () != null)
ExitThread (jsfHandler);
else if (!wasException)
#endif
ProcessUnload ();
}
}
@ -1297,12 +1217,6 @@ public partial class Page : TemplateControl, IHttpHandler
RenderTrace ();
UnloadRecursive (true);
} catch {}
#if TARGET_J2EE
if (getFacesContext () != null) {
if(IsCrossPagePostBack)
_context.Items [CrossPagePostBack] = this;
}
#endif
if (Thread.CurrentThread.CurrentCulture.Equals (_appCulture) == false)
Thread.CurrentThread.CurrentCulture = _appCulture;
@ -1418,23 +1332,12 @@ public partial class Page : TemplateControl, IHttpHandler
renderingForm = false;
#if TARGET_J2EE
if (getFacesContext () != null)
if (IsPostBack || IsCallback)
return;
#endif
RestorePageState ();
ProcessPostData ();
ProcessRaiseEvents ();
if (ProcessLoadComplete ())
return;
#if TARGET_J2EE
if (getFacesContext () != null) {
getFacesContext ().renderResponse ();
return;
}
#endif
RenderPage ();
}
@ -1499,13 +1402,6 @@ public partial class Page : TemplateControl, IHttpHandler
return true;
if (IsCallback) {
#if TARGET_J2EE
if (getFacesContext () != null) {
_callbackTarget = GetCallbackTarget ();
ProcessRaiseCallbackEvent (_callbackTarget, ref _callbackEventError);
return true;
}
#endif
string result = ProcessCallbackData ();
HtmlTextWriter callbackOutput = new HtmlTextWriter (Response.Output);
callbackOutput.Write (result);
@ -1591,12 +1487,10 @@ public partial class Page : TemplateControl, IHttpHandler
string eventTarget = postdata [postEventSourceID];
IPostBackEventHandler target;
if (String.IsNullOrEmpty (eventTarget)) {
#if NET_4_0
target = AutoPostBackControl as IPostBackEventHandler;
if (target != null)
RaisePostBackEvent (target, null);
else
#endif
if (formPostedRequiresRaiseEvent != null)
RaisePostBackEvent (formPostedRequiresRaiseEvent, null);
else
@ -1605,10 +1499,8 @@ public partial class Page : TemplateControl, IHttpHandler
}
target = FindControl (eventTarget, true) as IPostBackEventHandler;
#if NET_4_0
if (target == null)
target = AutoPostBackControl as IPostBackEventHandler;
#endif
if (target == null)
return;
@ -1784,9 +1676,7 @@ public partial class Page : TemplateControl, IHttpHandler
object viewState = null;
if (EnableViewState
#if NET_4_0
&& this.ViewStateMode == ViewStateMode.Enabled
#endif
)
viewState = SaveViewStateRecursive ();
@ -2141,7 +2031,6 @@ public partial class Page : TemplateControl, IHttpHandler
htmlHeader.Title = _title;
_title = null;
}
#if NET_4_0
if (_metaDescription != null) {
htmlHeader.Description = _metaDescription;
_metaDescription = null;
@ -2151,7 +2040,6 @@ public partial class Page : TemplateControl, IHttpHandler
htmlHeader.Keywords = _metaKeywords;
_metaKeywords = null;
}
#endif
}
[EditorBrowsable (EditorBrowsableState.Never)]
@ -2548,23 +2436,11 @@ public partial class Page : TemplateControl, IHttpHandler
if (_requestValueCollection != null) {
string prevPage = _requestValueCollection [PreviousPageID];
if (prevPage != null) {
#if TARGET_J2EE
if (getFacesContext () != null) {
IHttpHandler handler = Context.ApplicationInstance.GetHandler (Context, prevPage);
Server.Execute (handler, null, true, _context.Request.CurrentExecutionFilePath, null, false, false);
if (_context.Items.Contains (CrossPagePostBack)) {
previousPage = (Page) _context.Items [CrossPagePostBack];
_context.Items.Remove (CrossPagePostBack);
}
return;
}
#else
IHttpHandler handler;
handler = BuildManager.CreateInstanceFromVirtualPath (prevPage, typeof (IHttpHandler)) as IHttpHandler;
previousPage = (Page) handler;
previousPage.isCrossPagePostBack = true;
Server.Execute (handler, null, true, _context.Request.CurrentExecutionFilePath, null, false, false);
#endif
}
}
}

View File

@ -44,13 +44,11 @@ namespace System.Web.UI
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class PageParser : TemplateControlParser
{
#if NET_4_0
static Type defaultPageBaseType;
static Type defaultApplicationBaseType;
static Type defaultPageParserFilterType;
static Type defaultUserControlBaseType;
static bool enableLongStringsAsResources = true;
#endif
PagesEnableSessionState enableSessionState = PagesEnableSessionState.True;
bool enableViewStateMac;
bool enableViewStateMacSet;
@ -67,10 +65,8 @@ namespace System.Web.UI
MainDirectiveAttribute <string> masterPage;
MainDirectiveAttribute <string> title;
MainDirectiveAttribute <string> theme;
#if NET_4_0
MainDirectiveAttribute <string> metaDescription;
MainDirectiveAttribute <string> metaKeywords;
#endif
string culture;
string uiculture;
string errorPage;
@ -85,7 +81,6 @@ namespace System.Web.UI
int maxPageStateFieldLength = -1;
Type previousPageType;
string previousPageVirtualPath;
#if NET_4_0
public static bool EnableLongStringsAsResources {
get { return enableLongStringsAsResources; }
set {
@ -134,7 +129,6 @@ namespace System.Web.UI
defaultUserControlBaseType = value;
}
}
#endif
public PageParser ()
{
LoadConfigDefaults ();
@ -439,7 +433,6 @@ namespace System.Web.UI
enableViewStateMac = GetBool (atts, "EnableViewStateMac", enableViewStateMac);
enableViewStateMacSet = true;
}
#if NET_4_0
value = GetString (atts, "MetaDescription", null);
if (value != null) {
if (!BaseParser.IsExpression (value))
@ -455,7 +448,6 @@ namespace System.Web.UI
else
metaKeywords = new MainDirectiveAttribute <string> (value);
}
#endif
// Ignored by now
GetString (atts, "SmartNavigation", null);
@ -566,7 +558,6 @@ namespace System.Web.UI
internal TraceMode TraceMode {
get { return tracemode; }
}
#if NET_4_0
internal override Type DefaultBaseType {
get {
Type ret = DefaultPageBaseType;
@ -576,7 +567,6 @@ namespace System.Web.UI
return ret;
}
}
#endif
internal override string DefaultBaseTypeName {
get { return PagesConfig.PageBaseType; }
}
@ -616,7 +606,6 @@ namespace System.Web.UI
internal MainDirectiveAttribute <string> Theme {
get { return theme; }
}
#if NET_4_0
internal MainDirectiveAttribute <string> MetaDescription {
get { return metaDescription; }
}
@ -624,7 +613,6 @@ namespace System.Web.UI
internal MainDirectiveAttribute <string> MetaKeywords {
get { return metaKeywords; }
}
#endif
internal string Culture {
get { return culture; }
}

View File

@ -81,11 +81,9 @@ namespace System.Web.UI {
public int Duration {
get { return duration; }
}
#if NET_4_0
public string ProviderName {
get; set;
}
#endif
public string VaryByParams {
get { return varyByParams; }
}

View File

@ -61,7 +61,6 @@ namespace System.Web.UI {
{
// this.sqlDependency = sqlDependency;
}
#if NET_4_0
public StaticPartialCachingControl (string ctrlID, string guid, int duration, string varyByParams,
string varyByControls, string varyByCustom, string sqlDependency,
BuildMethod buildMethod, string providerName)
@ -69,7 +68,6 @@ namespace System.Web.UI {
{
ProviderName = providerName;
}
#endif
[MonoTODO("Consider sqlDependency parameter")]
public static void BuildCachedControl (Control parent, string ctrlID, string guid,
int duration, string varyByParams, string varyByControls, string varyByCustom,
@ -88,7 +86,6 @@ namespace System.Web.UI {
{
BuildCachedControl (parent, ctrlID, guid, duration, varyByParams, varyByControls, varyByCustom, null, buildMethod);
}
#if NET_4_0
public static void BuildCachedControl (Control parent, string ctrlID, string guid, int duration,
string varyByParams, string varyByControls, string varyByCustom,
string sqlDependency, BuildMethod buildMethod, string providerName)
@ -98,7 +95,6 @@ namespace System.Web.UI {
if (parent != null)
parent.Controls.Add (ctl);
}
#endif
internal override Control CreateControl()
{
return buildMethod ();

View File

@ -47,9 +47,7 @@ namespace System.Web.UI
bool autoEventWireup = true;
bool enableViewState = true;
CompilationMode compilationMode = CompilationMode.Always;
#if NET_4_0
ClientIDMode? clientIDMode;
#endif
TextReader reader;
protected TemplateControlParser ()
@ -81,7 +79,6 @@ namespace System.Web.UI
}
atts.Remove ("TargetSchema"); // Ignored
#if NET_4_0
value = GetString (atts, "ClientIDMode", null);
if (!String.IsNullOrEmpty (value)) {
try {
@ -90,7 +87,6 @@ namespace System.Web.UI
ThrowParseException ("Invalid value of the ClientIDMode attribute.", ex);
}
}
#endif
base.ProcessMainAttributes (atts);
}
@ -209,11 +205,9 @@ namespace System.Web.UI
internal CompilationMode CompilationMode {
get { return compilationMode; }
}
#if NET_4_0
internal ClientIDMode? ClientIDMode {
get { return clientIDMode; }
}
#endif
internal override TextReader Reader {
get { return reader; }
set { reader = value; }

View File

@ -955,11 +955,9 @@ namespace System.Web.UI {
internal Type PageParserFilterType {
get {
if (pageParserFilterType == null) {
#if NET_4_0
pageParserFilterType = PageParser.DefaultPageParserFilterType;
if (pageParserFilterType != null)
return pageParserFilterType;
#endif
string typeName = PagesConfig.PageParserFilterType;
if (String.IsNullOrEmpty (typeName))
return null;
@ -970,11 +968,7 @@ namespace System.Web.UI {
return pageParserFilterType;
}
}
#if NET_4_0
internal virtual
#else
internal
#endif
Type DefaultBaseType {
get {
Type type = Type.GetType (DefaultBaseTypeName, true);

View File

@ -40,9 +40,7 @@ namespace System.Web.UI
internal class UserControlParser : TemplateControlParser
{
string masterPage;
#if NET_4_0
string providerName;
#endif
internal UserControlParser (VirtualPath virtualPath, string inputFile, HttpContext context)
: this (virtualPath, inputFile, context, null)
{
@ -139,7 +137,6 @@ namespace System.Web.UI
base.ProcessMainAttributes (atts);
}
#if NET_4_0
internal override void ProcessOutputCacheAttributes (IDictionary atts)
{
providerName = GetString (atts, "ProviderName", null);
@ -155,7 +152,6 @@ namespace System.Web.UI
return ret;
}
}
#endif
internal override string DefaultBaseTypeName {
get { return PagesConfig.UserControlBaseType; }
}
@ -167,11 +163,9 @@ namespace System.Web.UI
internal string MasterPageFile {
get { return masterPage; }
}
#if NET_4_0
internal string ProviderName {
get { return providerName; }
}
#endif
}
}