+2007-01-14 Eyal Alaluf <eyala@mainsoft.com>
+
+ * System.Web20.vmwcsproj: added .jvm files for Control.cs, Page.cs,
+ HttpRequest.cs & HttpContext.cs
+
2007-01-07 Vladimir Krasnov <vladimirk@mainsoft.com>
* System.Web20.vmwcsproj: added ProfileParameter.cs
namespace System.Web.J2EE
{
- internal sealed class J2EEUtils
+ internal static class J2EEUtils
{
- public J2EEUtils()
- {
- }
-
public static int RunProc(string[] cmd)
{
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
+++ /dev/null
-//
-// System.Web.SessionState.HttpSessionState.jvm.cs
-//
-// Authors:
-// Ilya Kharmatsky (ilyak@mainsoft.com)
-// Alon Gazit
-// Pavel Sandler
-//
-// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
-//
-
-//
-// 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;
-using System.Collections;
-using System.Collections.Specialized;
-using System.Globalization;
-using System.Text;
-using System.Threading;
-using System.Web;
-using System.Web.J2EE;
-using System.Web.Hosting;
-
-namespace System.Web.SessionState
-{
-public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externalizable
-{
- private string _id;
- private SessionDictionary _dict;
- private HttpStaticObjectsCollection _staticObjects;
- private int _timeout;
- private bool _newSession;
- private bool _isCookieless;
- private SessionStateMode _mode;
- private bool _isReadonly;
- internal bool _abandoned;
-
- private bool _needSessionPersistence = false;
-
- internal HttpSessionState (string id,
- SessionDictionary dict,
- HttpStaticObjectsCollection staticObjects,
- int timeout,
- bool newSession,
- bool isCookieless,
- SessionStateMode mode,
- bool isReadonly)
- {
- _id = id;
- _dict = dict;
- _staticObjects = staticObjects.Clone ();
- _timeout = timeout;
- _newSession = newSession;
- _isCookieless = isCookieless;
- _mode = mode;
- _isReadonly = isReadonly;
-
- _needSessionPersistence = false;
- javax.servlet.ServletConfig config = (javax.servlet.ServletConfig)AppDomain.CurrentDomain.GetData(J2EEConsts.SERVLET_CONFIG);
- string sessionPersistance = config.getInitParameter(J2EEConsts.Enable_Session_Persistency);
- if (sessionPersistance!= null)
- {
- try
- {
- _needSessionPersistence = Boolean.Parse(sessionPersistance);
- }
- catch (Exception)
- {
- Console.WriteLine("EnableSessionPersistency init param's value is invalid. the value is " + sessionPersistance);
- }
- }
- }
-
- public HttpSessionState ()
- {
- _id = null;
- _dict = new SessionDictionary();
- _staticObjects = new HttpStaticObjectsCollection();
- _timeout = 0;
- _newSession = false;
- _isCookieless = false;
- _mode = SessionStateMode.Off;
- _isReadonly = false;
- }
-
- public void writeExternal(java.io.ObjectOutput output)
- {
- lock (this)
- {
- output.writeBoolean(_needSessionPersistence);
- if (!_needSessionPersistence)
- //indicates that there is nothing to serialize for this object
- return;
-
- System.Web.J2EE.ObjectOutputStream ms = new System.Web.J2EE.ObjectOutputStream(output);
- System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms);
- bw.Write(_id);
- _dict.Serialize(bw);
- _staticObjects.Serialize(bw);
- bw.Write(_timeout);
- bw.Write(_newSession);
- bw.Write(_isCookieless);
- if (_mode == SessionStateMode.Off)
- bw.Write(0);
- else if (_mode == SessionStateMode.InProc)
- bw.Write(1);
- else if (_mode == SessionStateMode.StateServer)
- bw.Write(2);
- else
- bw.Write(3);
- bw.Write(_isReadonly);
- }
- }
-
- public void readExternal(java.io.ObjectInput input)
- {
- lock(this)
- {
- _needSessionPersistence = input.readBoolean();
- if(!_needSessionPersistence) //noting has been written
- return;
-
- System.Web.J2EE.ObjectInputStream ms = new System.Web.J2EE.ObjectInputStream( input );
- System.IO.BinaryReader br = new System.IO.BinaryReader(ms);
- _id = br.ReadString();
- _dict = SessionDictionary.Deserialize(br);
- _staticObjects = HttpStaticObjectsCollection.Deserialize(br);
- _timeout = br.ReadInt32();
- _newSession = br.ReadBoolean();
- _isCookieless = br.ReadBoolean();
- int mode = br.ReadInt32();
- if (mode == 0)
- _mode = SessionStateMode.Off;
- else if (mode == 1)
- _mode = SessionStateMode.InProc;
- else if (mode == 2)
- _mode = SessionStateMode.StateServer;
- else
- _mode = SessionStateMode.SQLServer;
- _isReadonly = br.ReadBoolean();
- }
- }
-
- internal HttpSessionState Clone ()
- {
- return new HttpSessionState (_id, _dict.Clone (), _staticObjects, _timeout, _newSession,
- _isCookieless, _mode, _isReadonly);
-
- }
-
- public int CodePage {
- get {
- HttpContext current = HttpContext.Current;
- if (current == null)
- return Encoding.Default.CodePage;
-
- return current.Response.ContentEncoding.CodePage;
- }
-
- set {
- HttpContext current = HttpContext.Current;
- if (current != null)
- current.Response.ContentEncoding = Encoding.GetEncoding (value);
- }
- }
-
- public HttpSessionState Contents {
- get { return this; }
- }
-
- public int Count {
- get { return _dict.Count; }
- }
-
- internal bool IsAbandoned {
- get { return _abandoned; }
- }
-
- public bool IsCookieless {
- get {
- ServletWorkerRequest worker = (ServletWorkerRequest)HttpContext.Current.Request.WorkerRequest;
- return worker.ServletRequest.isRequestedSessionIdFromURL();
- }
- }
-
- public bool IsNewSession {
- get { return _newSession; }
- }
-
- public bool IsReadOnly {
- get { return _isReadonly; }
- }
-
- public bool IsSynchronized {
- get { return false; }
- }
-
- public object this [string key] {
- get { return _dict [key]; }
- set {
- _dict [key] = value;
-
- _newSession = false;
- SetJavaSessionAttribute();
- }
- }
-
- public object this [int index] {
- get { return _dict [index]; }
- set {
- _dict [index] = value;
-
- _newSession = false;
- SetJavaSessionAttribute();
- }
- }
-
- public NameObjectCollectionBase.KeysCollection Keys {
- get { return _dict.Keys; }
- }
-
- public int LCID {
- get { return Thread.CurrentThread.CurrentCulture.LCID; }
- set { Thread.CurrentThread.CurrentCulture = new CultureInfo(value); }
- }
-
- public SessionStateMode Mode {
- get { return _mode; }
- }
-
- public string SessionID {
- get { return _id; }
- }
-
- public HttpStaticObjectsCollection StaticObjects {
- get { return _staticObjects; }
- }
-
- public object SyncRoot {
- get { return this; }
- }
-
- public int Timeout {
- get {
- ServletWorkerRequest worker = (ServletWorkerRequest)HttpContext.Current.Request.WorkerRequest;
- javax.servlet.http.HttpSession javaSession = worker.ServletRequest.getSession(false);
- if (javaSession != null)
- return javaSession.getMaxInactiveInterval()/60;
- else
- throw new NotSupportedException();
- }
- set {
- if (value < 1)
- throw new ArgumentException ("The argument to SetTimeout must be greater than 0.");
- ServletWorkerRequest worker = (ServletWorkerRequest)HttpContext.Current.Request.WorkerRequest;
- javax.servlet.http.HttpSession javaSession = worker.ServletRequest.getSession(false);
- if (javaSession != null)
- javaSession.setMaxInactiveInterval(value*60);
- else
- throw new NotSupportedException();
- }
- }
-
- internal SessionDictionary SessionDictionary {
- get { return _dict; }
- }
-
- internal void SetNewSession (bool value)
- {
- _newSession = value;
- }
-
- public void Abandon ()
- {
- _abandoned = true;
-
- SessionDictionary.Clear();
- ServletWorkerRequest worker = (ServletWorkerRequest)HttpContext.Current.Request.WorkerRequest;
-// worker.Servlet.getServletContext().removeAttribute("GH_SESSION_STATE");
- javax.servlet.http.HttpSession javaSession = worker.ServletRequest.getSession(false);
-
- if (javaSession != null)
- {
- javaSession.setAttribute("GH_SESSION_STATE",this);
- javaSession.invalidate();
- }
- }
-
- public void Add (string name, object value)
- {
- _dict [name] = value;
-
- _newSession = false;
- SetJavaSessionAttribute();
- }
-
- public void Clear ()
- {
- if (_dict != null)
- _dict.Clear ();
-
- SetJavaSessionAttribute();
- }
-
- public void CopyTo (Array array, int index)
- {
- NameObjectCollectionBase.KeysCollection all = Keys;
- for (int i = 0; i < all.Count; i++)
- array.SetValue (all.Get(i), i + index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return _dict.GetEnumerator ();
- }
-
- public void Remove (string name)
- {
- _dict.Remove (name);
-
- SetJavaSessionAttribute();
- }
-
- public void RemoveAll ()
- {
- _dict.Clear ();
-
- SetJavaSessionAttribute();
- }
-
- public void RemoveAt (int index)
- {
- _dict.RemoveAt (index);
-
- SetJavaSessionAttribute();
- }
-
- public void SetJavaSessionAttribute ()
- {
- ServletWorkerRequest worker = (ServletWorkerRequest)HttpContext.Current.Request.WorkerRequest;
- javax.servlet.http.HttpSession javaSession = worker.ServletRequest.getSession(false);
- if (javaSession != null)
- javaSession.setAttribute("GH_SESSION_STATE",this);
- }
-}
-}
-
+++ /dev/null
-//
-// System.Web.SessionState.SesionInProchandler.jvm.cs
-//
-// Authors:
-// Ilya Kharmatsky (ilyak@mainsoft.com)
-// Alon Gazit
-// Pavel Sandler
-//
-// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
-//
-
-//
-// 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.
-//
-#if !NET_2_0
-using System;
-using System.IO;
-using System.Collections;
-using System.Web;
-using System.Web.Hosting;
-using System.Web.Configuration;
-
-namespace System.Web.SessionState
-{
-
- class SessionInProcHandler : ISessionHandler
- {
-
-#if NET_2_0
- SessionStateSection config;
-#else
- SessionConfig config;
-#endif
-
- public void Dispose () { }
-
- public void Init (SessionStateModule module, HttpApplication context,
-#if NET_2_0
- SessionStateSection config
-#else
- SessionConfig config
-#endif
-)
- {
- this.config = config;
- }
-
- public void UpdateHandler (HttpContext context, SessionStateModule module) { }
-
- public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
- bool required, bool read_only, ref bool isNew)
- {
-
- if (!required)
- return null;
-
- ServletWorkerRequest worker = (ServletWorkerRequest)context.Request.WorkerRequest;
- javax.servlet.http.HttpSession javaSession = worker.ServletRequest.getSession(false);
- HttpSessionState state;
- if (javaSession != null)
- {
- state = (HttpSessionState) javaSession.getAttribute("GH_SESSION_STATE");
- return state;
- }
-
- // We create a new session.
- javaSession = worker.ServletRequest.getSession(true);
- string sessionID = javaSession.getId();
- state = new HttpSessionState (sessionID, // unique identifier
- new SessionDictionary(), // dictionary
- HttpApplicationFactory.ApplicationState.SessionObjects,
-#if NET_2_0
- (int)config.Timeout.TotalMinutes, // XXX is this right? we lose some precision here, but since the timeout is in minutes *anyway*...
-#else
- config.Timeout, //lifetime before death.
-#endif
- true, //new session
- false, // is cookieless
- SessionStateMode.J2ee,
- read_only); //readonly
-
- javaSession.setAttribute("GH_SESSION_STATE", state);
-
- isNew = true;
- return state;
- }
- }
-}
-
-#endif
-2007-01-07 Eyal Alaluf <eyala@mainsoft.com>
+2007-01-14 Eyal Alaluf <eyala@mainsoft.com>
+
+ * HtmlForm.cs, HtmlAnchor.cs: Added H2EE Portal support for TARGET_J2EE.
+
+2007-01-14 Eyal Alaluf <eyala@mainsoft.com>
* HtmlInputImage.cs: to handle correctly relative URLs to the image.
protected override void RenderAttributes (HtmlTextWriter writer)
{
- // we don't want to render the "user" URL, so we either render:
+ string target = Attributes ["target"];
+ if ((target == null) || (target.Length == 0))
+ Attributes.Remove("target");
+ // we don't want to render the "user" URL, so we either render:
EventHandler serverClick = (EventHandler) Events [serverClickEvent];
if (serverClick != null) {
#if NET_2_0
} else {
string hr = HRef;
if (hr != "")
+#if TARGET_J2EE
+ // For J2EE portlets we need to genreate a render URL.
+ HRef = ResolveUrl (hr, String.Compare(target, "_blank", true) != 0);
+#else
HRef = ResolveUrl (hr);
+#endif
}
- string target = Attributes ["target"];
- if ((target == null) || (target.Length == 0))
- Attributes.Remove("target");
-
base.RenderAttributes (writer);
// but we never set back the href attribute after the rendering
}
action += Page.Request.QueryStringRaw;
+#if TARGET_J2EE
+ vmw.@internal.j2ee.IPortletRenderResponse resp = GetRenderResponse();
+ if (resp != null)
+ action = resp.createActionURL(action);
+#endif
w.WriteAttribute ("name", Name);
{
PostBackOptions options = new PostBackOptions (this);
options.ActionUrl = (PostBackUrl.Length > 0 ? Page.ResolveClientUrl (PostBackUrl) : null);
+#if TARGET_J2EE
+ vmw.@internal.j2ee.IPortletRenderResponse resp = GetRenderResponse();
+ if (resp != null && options.ActionUrl != null)
+ options.ActionUrl = resp.createActionURL(options.ActionUrl);
+#endif
options.ValidationGroup = null;
options.Argument = "";
options.RequiresJavaScriptProtocol = false;
+2007-01-14 Eyal Alaluf <eyala@mainsoft.com>
+ * Button.cs, HyperLink.cs, DataGrid.cs, ImageButton.cs, LinkButton.cs,
+ PagedDataSource.cs: Added J2EE Portal support for TARGET_J2EE.
+
2007-01-14 Ilya Kharmatsky <ilyak-at-mainsoft.com>
* BaseCompareValidator
* CompareValidator
class NCollection : ICollection {
int n;
-#if TARGET_JVM
- class SequenceEnumerator : IEnumerator {
- readonly int _max;
- object _current;
- public SequenceEnumerator(int max) {
- _max = max;
- Reset();
- }
-
- public bool MoveNext() {
- _current = (int)_current + 1;
- return (int)_current >= 0 && (int)_current < _max;
- }
-
- public void Reset() {
- _current = -1;
- }
-
- public object Current {
- get { return _current; }
- }
- }
-#endif
public NCollection (int n)
{
public IEnumerator GetEnumerator ()
{
-#if TARGET_JVM
- return new SequenceEnumerator(n);
-#else
for (int i = 0; i < n; i++)
yield return i;
-#endif
}
public int Count {
if (!Enabled)
return;
// add attributes - only if they're not empty
+ string t = Target;
string s = NavigateUrl;
if (s.Length > 0)
+#if TARGET_J2EE
+ w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveClientUrl (s, String.Compare (t, "_blank", true) != 0));
+#else
w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveClientUrl (s));
- s = Target;
- if (s.Length > 0)
- w.AddAttribute (HtmlTextWriterAttribute.Target, s);
+#endif
+ if (t.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Target, t);
}
protected override void AddParsedSubObject (object obj)
{
PostBackOptions options = new PostBackOptions (this);
options.ActionUrl = (PostBackUrl.Length > 0 ? Page.ResolveClientUrl (PostBackUrl) : null);
+#if TARGET_J2EE
+ vmw.@internal.j2ee.IPortletRenderResponse resp = GetRenderResponse();
+ if (resp != null && options.ActionUrl != null)
+ options.ActionUrl = resp.createActionURL(options.ActionUrl);
+#endif
options.ValidationGroup = null;
options.Argument = "";
options.ClientSubmit = false;
{
PostBackOptions options = new PostBackOptions (this);
options.ActionUrl = (PostBackUrl.Length > 0 ? Page.ResolveClientUrl (PostBackUrl) : null);
+#if TARGET_J2EE
+ vmw.@internal.j2ee.IPortletRenderResponse resp = GetRenderResponse();
+ if (resp != null && options.ActionUrl != null)
+ options.ActionUrl = resp.createActionURL(options.ActionUrl);
+#endif
options.ValidationGroup = null;
options.Argument = "";
options.ClientSubmit = true;
return String.Empty; // as documented
}
-#if TARGET_JVM
- internal class ListEnum : IEnumerator
- {
- int start;
- int end;
- int ind;
- IList list;
-
- internal ListEnum(IList list, int start, int end)
- {
- this.list = list;
- this.start = start;
- this.end = end;
- this.ind = start - 1;
- }
-
- public bool MoveNext()
- {
- ind++;
- return (ind < end);
- }
-
- public void Reset() { ind = start - 1; }
- public object Current { get { return list[ind]; }}
- }
-
- private IEnumerator GetListEnum (IList list, int start, int end)
- {
- if (!allow_paging)
- end = list.Count;
- return new ListEnum(list, start, end);
- }
-
- internal class EnumeratorEnum : IEnumerator
- {
- int start;
- int end;
- int ind;
- IEnumerator en;
- PagedDataSource parent;
-
- internal EnumeratorEnum(PagedDataSource parent, IEnumerator en, int start, int end)
- {
- this.parent = parent;
- this.en = en;
- this.start = start;
- this.end = end;
- this.ind = start - 1;
- for (int i = 0; i < start; i++)
- en.MoveNext ();
- }
-
- public bool MoveNext()
- {
- ind++;
- return (!parent.allow_paging || ind < end) && en.MoveNext ();
- }
-
- public void Reset()
- {
- throw new NotSupportedException();
- }
-
- public object Current { get { return en.Current; }}
- }
-
- private IEnumerator GetEnumeratorEnum (IEnumerator e, int start, int end)
- {
- return new EnumeratorEnum(this, e, start, end);
- }
-#else
private IEnumerator GetListEnum (IList list, int start, int end)
{
if (!AllowPaging)
for (int i = start; (!allow_paging || i < end) && e.MoveNext (); i++)
yield return e.Current;
}
-#endif
}
}
+2007-01-14 Eya; Alaluf <eyala@mainsoft.com>
+
+ * Control.jvm.cs, Page.jvm.cs: Added TARGET_J2EE specific files.
+ * Page.cs, ClientScriptManager.cs, Control.cs: Added J2EE portal
+ support for TARGET_J2EE.
+
2007-01-12 Miguel de Icaza <miguel@novell.com>
* Control.cs: Remove comment, it provides no information about
throw new ArgumentNullException ("control");
page.RequiresPostBackScript ();
- return String.Format ("__doPostBack('{0}','{1}')", control.UniqueID, argument);
+ return String.Format ("{0}('{1}','{2}')", page.PostBackFunctionName, control.UniqueID, argument);
}
#if NET_2_0
[DesignerSerializer ("Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner,
"System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
#endif
- public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
+ public partial class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
#if NET_2_0
, IUrlResolutionService, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor
#endif
defaultNumberID = 0;
}
+#if !TARGET_J2EE
string GetDefaultName ()
{
string defaultName;
}
return defaultName;
}
+#endif
void NullifyUniqueID ()
{
string ResolveClientUrl (string relativeUrl)
{
string absoluteUrl = ResolveUrl (relativeUrl);
+#if TARGET_J2EE
+ // There are no relative paths when rendering a J2EE portlet
+ if (IsPortletRender)
+ return absoluteUrl;
+#endif
if (Context != null && Context.Request != null) {
string baseUrl = Context.Request.BaseVirtualDir;
if (absoluteUrl.StartsWith (baseUrl + "/"))
--- /dev/null
+//\r
+// System.Web.UI.ControlS.jvm.cs\r
+//\r
+// Authors:\r
+// Eyal Alaluf (eyala@mainsoft.com)\r
+//\r
+// (C) 2006 Mainsoft Co. (http://www.mainsoft.com)\r
+//\r
+\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
+using vmw.@internal.j2ee;\r
+using System.Web.Hosting;\r
+\r
+namespace System.Web.UI\r
+{\r
+ public partial class Control\r
+ {\r
+ bool _emptyPortletNamespace = false;\r
+ string _PortletNamespace = null;\r
+\r
+ internal bool IsPortletRender\r
+ {\r
+ get {\r
+ return GetRenderResponse() != null;\r
+ }\r
+ }\r
+\r
+ // For J2EE Portal we need to use the portlet namespace when we generate control IDs.\r
+ string GetDefaultName ()\r
+ {\r
+ string defaultName;\r
+ if (defaultNumberID > 99) {\r
+ defaultName = "_ctl" + defaultNumberID++;\r
+ } else {\r
+ defaultName = defaultNameArray [defaultNumberID++];\r
+ }\r
+\r
+ if (this != _page || _emptyPortletNamespace)\r
+ return defaultName;\r
+\r
+ if (_PortletNamespace == null) {\r
+ IPortletResponse portletResponse = GetRenderResponse ();\r
+ if (portletResponse != null)\r
+ _PortletNamespace = portletResponse.getNamespace ();\r
+ _emptyPortletNamespace = _PortletNamespace == null;\r
+ }\r
+\r
+ return _PortletNamespace + defaultName;\r
+ }\r
+\r
+ // Add a variant for specifying use of portlet resolveRenderUrl\r
+ internal string ResolveUrl (string relativeUrl, bool usePortletRenderResolve)\r
+ {\r
+ relativeUrl = ResolveUrl (relativeUrl);\r
+ if (usePortletRenderResolve) {\r
+ IPortletRenderResponse resp = GetRenderResponse ();\r
+ if (resp != null)\r
+ relativeUrl = resp.createRenderURL (relativeUrl);\r
+ }\r
+ return relativeUrl;\r
+ }\r
+\r
+ internal string ResolveClientUrl (string relativeUrl, bool usePortletRenderResolve)\r
+ {\r
+ relativeUrl = ResolveClientUrl (relativeUrl);\r
+ if (usePortletRenderResolve) {\r
+ IPortletRenderResponse resp = GetRenderResponse ();\r
+ if (resp != null)\r
+ relativeUrl = resp.createRenderURL (relativeUrl);\r
+ }\r
+ return relativeUrl;\r
+ }\r
+\r
+ internal IPortletRenderResponse GetRenderResponse ()\r
+ {\r
+ return Context.ServletResponse as IPortletRenderResponse;\r
+ }\r
+ }\r
+}\r
#else
[Designer ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
#endif
-public class Page : TemplateControl, IHttpHandler
+public partial class Page : TemplateControl, IHttpHandler
{
#if NET_2_0
private PageLifeCycle _lifeCycle = PageLifeCycle.Unknown;
}
#endif
+#if !TARGET_J2EE
+ internal string PostBackFunctionName {
+ get {
+ return "__doPostBack";
+ }
+ }
+#endif
+
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
public HttpRequest Request
coll = req.QueryString;
}
+#if TARGET_J2EE
+ coll = LoadViewStateForPortlet((WebROCollection)coll);
+#endif
+
if (coll != null && coll ["__VIEWSTATE"] == null && coll ["__EVENTTARGET"] == null)
return null;
writer.WriteLine ("\tvar theForm;\n\tif (document.getElementById) {{ theForm = document.getElementById ('{0}'); }}", formUniqueID);
writer.WriteLine ("\telse {{ theForm = document.{0}; }}", formUniqueID);
- writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {");
+ writer.WriteLine ("\tfunction " + PostBackFunctionName + "(eventTarget, eventArgument) {");
writer.WriteLine ("\t\tif(document.ValidatorOnSubmit && !ValidatorOnSubmit()) return;");
writer.WriteLine ("\t\ttheForm.{0}.value = eventTarget;", postEventSourceID);
writer.WriteLine ("\t\ttheForm.{0}.value = eventArgument;", postEventArgumentID);
return new ObjectStateFormatter (this);
}
- internal object GetSavedViewState ()
+ internal string GetSavedViewState ()
{
return _savedViewState;
}
#if NET_2_0
_lifeCycle = PageLifeCycle.SaveStateComplete;
OnSaveStateComplete (EventArgs.Empty);
+#endif
+
+#if TARGET_J2EE
+ if (SaveViewStateForNextPortletRender())
+ return;
+#endif
+
+#if NET_2_0
_lifeCycle = PageLifeCycle.Render;
#endif
--- /dev/null
+//
+// System.Web.UI.Page.jvm.cs
+//
+// Authors:
+// Eyal Alaluf (eyala@mainsoft.com)
+//
+// (C) 2006 Mainsoft Co. (http://www.mainsoft.com)
+//
+// 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 vmw.@internal.j2ee;
+using javax.servlet.http;\r
+using System.Collections.Specialized;\r
+using System.Web.Hosting;
+
+namespace System.Web.UI
+{
+ public partial class Page
+ {
+ internal string PostBackFunctionName {
+ get {
+#if LATER // Enable when we fix the jscripts not to reference __doPostBack.
+ IPortletRenderResponse resp = GetRenderResponse();
+ if (resp != null)
+ return "__doPostBack_" + resp.getNamespace();
+#endif
+ return "__doPostBack";
+ }
+ }
+
+ // For J2EE portlets we load the view state from the render parameters
+ WebROCollection LoadViewStateForPortlet(WebROCollection coll)
+ {
+ IPortletRenderRequest renderRequest = Context.ServletRequest as IPortletRenderRequest;
+ if (renderRequest != null && (coll == null || coll ["__VIEWSTATE"] == null)) {
+ string mode = renderRequest.getPortletMode();
+ string viewstate = Context.ServletRequest.getParameter("vmw.viewstate." + mode);
+ if (viewstate != null) {
+ if (coll == null)
+ coll = new WebROCollection();
+ else
+ coll.Unprotect();
+ coll["__VIEWSTATE"] = viewstate;
+ coll.Protect();
+ }
+ }
+ return coll;
+ }
+
+ internal bool SaveViewStateForNextPortletRender()
+ {
+ IPortletActionResponse resp = Context.ServletResponse as IPortletActionResponse;
+ IPortletActionRequest req = Context.ServletRequest as IPortletActionRequest;
+ if (req == null)
+ return false;
+
+ if (IsPostBack && String.Compare (Request.HttpMethod, "POST", true) == 0 && !resp.isRedirected())
+ resp.setRenderParameter("vmw.viewstate." + req.getPortletMode(), GetSavedViewState());
+
+ // Stop processing only if we are handling processAction. If we
+ // are handling a postback from render then fall through.
+ return req.processActionOnly() || resp.isRedirected();
+ }
+ }
+}
+2007-01-14 Eyal Alaluf <eyala@mainsoft.com>
+
+ * HttpRequest.jvm.cs, HttpContext.jvm.cs: Added TARGET_J2EE specific files.
+ * HttpContext.cs, HttpResponse.cs, HttpRequest.cs, HttpCookie.cs:
+ Add J2EE Portal support for TARGET_J2EE.
+
2007-01-04 Vladimir Krasnov <vladimirk@mainsoft.com>
* HttpRequest.cs: fixed IsLocal, should check all ip addresses of host
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class HttpContext : IServiceProvider {
+ public sealed partial class HttpContext : IServiceProvider {
internal HttpWorkerRequest WorkerRequest;
HttpApplication app_instance;
HttpRequest request;
ProfileBase profile = null;
LinkedList<IHttpHandler> handlers;
#endif
-#if TARGET_JVM // No remoting support (CallContext) yet in Grasshopper
- static LocalDataStoreSlot _ContextSlot = Thread.GetNamedDataSlot ("Context");
-#endif
-
+
public HttpContext (HttpWorkerRequest wr)
{
WorkerRequest = wr;
// The "Current" property is set just after we have constructed it with
// the 'HttpContext (HttpWorkerRequest)' constructor.
//
-#if TARGET_JVM // No remoting support (CallContext) yet in Grasshopper
- [MonoTODO("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")]
- public static HttpContext Current
- {
- get { return (HttpContext) Thread.GetData (_ContextSlot); }
- set { Thread.SetData (_ContextSlot, value); }
- }
-#else
+#if !TARGET_JVM // No remoting CallContext support in Grasshopper
public static HttpContext Current {
get {
return (HttpContext) CallContext.GetData ("c");
(Request.WorkerRequest.GetLocalAddress () != Request.UserHostAddress);
}
}
-#if TARGET_JVM
- public bool IsDebuggingEnabled { get { return false; } }
-#else
+#if !TARGET_JVM
public bool IsDebuggingEnabled {
get {
#if NET_2_0
--- /dev/null
+//\r
+// System.Web.HttpContext.cs \r
+//\r
+// Author:\r
+// Eyal Alaluf (eyala@mainsoft.com)\r
+//\r
+\r
+//\r
+// Copyright (C) 2005 Mainsoft Co. (http://www.mainsoft.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
+using System.Collections;\r
+using System.Configuration;\r
+using System.Threading;\r
+using javax.servlet.http;\r
+\r
+namespace System.Web {\r
+ \r
+ public sealed partial class HttpContext {\r
+ static LocalDataStoreSlot _ContextSlot = Thread.GetNamedDataSlot ("Context");\r
+ // No remoting support (CallContext) yet in Grasshopper\r
+ [MonoInternalNote("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")]\r
+ public static HttpContext Current\r
+ {\r
+ get { return (HttpContext) Thread.GetData (_ContextSlot); }\r
+ set { Thread.SetData (_ContextSlot, value); }\r
+ }\r
+\r
+ public bool IsDebuggingEnabled { get { return false; } }\r
+\r
+ internal object GetWorkerService(Type t)\r
+ {\r
+ return ((IServiceProvider) WorkerRequest).GetService(t);\r
+ }\r
+\r
+ internal HttpServlet Servlet {\r
+ get { return (HttpServlet)GetWorkerService(typeof(HttpServlet)); }\r
+ }\r
+\r
+ internal HttpServletRequest ServletRequest {\r
+ get { return (HttpServletRequest)GetWorkerService(typeof(HttpServletRequest)); }\r
+ }\r
+\r
+ internal HttpServletResponse ServletResponse {\r
+ get { return (HttpServletResponse)GetWorkerService(typeof(HttpServletResponse)); }\r
+ }\r
+ }\r
+}\r
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+#if TARGET_J2EE
+ // Cookies must be serializable to be saved in the session for J2EE portal
+ [Serializable]
+#endif
public sealed class HttpCookie {
string path = "/";
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class HttpRequest {
+ public sealed partial class HttpRequest {
HttpWorkerRequest worker_request;
HttpContext context;
WebROCollection query_string_nvc;
}
}
+#if TARGET_J2EE
+ // For J2EE portal support we emulate cookies using the session.
+ GetSessionCookiesForPortal (cookies);
+#endif
if (validate_cookies && !checked_cookies){
ValidateCookieCollection (cookies);
checked_cookies = true;
EndSubStream (input);
}
+#if !TARGET_J2EE
//
// Adds the key/value to the form, and sets the argumets to empty
//
EndSubStream (input);
}
-
+#endif
+
bool IsContentType (string ct, bool starts_with)
{
if (starts_with)
}
}
-
-#if TARGET_JVM
- const int INPUT_BUFFER_SIZE = 1024;
-
- void MakeInputStream ()
- {
- if (worker_request == null)
- throw new HttpException ("No HttpWorkerRequest");
-
- // consider for perf:
- // return ((ServletWorkerRequest)worker_request).InputStream();
-
- //
- // Use an unmanaged memory block as this might be a large
- // upload
- //
- int content_length = ContentLength;
-
-#if NET_2_0
- HttpRuntimeSection config = (HttpRuntimeSection) WebConfigurationManager.GetSection ("system.web/httpRuntime");
-#else
- HttpRuntimeConfig config = (HttpRuntimeConfig) HttpContext.GetAppConfig ("system.web/httpRuntime");
-#endif
- if (content_length > (config.MaxRequestLength * 1024))
- throw new HttpException ("File exceeds httpRuntime limit");
-
- byte[] content = new byte[content_length];
- if (content == null)
- throw new HttpException (String.Format ("Not enough memory to allocate {0} bytes", content_length));
-
- int total;
- byte [] buffer;
- buffer = worker_request.GetPreloadedEntityBody ();
- if (buffer != null){
- total = buffer.Length;
- if (content_length > 0)
- total = Math.Min (content_length, total);
- Array.Copy (buffer, content, total);
- } else
- total = 0;
-
-
- buffer = new byte [INPUT_BUFFER_SIZE];
- while (total < content_length){
- int n;
- n = worker_request.ReadEntityBody (buffer, Math.Min (content_length-total, INPUT_BUFFER_SIZE));
- if (n <= 0)
- break;
- Array.Copy (buffer, 0, content, total, n);
- total += n;
- }
- if (total < content_length)
- throw new HttpException (411, "The uploaded file is incomplete");
-
- input_stream = new MemoryStream (content, 0, content.Length, false, true);
- }
-#else
+#if !TARGET_JVM
const int INPUT_BUFFER_SIZE = 32*1024;
TempFileStream GetTempStream ()
throw new HttpException (411, "The request body is incomplete.");
}
#endif
+
internal void ReleaseResources ()
{
Stream stream;
--- /dev/null
+//\r
+// System.Web.HttpRequest.jvm.cs \r
+//\r
+// \r
+// Author:\r
+// Eyal Alaluf <eyala@mainsoft.com>\r
+//\r
+\r
+//\r
+// Copyright (C) 2006 Mainsoft, Co. (http://www.mainsoft.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+using System.Web.Hosting;\r
+using javax.servlet.http;\r
+using System.Web.Configuration;\r
+using System.IO;\r
+using System.Collections;\r
+using vmw.@internal.j2ee;\r
+\r
+namespace System.Web\r
+{\r
+ public sealed partial class HttpRequest\r
+ {\r
+ private const string SessionLock = "vmw.session.lock";\r
+ private const string SessionCookies = "vmw.session.cookies";\r
+\r
+ private static object GetJavaSessionLock (HttpSession javaSession)\r
+ {\r
+ lock (SessionLock) {\r
+ object sessionLock = javaSession.getAttribute (SessionLock);\r
+ if (sessionLock == null) { \r
+ sessionLock = String.Copy (SessionLock);\r
+ javaSession.setAttribute (SessionLock, sessionLock);\r
+ }\r
+ return sessionLock;\r
+ }\r
+ }\r
+\r
+ void LoadWwwForm ()\r
+ {\r
+ HttpServletRequest servletReq = context.ServletRequest;\r
+\r
+ for (java.util.Enumeration e = servletReq.getParameterNames(); e.hasMoreElements() ;) {\r
+ string key = (string) e.nextElement();\r
+ form.Add(key, servletReq.getParameter(key));\r
+ }\r
+ }\r
+\r
+ const int INPUT_BUFFER_SIZE = 1024;\r
+\r
+ void MakeInputStream ()\r
+ {\r
+ if (worker_request == null)\r
+ throw new HttpException ("No HttpWorkerRequest");\r
+\r
+ // consider for perf:\r
+ // return ((ServletWorkerRequest)worker_request).InputStream();\r
+\r
+ //\r
+ // Use an unmanaged memory block as this might be a large\r
+ // upload\r
+ //\r
+ int content_length = ContentLength;\r
+#if NET_2_0\r
+ HttpRuntimeSection config = (HttpRuntimeSection) WebConfigurationManager.GetSection ("system.web/httpRuntime");\r
+#else\r
+ HttpRuntimeConfig config = (HttpRuntimeConfig) HttpContext.GetAppConfig ("system.web/httpRuntime");\r
+#endif\r
+ if (content_length > (config.MaxRequestLength * 1024))\r
+ throw new HttpException ("File exceeds httpRuntime limit");\r
+ \r
+ byte[] content = new byte[content_length];\r
+ if (content == null)\r
+ throw new HttpException (String.Format ("Not enough memory to allocate {0} bytes", content_length));\r
+\r
+ int total;\r
+ byte [] buffer;\r
+ buffer = worker_request.GetPreloadedEntityBody ();\r
+ if (buffer != null){\r
+ total = buffer.Length;\r
+ if (content_length > 0)\r
+ total = Math.Min (content_length, total);\r
+ Array.Copy (buffer, content, total);\r
+ }\r
+ else\r
+ total = 0;\r
+\r
+ buffer = new byte [INPUT_BUFFER_SIZE];\r
+ while (total < content_length) {\r
+ int n;\r
+ n = worker_request.ReadEntityBody (buffer, Math.Min (content_length-total, INPUT_BUFFER_SIZE));\r
+ if (n <= 0)\r
+ break;\r
+ Array.Copy (buffer, 0, content, total, n);\r
+ total += n;\r
+ } \r
+ if (total < content_length)\r
+ throw new HttpException (411, "The uploaded file is incomplete");\r
+ \r
+ input_stream = new MemoryStream (content, 0, content.Length, false, true);\r
+ }\r
+\r
+ internal void GetSessionCookiesForPortal (HttpCookieCollection cookies)\r
+ {\r
+ HttpSession javaSession = context.ServletRequest.getSession(false);\r
+ if (javaSession == null)\r
+ return;\r
+\r
+ object sessionLock = GetJavaSessionLock (javaSession);\r
+ lock (sessionLock) {\r
+ Hashtable sessionCookies = (Hashtable) javaSession.getAttribute (SessionCookies);\r
+ if (sessionCookies == null)\r
+ return;\r
+\r
+ ArrayList expiredCookies = null;\r
+ foreach (string key in sessionCookies.Keys) {\r
+ HttpCookie sessionCookie = (HttpCookie) sessionCookies [key];\r
+ if (sessionCookie.Expires.Ticks != 0 &&\r
+ sessionCookie.Expires.Ticks < DateTime.Now.Ticks) {\r
+ if (cookies [key] != null)\r
+ cookies.Remove (key);\r
+ else {\r
+ if (expiredCookies == null)\r
+ expiredCookies = new ArrayList();\r
+ expiredCookies.Add (key);\r
+ }\r
+ }\r
+ else\r
+ cookies.Set (sessionCookie);\r
+ }\r
+\r
+ if (expiredCookies != null)\r
+ foreach (object key in expiredCookies)\r
+ sessionCookies.Remove (key);\r
+ }\r
+ }\r
+\r
+ internal void SetSessionCookiesForPortal (HttpCookieCollection cookies)\r
+ {\r
+ if (cookies == null || cookies.Count == 0)\r
+ return;\r
+\r
+ HttpServletRequest servletReq = context.ServletRequest;\r
+ bool inPortletMode = servletReq is IPortletRequest;\r
+ bool shouldStoreCookiesCollection = false;\r
+ HttpSession javaSession = servletReq.getSession(false);\r
+\r
+ if (javaSession == null && inPortletMode)\r
+ javaSession = servletReq.getSession(true);\r
+\r
+ if (javaSession == null)\r
+ return;\r
+\r
+ object sessionLock = GetJavaSessionLock (javaSession);\r
+ lock (sessionLock) {\r
+ Hashtable sessionCookies = (Hashtable)javaSession.getAttribute (SessionCookies); \r
+ if (sessionCookies == null)\r
+ if (inPortletMode) {\r
+ sessionCookies = new Hashtable ();\r
+ shouldStoreCookiesCollection = true;\r
+ }\r
+ else\r
+ return;\r
+\r
+ ArrayList sessionStoredCookies = null;\r
+ for (int i=0; i < cookies.Count; i++) {\r
+ HttpCookie cookie = cookies[i];\r
+ if (sessionCookies [cookie.Name] != null || inPortletMode) {\r
+ sessionCookies [cookie.Name] = cookie;\r
+ if (sessionStoredCookies == null)\r
+ sessionStoredCookies = new ArrayList();\r
+ sessionStoredCookies. Add (cookie.Name);\r
+ }\r
+ }\r
+\r
+ if (sessionStoredCookies != null)\r
+ foreach (object key in sessionStoredCookies)\r
+ cookies.Remove ((string) key);\r
+\r
+ if (shouldStoreCookiesCollection)\r
+ javaSession.setAttribute (SessionCookies, sessionCookies);\r
+ }\r
+ }\r
+ }\r
+}\r
using System.Web.Configuration;
using System.Globalization;
using System.Security.Permissions;
+#if TARGET_J2EE
+using vmw.@internal.j2ee;
+#endif
namespace System.Web {
suppress_content = value;
}
}
+
#if NET_2_0
[MonoTODO ("Not implemented")]
public void AddCacheDependency (CacheDependency[] dependencies)
int n = cookies.Count;
for (int i = 0; i < n; i++)
write_headers.Add (cookies.Get (i).GetCookieHeader ());
+#if TARGET_J2EE
+ // For J2EE Portal support emulate cookies by storing them in the session.
+ context.Request.SetSessionCookiesForPortal (cookies);
+#endif
}
-
}
internal void WriteHeaders (bool final_flush)
{
if (headers_sent)
throw new HttpException ("header have been already sent");
+
+#if TARGET_J2EE
+ // In J2EE portal we need to handle Redirect at the processAction phase
+ // using the portlet ActionResponse that will send for us the redirect header.
+ IPortletActionResponse resp = context.ServletResponse as IPortletActionResponse;
+ if (resp != null) {
+ resp.sendRedirect (url);
+ if (endResponse)
+ End ();
+ return;
+ }
+#endif
+
#if NET_2_0
is_request_being_redirected = true;
#endif
<Version>2.0</Version>\r
<JDKName>1.5.0_05</JDKName>\r
<TargetPlatform>0</TargetPlatform>\r
+ <NoWarn>67,168,169,219,414,612,618,649</NoWarn>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Java|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<SkipValidation>True</SkipValidation>\r
<KeepIntermediate>False</KeepIntermediate>\r
<TargetPlatform>0</TargetPlatform>\r
+ <NoWarn>67,168,169,219,414,612,618,649</NoWarn>\r
<AdditionalClassPath>\r
</AdditionalClassPath>\r
</PropertyGroup>\r
<SkipValidation>false</SkipValidation>\r
<KeepIntermediate>false</KeepIntermediate>\r
<TargetPlatform>0</TargetPlatform>\r
+ <NoWarn>67,168,169,219,414,612,618,649</NoWarn>\r
<AdditionalClassPath>\r
</AdditionalClassPath>\r
</PropertyGroup>\r
<Version>2.0</Version>\r
<JDKName>1.5.0_05</JDKName>\r
<TargetPlatform>0</TargetPlatform>\r
+ <NoWarn>67,168,169,219,414,612,618,649</NoWarn>\r
</PropertyGroup>\r
<ItemGroup>\r
<Compile Include="..\..\build\common\Locale.cs">\r
<Compile Include="System.Web.UI\ConflictOptions.cs" />\r
<Compile Include="System.Web.UI\ConstructorNeedsTagAttribute.cs" />\r
<Compile Include="System.Web.UI\Control.cs" />\r
+ <Compile Include="System.Web.UI\Control.jvm.cs" />\r
<Compile Include="System.Web.UI\ControlBuilderAttribute.cs" />\r
<Compile Include="System.Web.UI\ControlCachePolicy.cs" />\r
<Compile Include="System.Web.UI\ControlCollection.cs" />\r
<Compile Include="System.Web\HttpContext.cs">\r
<SubType>Code</SubType>\r
</Compile>\r
+ <Compile Include="System.Web\HttpContext.jvm.cs">\r
+ <SubType>Code</SubType>\r
+ </Compile>\r
<Compile Include="System.Web\HttpCookie.cs">\r
<SubType>Code</SubType>\r
</Compile>\r
<Compile Include="System.Web\HttpParseException.cs" />\r
<Compile Include="System.Web\HttpPostedFile.cs" />\r
<Compile Include="System.Web\HttpRequest.cs" />\r
+ <Compile Include="System.Web\HttpRequest.jvm.cs" />\r
<Compile Include="System.Web\HttpRequestValidationException.cs" />\r
<Compile Include="System.Web\HttpResponse.cs" />\r
<Compile Include="System.Web\HttpResponseHeader.cs" />\r
<Compile Include="System.Web.UI\Page.cs">\r
<SubType>Code</SubType>\r
</Compile>\r
+ <Compile Include="System.Web.UI\Page.jvm.cs">\r
+ <SubType>Code</SubType>\r
+ </Compile>\r
<Compile Include="System.Web.UI\PageParser.jvm.cs" />\r
<Compile Include="System.Web.UI\TemplateControl.jvm.cs" />\r
<Compile Include="System.Web.UI\UserControlControlBuilder.cs">\r
</EmbeddedResource>\r
</ItemGroup>\r
<ItemGroup>\r
+ <Reference Include="j2ee">\r
+ <Private>False</Private>\r
+ <HintPath>..\lib\j2ee.dll</HintPath>\r
+ </Reference>\r
+ <Reference Include="J2EE.Helpers">\r
+ <Private>False</Private>\r
+ <HintPath>..\lib\J2EE.Helpers.dll</HintPath>\r
+ </Reference>\r
<Reference Include="J2SE.Helpers">\r
<Private>False</Private>\r
<HintPath>..\lib\J2SE.Helpers.dll</HintPath>\r
-->\r
<ProjectExtensions>\r
<VisualStudio>\r
- <UserProperties REFS-JarPath-system-configuration="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Configuration.jar" REFS-JarPath-system-data="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Data.jar" REFS-JarPath-system-drawing="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Drawing.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_imageio.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_core.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_codec.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\clibwrapper_jiio.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\mlibwrapper_jai.jar" REFS-JarPath-system-xml="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Xml.jar" REFS-JarPath-system="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.jar" REFS-JarPath-mscorlib="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE 2\jgac\vmw4j2ee_110\mscorlib.jar" REFS-JarPath-rt="..\lib\rt.jar" REFS-JarPath-j2se-helpers="..\lib\J2SE.Helpers.jar" />\r
+ <UserProperties REFS-JarPath-system-configuration="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Configuration.jar" REFS-JarPath-system-data="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Data.jar" REFS-JarPath-system-drawing="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Drawing.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_imageio.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_core.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\jai_codec.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\clibwrapper_jiio.jar;..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\mlibwrapper_jai.jar" REFS-JarPath-system-xml="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Xml.jar" REFS-JarPath-system="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.jar" REFS-JarPath-mscorlib="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE 2\jgac\vmw4j2ee_110\mscorlib.jar" REFS-JarPath-rt="..\lib\rt.jar" REFS-JarPath-j2ee="..\llib\j2ee.jar" REFS-JarPath-j2ee-helpers="..\lib\J2EE.Helpers.jar" REFS-JarPath-j2se-helpers="..\lib\J2SE.Helpers.jar" />\r
</VisualStudio>\r
</ProjectExtensions>\r
</Project>\r