jquery proxy generator in trunk

View: New views
9 Messages — Rating Filter:   Alert me  

jquery proxy generator in trunk

by Ernst Naezer :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

I've just committed a new version of the AjaxProxyGenerator. This includes a JQuery version of the proxy generator and an AbstractAjaxProxyGenerator that allows other generators to be plugged in with a little bit more ease.

There are two changes in the output for parameters marked with a JSONBinder attribute, which I believed where wrong.

For this code:

        [AjaxAction]
        public void ActionReturnJSON([JSONBinder]string test) {
        }

The old version generated a proxy like this:

        actionReturnJSON: function(, callback)
        {
            var r=new Ajax.Request('/controller2/ActionReturnJSON', {    method: 'get', asynchronous: !!callback, onComplete: callback, parameters: '_=&='+Object.toJSON(test)+''}  );
            if(!callback) return r.transport.responseText;
        }

Note the missing 'test' parameter in the function definition, while it's used in the 'toJSON' function. This parameter is now included. Also the EntryKey is respected as a serverside parameter name when specified in the binder attribute. I haven't been able to find the Object.toJSON equivalent in JQuery, so this is currently not supported, if you know what it is, please feel free to send a patch :)

If you want to us this generator over the default Prototype you can override the AjaxProxyGenerator service after Monorail has been initialized. Implement IMonoRailContainerEvents on your global app and make it look something like this:

        #region IMonoRailContainerEvents Members

        public void Created(IMonoRailContainer container)
        {
        }

        public void Initialized(IMonoRailContainer container)
        {
            // Override the default ajax proxy generator. This is done after the container has been initialize.
            // You can't control the order in which the services are being initialized, user defined services are initialized in the first run,
            // but at that moment the ControllerDescriptorProvider and ControllerTree haven't been registered and you get a null value.

            IAjaxProxyGenerator ajaxProxyGenerator = new JQueryAjaxProxyGenerator();
            container.ServiceInitializer.Initialize(ajaxProxyGenerator, container);
            container.AjaxProxyGenerator = ajaxProxyGenerator;
        }

        #endregion

cheers,
Ernst

p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Victor Kornov-2 :: Rate this Message:

| View Threaded | Show Only this Message

Did you actually mean that?

On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ernst Naezer :: Rate this Message:

| View Threaded | Show Only this Message

ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ken Egozi :: Rate this Message:

| View Threaded | Show Only this Message

Ernest - "var" does not play well - we still build with the .net 2.0 compiler


On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ernst Naezer :: Rate this Message:

| View Threaded | Show Only this Message

Yeah, I noticed... should set my local nant to build with 2 by default :( changing it now. sorry

On Thu, Sep 25, 2008 at 5:01 PM, Ken Egozi <egozi13@...> wrote:
Ernest - "var" does not play well - we still build with the .net 2.0 compiler



On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ken Egozi :: Rate this Message:

| View Threaded | Show Only this Message

on that notice, I wonder if we actually need to keep 2005 files.

keeping 2.0 targeting is one thing, but why not use var, initialisers and lambdas?

if there are no committers that still use vs2005 I see no point in keeping the 2005 compatibility.

thought?


On Thu, Sep 25, 2008 at 6:02 PM, Ernst Naezer <ernstnaezer@...> wrote:
Yeah, I noticed... should set my local nant to build with 2 by default :( changing it now. sorry

On Thu, Sep 25, 2008 at 5:01 PM, Ken Egozi <egozi13@...> wrote:
Ernest - "var" does not play well - we still build with the .net 2.0 compiler



On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ernst Naezer :: Rate this Message:

| View Threaded | Show Only this Message

+1 for all the new stuff and removing the 2k5 files :) Are they supported by Mono already ?

On Thu, Sep 25, 2008 at 5:05 PM, Ken Egozi <egozi13@...> wrote:
on that notice, I wonder if we actually need to keep 2005 files.

keeping 2.0 targeting is one thing, but why not use var, initialisers and lambdas?

if there are no committers that still use vs2005 I see no point in keeping the 2005 compatibility.

thought?



On Thu, Sep 25, 2008 at 6:02 PM, Ernst Naezer <ernstnaezer@...> wrote:
Yeah, I noticed... should set my local nant to build with 2 by default :( changing it now. sorry

On Thu, Sep 25, 2008 at 5:01 PM, Ken Egozi <egozi13@...> wrote:
Ernest - "var" does not play well - we still build with the .net 2.0 compiler



On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ken Egozi :: Rate this Message:

| View Threaded | Show Only this Message

http://mareksafar.blogspot.com/2008/07/mono-c-compiler-gets-full-c-30-support.html

On Thu, Sep 25, 2008 at 6:06 PM, Ernst Naezer <ernstnaezer@...> wrote:
+1 for all the new stuff and removing the 2k5 files :) Are they supported by Mono already ?


On Thu, Sep 25, 2008 at 5:05 PM, Ken Egozi <egozi13@...> wrote:
on that notice, I wonder if we actually need to keep 2005 files.

keeping 2.0 targeting is one thing, but why not use var, initialisers and lambdas?

if there are no committers that still use vs2005 I see no point in keeping the 2005 compatibility.

thought?



On Thu, Sep 25, 2008 at 6:02 PM, Ernst Naezer <ernstnaezer@...> wrote:
Yeah, I noticed... should set my local nant to build with 2 by default :( changing it now. sorry

On Thu, Sep 25, 2008 at 5:01 PM, Ken Egozi <egozi13@...> wrote:
Ernest - "var" does not play well - we still build with the .net 2.0 compiler



On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: jquery proxy generator in trunk

by Ernst Naezer :: Rate this Message:

| View Threaded | Show Only this Message

maybe we should make this a poll with a more clear subject :)

On Thu, Sep 25, 2008 at 5:23 PM, Ken Egozi <egozi13@...> wrote:
http://mareksafar.blogspot.com/2008/07/mono-c-compiler-gets-full-c-30-support.html


On Thu, Sep 25, 2008 at 6:06 PM, Ernst Naezer <ernstnaezer@...> wrote:
+1 for all the new stuff and removing the 2k5 files :) Are they supported by Mono already ?


On Thu, Sep 25, 2008 at 5:05 PM, Ken Egozi <egozi13@...> wrote:
on that notice, I wonder if we actually need to keep 2005 files.

keeping 2.0 targeting is one thing, but why not use var, initialisers and lambdas?

if there are no committers that still use vs2005 I see no point in keeping the 2005 compatibility.

thought?



On Thu, Sep 25, 2008 at 6:02 PM, Ernst Naezer <ernstnaezer@...> wrote:
Yeah, I noticed... should set my local nant to build with 2 by default :( changing it now. sorry

On Thu, Sep 25, 2008 at 5:01 PM, Ken Egozi <egozi13@...> wrote:
Ernest - "var" does not play well - we still build with the .net 2.0 compiler



On Thu, Sep 25, 2008 at 5:41 PM, Ernst Naezer <ernstnaezer@...> wrote:
ah hehe :) nice catch ... no, it shouldn't be hard.

On Thu, Sep 25, 2008 at 4:39 PM, Victor Kornov <weexow@...> wrote:
Did you actually mean that?


On Thu, Sep 25, 2008 at 6:34 PM, Ernst Naezer <ernstnaezer@...> wrote:
p.s. the generator uses the default JQuery notation; $.ajax. If you need a safe version you'll have to override it, but that should be very hard.









--








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il








--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---