[gwt-contrib] Fix JsonP handling of with multiple modules

2010-01-24 Thread jat

Reviewers: rice+legacy,

Description:
Addresses issue
http://code.google.com/p/google-web-toolkit/issues/detail?id=4386

The problem is that the counter is currently maintained in a Java
static, which means that multiple modules on the same page will allocate
overlapping IDs.

The fix is to use a shared counter as well as a shared callback object.

Please review this at http://gwt-code-reviews.appspot.com/130820

Affected files:
  user/src/com/google/gwt/jsonp/client/JsonpRequest.java


Index: user/src/com/google/gwt/jsonp/client/JsonpRequest.java
===
--- user/src/com/google/gwt/jsonp/client/JsonpRequest.java  (revision 7455)
+++ user/src/com/google/gwt/jsonp/client/JsonpRequest.java  (working copy)
@@ -32,12 +32,12 @@
 public class JsonpRequest {

   /**
-   * Each request will be assigned a new id.
+   * A global JS variable that holds the next index to use.
*/
-  private static int callbackCounter = 0;
+  private static final String CALLBACKS_COUNTER_NAME  
= "__gwt_jsonp_counter__";


   /**
-   * __gwt_jsonp__ is a global object that contains callbacks of pending  
requests.

+   * A global JS object that contains callbacks of pending requests.
*/
   private static final String CALLBACKS_NAME = "__gwt_jsonp__";
   private static final JavaScriptObject CALLBACKS =  
createCallbacksObject(CALLBACKS_NAME);

@@ -49,15 +49,29 @@
* @return The created object.
*/
   private static native JavaScriptObject createCallbacksObject(String  
name) /*-{

-return $wnd[name] = new Object();
+if (!$wnd[name]) {
+  $wnd[name] = new Object();
+}
+return $wnd[name];
   }-*/;

+  /**
+   * @param counterName
+   * @return
+   */
+  private static native int getAndIncrementCallbackCounter(String  
counterName) /*-{

+if (!$wnd[counterName]) {
+  $wnd[counterName] = 0;
+}
+return $wnd[counterName]++;
+  }-*/;
+
   private static Node getHeadElement() {
 return Document.get().getElementsByTagName("head").getItem(0);
   }
-
+
   private static String nextCallbackId() {
-return "I" + (callbackCounter++);
+return "I" + getAndIncrementCallbackCounter(CALLBACKS_COUNTER_NAME);
   }

   private final String callbackId;


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Sample application using GWT Mosaic's Application module

2010-01-24 Thread ggeorg
Hi,

The application module is using a combination of a code generator,
beans bindings, and actions:

Hello World WIKI:

http://code.google.com/p/gwt-mosaic/wiki/ApplicationModule

The sample application is using the Application module and also
PageBus:

http://code.google.com/p/gwt-mosaic/wiki/ContactsApplication

Any comments are welcome.

Sorry for my English.

Thanks,
George.

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors


Re: [gwt-contrib] Re: Please add ClientBundle as optional parameter in each widget cstr

2010-01-24 Thread Ray Ryan
But we'd be available for code reviews…

(Also see TextResource to see how to register the things.)

On Sun, Jan 24, 2010 at 6:02 AM, Ray Ryan  wrote:

> Creating new ResourceGenerators is trivial, and requires no changes to GWT
> (one of the best features of ClientBundle). See TextResourceGenerator for an
> example.
>
> Dan, I'm afraid you can't expect anyone from the GWT team to jump on this
> problem in Q1. We're saturated.
>
>
> On Sun, Jan 24, 2010 at 5:12 AM, dflorey  wrote:
>
>> Any news on this idea? It would be very nice to have Messages/
>> Constants as available resource types to bundle all resources in one
>> place.
>>
>>
>> On Jan 4, 5:26 pm, John Tamplin  wrote:
>> > On Mon, Jan 4, 2010 at 11:24 AM, BobV  wrote:
>> > > On Mon, Jan 4, 2010 at 11:17 AM, dflorey 
>> wrote:
>> > > > The only show stopper I see right is that Messages/Contacts are not
>> > > > yet part of the ClientBundle, so I came up with something like this
>> > > > (copy&paste from branch source):
>> >
>> > > You can bridge them with a GwtCreateResource or add a new
>> > > ResourceGenerator type to ClientBundle that will make Messages /
>> > > Constants a first-class resource type.
>> >
>> > How hard would it be to allow a method returning some subtype of
>> > LocalizableResource in ClientBundle, and have the generated code just do
>> > GWT.create on it automatically?
>> >
>> > --
>> > John A. Tamplin
>> > Software Engineer (GWT), Google
>>
>> --
>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>>
>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] Re: Please add ClientBundle as optional parameter in each widget cstr

2010-01-24 Thread Ray Ryan
Creating new ResourceGenerators is trivial, and requires no changes to GWT
(one of the best features of ClientBundle). See TextResourceGenerator for an
example.

Dan, I'm afraid you can't expect anyone from the GWT team to jump on this
problem in Q1. We're saturated.

On Sun, Jan 24, 2010 at 5:12 AM, dflorey  wrote:

> Any news on this idea? It would be very nice to have Messages/
> Constants as available resource types to bundle all resources in one
> place.
>
>
> On Jan 4, 5:26 pm, John Tamplin  wrote:
> > On Mon, Jan 4, 2010 at 11:24 AM, BobV  wrote:
> > > On Mon, Jan 4, 2010 at 11:17 AM, dflorey 
> wrote:
> > > > The only show stopper I see right is that Messages/Contacts are not
> > > > yet part of the ClientBundle, so I came up with something like this
> > > > (copy&paste from branch source):
> >
> > > You can bridge them with a GwtCreateResource or add a new
> > > ResourceGenerator type to ClientBundle that will make Messages /
> > > Constants a first-class resource type.
> >
> > How hard would it be to allow a method returning some subtype of
> > LocalizableResource in ClientBundle, and have the generated code just do
> > GWT.create on it automatically?
> >
> > --
> > John A. Tamplin
> > Software Engineer (GWT), Google
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] deRpc: RpcServlet.onBeforeRequestDeserialized ?

2010-01-24 Thread George Georgovassilis
Hello All,

I've a case where I need to fiddle with the classloader before RPC
deserializes the request payload. With the RemoteServiceServlet there
was an onBeforeRequestDeserialized method which could be used to
substitute the classloader used by RPC, but I couldn't find an
equivalent for RpcServlet or HybridServiceServlet. What's the way to
go?

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Please add ClientBundle as optional parameter in each widget cstr

2010-01-24 Thread dflorey
Any news on this idea? It would be very nice to have Messages/
Constants as available resource types to bundle all resources in one
place.


On Jan 4, 5:26 pm, John Tamplin  wrote:
> On Mon, Jan 4, 2010 at 11:24 AM, BobV  wrote:
> > On Mon, Jan 4, 2010 at 11:17 AM, dflorey  wrote:
> > > The only show stopper I see right is that Messages/Contacts are not
> > > yet part of the ClientBundle, so I came up with something like this
> > > (copy&paste from branch source):
>
> > You can bridge them with a GwtCreateResource or add a new
> > ResourceGenerator type to ClientBundle that will make Messages /
> > Constants a first-class resource type.
>
> How hard would it be to allow a method returning some subtype of
> LocalizableResource in ClientBundle, and have the generated code just do
> GWT.create on it automatically?
>
> --
> John A. Tamplin
> Software Engineer (GWT), Google

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors