Re: Theory behind UiBinder that makes TabLayoutPanel work
I'm only just starting to dive into GWT internals but I believe to do this you will need to create a Parser for your widget to be recognized internally by UiBinder. http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/uibinder/elementparsers/TabLayoutPanelParser.java The method error your getting is from the fact that GWT is magically trying to map the attribute which it has failed to deal with in any meaningful way to a method in your class which of course doesn't exist. You'll notice within that parser that barHeight and barUnit are being consumed by the parser. And of course the rest of the parser is about dealing with the child tags that it supports as special. On Mon, Jun 21, 2010 at 11:05 PM, kornhill kornh...@gmail.com wrote: Given the absence of a vertical TabLayoutPanel in GWT, I was trying to patch the TabLayoutPanel code in my local space by copying the TabLayoutPanel source code and modifying it. However, when I use UiBinder to construct my UI, I run into a problem that makes me wonder how UiBinder works behind the scene. First I have my locally modified TabLayoutPanel class, which I name it MyTabLayoutPanel. Then I use it in a UiBinder template like this: ... g:MyTabLayoutPanel barUnit='PX' barHeight='35' g:tab g:header size='7'ABC/g:header g:LabelThis is a test/g:Label /g:tab ... /g:MyTabLayoutPanel When running the program, I ran into the following issues: - Class MyTabLayoutPanel has no appropriate setBarUnit method... - tab not found, obviously UiBinder doesn't recognize the g:tab thing If I switch MyTabLayoutPanel back to the standard TabLayoutPanel, everything works. In fact, to trouble-shoot my problem, I merely copy the original GWT TabLayoutPanel to my app code space and rename it MyTabLayoutPanel without any other modification. When I look at TabLayoutPanel code, I notice the constructor takes a barUnit and a barHeight as arguments. I wonder why widgets in GWT's own SDK do not need to follow the rule of providing an empty constructor or using things like @UiConstructor. Also, if I want to natively write my own widget to support things like g:tab, g:cell etc in UiBinder, how should I do it? Any advices would be highly appreciated. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Does a private variable in Java stays private when compiled to javascript?
I want to allow people to add javascript extensions to my app using an API I'll make with GWT, so I don't want them to be able to be able to access private variables my app uses. The problem is that GWT does symbol obfuscation so there is no way to have a list of unallowed variables. On Jun 19, 5:25 pm, Stefan Bachert stefanbach...@yahoo.de wrote: Hi, I still don't get the need for private var in JavaScript. JavaScript is somewhat the binary for GWT/Java-Code. The use of scopes like private is a concept on Source code level not on Binary level. When you compile C++ code to object code, the object does no more know about private, protected or public. (I am NOT referencing Java since the concepts are not so separated in this language) Stefan Bacherthttp://gwtworld.de On Jun 19, 3:34 pm, Shedokan shedok...@gmail.com wrote: I didn't miss his post I just didn't understand what's a linker so I thought he was talking about something else, either way I don't want my entire script to be private. I am trying to make some sort of API to be usable to other scripts on the page. On 18 יוני, 19:06, Sripathi Krishnan sripathi.krish...@gmail.com wrote: I think you missed Thomas' post. You *CAN* keep your variables private, its just you have to use a different linker. Its just a minor change to your gwt.xml, and with that your entire script will be private. -Sri On 18 June 2010 20:04, Shedokan shedok...@gmail.com wrote: So i'll guess I'll have to make my app completley in javascript, I hope that someday in the future GWT would allow things like this. In javascript it is possible to have a completley private variable, like so: myApp = function(){ var privateVariable = private; // Setter and getter this.setPrivate = function(var){ privateVariable = var; }; this.getPrivate = function(){ return privateVariable; }; }; and as far as I know there is no way to access the privateVariable unless your'e using something that is not javascript. Well, thanks anyway. On 17 יוני, 20:31, Stefan Bachert stefanbach...@yahoo.de wrote: Hi, probably not, I am quite sure that there is a way using (native) JavaScript. However, as long you only code in Java effectively it isprivate. And remember, even in Java it is possible to accessprivatevar from outside. Some OR-mapper doing so. Or your debugger. When your question is about security, never ever dream about that anything is secure in your browser code. Anything you give to a browser is open, at least for a professional. Stefan Bacherthttp://gwtworld.de On Jun 16, 11:23 am, Shedokan shedok...@gmail.com wrote: Hello, I am looking at GWT's features and can't figure out weather a variable declared in java asprivatewill stayprivateonce compiled in GWT. ByprivateI mean unaccessible to anyone except for the constructor or the construtors functions. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Does a private variable in Java stays private when compiled to javascript?
There is a GWT module you can include that might make life a bit easier for you. The second link is the authors blog. If you go through his blog history you'll find references to articles about the module and how it works. http://code.google.com/p/gwt-exporter/ http://timepedia.blogspot.com/ On Tue, Jun 22, 2010 at 12:41 AM, Shedokan shedok...@gmail.com wrote: I want to allow people to add javascript extensions to my app using an API I'll make with GWT, so I don't want them to be able to be able to access private variables my app uses. The problem is that GWT does symbol obfuscation so there is no way to have a list of unallowed variables. On Jun 19, 5:25 pm, Stefan Bachert stefanbach...@yahoo.de wrote: Hi, I still don't get the need for private var in JavaScript. JavaScript is somewhat the binary for GWT/Java-Code. The use of scopes like private is a concept on Source code level not on Binary level. When you compile C++ code to object code, the object does no more know about private, protected or public. (I am NOT referencing Java since the concepts are not so separated in this language) Stefan Bacherthttp://gwtworld.de On Jun 19, 3:34 pm, Shedokan shedok...@gmail.com wrote: I didn't miss his post I just didn't understand what's a linker so I thought he was talking about something else, either way I don't want my entire script to be private. I am trying to make some sort of API to be usable to other scripts on the page. On 18 יוני, 19:06, Sripathi Krishnan sripathi.krish...@gmail.com wrote: I think you missed Thomas' post. You *CAN* keep your variables private, its just you have to use a different linker. Its just a minor change to your gwt.xml, and with that your entire script will be private. -Sri On 18 June 2010 20:04, Shedokan shedok...@gmail.com wrote: So i'll guess I'll have to make my app completley in javascript, I hope that someday in the future GWT would allow things like this. In javascript it is possible to have a completley private variable, like so: myApp = function(){ var privateVariable = private; // Setter and getter this.setPrivate = function(var){ privateVariable = var; }; this.getPrivate = function(){ return privateVariable; }; }; and as far as I know there is no way to access the privateVariable unless your'e using something that is not javascript. Well, thanks anyway. On 17 יוני, 20:31, Stefan Bachert stefanbach...@yahoo.de wrote: Hi, probably not, I am quite sure that there is a way using (native) JavaScript. However, as long you only code in Java effectively it isprivate. And remember, even in Java it is possible to accessprivatevar from outside. Some OR-mapper doing so. Or your debugger. When your question is about security, never ever dream about that anything is secure in your browser code. Anything you give to a browser is open, at least for a professional. Stefan Bacherthttp://gwtworld.de On Jun 16, 11:23 am, Shedokan shedok...@gmail.com wrote: Hello, I am looking at GWT's features and can't figure out weather a variable declared in java asprivatewill stayprivateonce compiled in GWT. ByprivateI mean unaccessible to anyone except for the constructor or the construtors functions. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: ClickHandler on ListBox. Problems in Safari and Chrome
Hi again, So, your list responds to clicks... Maybe if you posted what's exactly in your onClick() method I could help you troubleshooting =/ PS : I've sent you another message, that was about using a handler instead of a listener, 'cause listeners are deprecated. I write it again for other readers because this message does not appear in our conversation. Regards, Jeff On 21 juin, 23:19, chfr christoph.froesc...@gmail.com wrote: Hi Jeff, thank you for your answer. The application respond to clicks. For buttons there is no problem. It also no problem to expand the list, but when I select items from a list the application does not make the changes it should. I think you are right - I need a more in depth investigation of the problem. Best regards chfr On 21 Jun., 09:39, Jeff jfha...@gmail.com wrote: Hi, What functionality exactly do Chrome Safari miss? Don't they respond to the click event at all, or is it deeper in your code? I suppose you already tried it but just in case : start simple with a Window.alert(You clicked on the list!); and then try to make it more complex... PS : sorry for my imperfect English, I'm French ^^ On 19 juin, 00:16, chfr christoph.froesc...@gmail.com wrote: Hello, I'm working on a small GWT application, but I'm experiencing a problem. When I add a ClickListener to a ListBox there is no functionality in Safari and limited functionality in Chrome(both browsers in their newest versions). However in IE and Firefox everything is working fine so I'm wondering where the problem is... I wanted to ask if someone knows a workaround so that my application can support all browsers. best regards chfr -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT 2.0 - Spring Security
Helo Tom, Please take a look at http://code.google.com/p/orcades-gwt-spring/ for MVP integration http://code.google.com/p/orcades-gwt-spring/and http://code.google.com/p/net-orcades-spring/ http://code.google.com/p/net-orcades-spring/You will find some info. On Mon, Jun 21, 2010 at 8:07 PM, Tom thomas.coz...@gmail.com wrote: Hi, I have an GWT 2.0 application using Spring and Hibernate. (GWT-SL GXT) I would like to add a security layer and a profile handler. So I turn on Spring security. I don't find any samples of a GWT 2.0 Spring security 3.0. In fact, I would like a snippet of Spring security configuration. If anyone can help me to find the good way to start? Best regards Tom -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- Computers are useless. They can only give you answers. - Pablo Picasso - -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: MVP Framework in GWT 2.1 M1 ?
The one half of Expenses isnt even MVP. The one you access via Expenses.html is a hard-wired app. That is the one they were showing at Google I/O. The other part, the Scaffold app I believe is what Roo spits out found under Scaffold.html. I'm not sure as to just how much of that has been hand tweaked and how much is straight up codegen. Of course, all of that stuff is still under heavy development. On Mon, Jun 21, 2010 at 11:00 PM, M Shannon mshan...@gmail.com wrote: I've been taking a good look at this 2.1 MVP stuff - and in particular the Expenses example (rev 8291) http://google-web-toolkit.googlecode.com/svn/branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/ I'm certainly not the best developer/architect going round, but I like to think I'm pretty good at reading people's existing code/examples and adapting/running with them as if they were my own. This expenses example is a nightmare to follow. The bindings/wiring of all the pieces both client and server is nuts. I sure hope Spring Roo can generate an excellent CRUD starter application for me based off my domain objects and their relationships, cause there is no way in the world I could have come up with anything like that application. I thought hand-crafiting files that comprise a JSF app was difficult, but this thing takes the cake. I sure hope the IDE has some new tools to support this stuff. On May 27, 11:38 pm, Anton Tanasenko atg.sleepl...@gmail.com wrote: Actually, it is on the javadoc page athttp://google-web-toolkit.googlecode.com/svn/javadoc/2.1/index.html under com.google.gwt.app.place package. It also includes PlaceManager, Activity (presenter) mappings Bikeshed example, though clumpy, sheds plenty of light on how it can be used. On May 27, 3:24 pm, pjulien pjul...@gmail.com wrote: It exists but the javadoc wasn't included for some reason. A presenter is called Activity. I'm guessing to make it more familiar to Android development. You can see the code for activities and places here: http://code.google.com/p/google-web-toolkit/source/browse/branches/2 On May 20, 4:44 am, metrixon metri...@gmail.com wrote: I just downloaded the M1 release ofGWT2.1and was wondering where I can find more information on the MVP framework that will be part ofGWT2.1. I looked around the Javadocs but did not find anything like it. Is the MVP framework already part of the M1 release ? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Million access to GWT Appl ??
Your essentially asking the wrong question. I think its better to think of by how much will GWT or products similar to GWT reduce the load on a server. You have to consider the fact that every user accessing a traditional website backed by a templating engine involves alot of resources for each and every request for new information. Take a web forum for example. I think they are probably one of the least effecient communication mediums and would be very interesting to see a GWT implementation of one. With the status quo web forum you have full page loads happening every single time a user wants to move around on the forum. And if the user wants to see what is new on the forum... you guessed it, full page load. Now, if you consider all the ways that having most of the web forum on the client side and using much more lightweight RPC calls to get new info (and ONLY new info) there would be quite large improvements. I wouldnt be suprised if the resource requirement of a GWT based web forum dropped the load on even the most highly active forums by upwards of 80%, and probably more if you really took the care to setup some proper caching. But regardless of how the server resource load would drop, just the bandwidth drop alone would be a 100% win. 2010/6/21 Jaroslav Záruba jaroslav.zar...@gmail.com: On Mon, Jun 21, 2010 at 9:28 PM, rakesh wagh rake...@gmail.com wrote: If you compare gwt to other js based toolkits, they all behave similar as far as client to server communication is concerned. gwt only makes life simple for the developers. ...and (with comparably complex UI) makes your JavaScript run faster :) Rakesh Wagh On Jun 19, 7:44 pm, manish kumar manish.online2...@gmail.com wrote: Hi, i have gone through many articles on web and found that GWT is not good for an application that has million users access simultaniouly. Is that really true? If not then what should i do make it accessible by million users?Is that really tough job in GWT? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
how do i set the css for DecoratorPanel?
I wanted my DecoratorPanel's border to look like http://img189.imageshack.us/img189/6121/fancyborder1.png where the white space is where my widget is. the problem is when i set the top left corner to be the top left box of the image, i get all the white space stuff as well. how do i crop the image so i only get the plant stuff? thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Devmode vs prod performance
Aha, that explains it. So I need to do some heavy optimization. Thanks for your answer. On Mon, Jun 21, 2010 at 9:46 AM, Chris Boertien chris.boert...@gmail.comwrote: In devmode you are running within a JVM, production is running from the browsers javascript engine. Your probably getting some big bumps from hotspot if your doing something with any major calculations, which means those inner loops are getting optimized a couple of times and are running as asm direct to the cpu On Sun, Jun 20, 2010 at 11:36 PM, Eirik Brandtzæg eir...@eirikb.no wrote: Hello I'm running GWT 2.0.3 and experiencing a performance peak when running devmode, and much slower when running prod. I add Phys2D as a module jar, then I add a bunch of bodies to the physics engine. Each step in the engine takes about 0-1ms when running devmode, but when I build the project and run straight from file (or server) each step takes up to 25ms. When running devmode, is some of the work done outside the browser? Thanks -- Eirik Brandtzæg -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- Eirik Brandtzæg -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Theory behind UiBinder that makes TabLayoutPanel work
superb! that's helpful info. thanks a whole lot. your response leads me to custom element parsers, which prompts me to try figuring out how to register one of my own. and i find one discussion here - http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/4d79f729030527c5 ; and i find relevant code here: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java the above is a bit discouraging because it shows that there is no easy, documented (and probably finalized) way of making a native widget leveraging existing UiBinder facilities, even with GWT 2.1. On Jun 22, 2:37 pm, Chris Boertien chris.boert...@gmail.com wrote: I'm only just starting to dive into GWT internals but I believe to do this you will need to create a Parser for your widget to be recognized internally by UiBinder. http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/... The method error your getting is from the fact that GWT is magically trying to map the attribute which it has failed to deal with in any meaningful way to a method in your class which of course doesn't exist. You'll notice within that parser that barHeight and barUnit are being consumed by the parser. And of course the rest of the parser is about dealing with the child tags that it supports as special. On Mon, Jun 21, 2010 at 11:05 PM, kornhill kornh...@gmail.com wrote: Given the absence of a vertical TabLayoutPanel in GWT, I was trying to patch the TabLayoutPanel code in my local space by copying the TabLayoutPanel source code and modifying it. However, when I use UiBinder to construct my UI, I run into a problem that makes me wonder how UiBinder works behind the scene. First I have my locally modified TabLayoutPanel class, which I name it MyTabLayoutPanel. Then I use it in a UiBinder template like this: ... g:MyTabLayoutPanel barUnit='PX' barHeight='35' g:tab g:header size='7'ABC/g:header g:LabelThis is a test/g:Label /g:tab ... /g:MyTabLayoutPanel When running the program, I ran into the following issues: - Class MyTabLayoutPanel has no appropriate setBarUnit method... - tab not found, obviously UiBinder doesn't recognize the g:tab thing If I switch MyTabLayoutPanel back to the standard TabLayoutPanel, everything works. In fact, to trouble-shoot my problem, I merely copy the original GWT TabLayoutPanel to my app code space and rename it MyTabLayoutPanel without any other modification. When I look at TabLayoutPanel code, I notice the constructor takes a barUnit and a barHeight as arguments. I wonder why widgets in GWT's own SDK do not need to follow the rule of providing an empty constructor or using things like @UiConstructor. Also, if I want to natively write my own widget to support things like g:tab, g:cell etc in UiBinder, how should I do it? Any advices would be highly appreciated. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Million access to GWT Appl ??
Yes, but think that user will ask for more interactivity... resulting in more requests. But, of course, bandwidth, CPU and memory will be saved. They will be saved more is a good architecture is used like a Rest-like server, I think. Olivier On Jun 22, 10:33 am, Chris Boertien chris.boert...@gmail.com wrote: Your essentially asking the wrong question. I think its better to think of by how much will GWT or products similar to GWT reduce the load on a server. You have to consider the fact that every user accessing a traditional website backed by a templating engine involves alot of resources for each and every request for new information. Take a web forum for example. I think they are probably one of the least effecient communication mediums and would be very interesting to see a GWT implementation of one. With the status quo web forum you have full page loads happening every single time a user wants to move around on the forum. And if the user wants to see what is new on the forum... you guessed it, full page load. Now, if you consider all the ways that having most of the web forum on the client side and using much more lightweight RPC calls to get new info (and ONLY new info) there would be quite large improvements. I wouldnt be suprised if the resource requirement of a GWT based web forum dropped the load on even the most highly active forums by upwards of 80%, and probably more if you really took the care to setup some proper caching. But regardless of how the server resource load would drop, just the bandwidth drop alone would be a 100% win. 2010/6/21 Jaroslav Záruba jaroslav.zar...@gmail.com: On Mon, Jun 21, 2010 at 9:28 PM, rakesh wagh rake...@gmail.com wrote: If you compare gwt to other js based toolkits, they all behave similar as far as client to server communication is concerned. gwt only makes life simple for the developers. ...and (with comparably complex UI) makes your JavaScript run faster :) Rakesh Wagh On Jun 19, 7:44 pm, manish kumar manish.online2...@gmail.com wrote: Hi, i have gone through many articles on web and found that GWT is not good for an application that has million users access simultaniouly. Is that really true? If not then what should i do make it accessible by million users?Is that really tough job in GWT? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Dynamic Module Loading
If your need is only to define new view (with few logic), maybe using a descriptive language will be better. You can write a templating engine using GWT like a XUL interpreter or something like that. This is not the best approach for optimized JS (file size, speed...) but may be the best compromise. I think GWT compilation is too heavy to be done on server, and worse, on the fly. Olivier On Jun 21, 4:52 pm, ruds roud...@gmail.com wrote: Hello there, I know that this topic has been circling around for a while and i thought to bring it up again just for the sake of discussion and in case someone else has found an alternative for it. One of our requirements is to be able to load a compiled GWT module at runtime, bc we have a compiler unit that runs on the server where you can define the UI Components of a UI View and customized it per user and language. Since we are compiling all the Views through our compiler unit(Not GWT Compiler) then we dont want to load the screen dynamically. it is much like flex/flash, they do the design through a flash designer and then they compile the MXML and generate the SWFs. at runtime you just load the generated SWFs defined per user/language based on some params. We need to be able to do the same thing in GWT, as now they are asking for a Web 2.0 version, so i thought first of loading the module dynamically then it turned out that this is a bad idea. Any hint over Code Splitting +Deferred Binding?? but will those 2 options work in my case? i need to load the generated js of a View as if you have created it and set its properties per user/language. so if my main Module is the application entry point where i have 4 sections to fill in my UIs then i need to load the UIs as if they are ready in terms of design and add them in their appropriate locations. Dunno if i was clear enough in my explanation but comments/suggestions are welcome. Looking forward to hearing from you. best regards, Rudolf Michael -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Dynamic Module Loading
Well this is similar to the Generator/Factory concepts. They don't want to go with this approach although i was able to load the Factory/Generator class from the server and use it in the client code to generate my UIs from the definitions POJOs. Since they have a flash background, they want to load an INSTANCE of a UI View from the server and plug it in its appropriate location. I have already told them that my UIObjects are not serializable and i cannot get them from the server but then this might be feasible with native js and static html. I am having hard time to convince them that the Generators are not bad. regards, Rudolf Michael On Tue, Jun 22, 2010 at 1:10 PM, Olivier Monaco olivier.mon...@free.frwrote: If your need is only to define new view (with few logic), maybe using a descriptive language will be better. You can write a templating engine using GWT like a XUL interpreter or something like that. This is not the best approach for optimized JS (file size, speed...) but may be the best compromise. I think GWT compilation is too heavy to be done on server, and worse, on the fly. Olivier On Jun 21, 4:52 pm, ruds roud...@gmail.com wrote: Hello there, I know that this topic has been circling around for a while and i thought to bring it up again just for the sake of discussion and in case someone else has found an alternative for it. One of our requirements is to be able to load a compiled GWT module at runtime, bc we have a compiler unit that runs on the server where you can define the UI Components of a UI View and customized it per user and language. Since we are compiling all the Views through our compiler unit(Not GWT Compiler) then we dont want to load the screen dynamically. it is much like flex/flash, they do the design through a flash designer and then they compile the MXML and generate the SWFs. at runtime you just load the generated SWFs defined per user/language based on some params. We need to be able to do the same thing in GWT, as now they are asking for a Web 2.0 version, so i thought first of loading the module dynamically then it turned out that this is a bad idea. Any hint over Code Splitting +Deferred Binding?? but will those 2 options work in my case? i need to load the generated js of a View as if you have created it and set its properties per user/language. so if my main Module is the application entry point where i have 4 sections to fill in my UIs then i need to load the UIs as if they are ready in terms of design and add them in their appropriate locations. Dunno if i was clear enough in my explanation but comments/suggestions are welcome. Looking forward to hearing from you. best regards, Rudolf Michael -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Why appear OPTIONS instead of POST in my RPC calls?
Hello Here is my problem: When I call my rpc from inside the war everything works well, but when I call the same rpc calls from the same GWT javascript client stuff but injected into an external web site the rpc makes the call with HTTP OPTIONS instead of HTTP POST method. I'm very interested in calling the rpc this way... How can I make this work? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Initializer blocks
Hi, I tried to do the following: University u = new University() { { setName(Ahmed); setPrice(500); } }; University u2 = new University(); u2.setName(Hassan); u2.setPrice(1000); Window.alert(u.toString() + \n + u.name + \n + u.getPrice() + \n \n + u2.toString() + \n + u2.name + \n + u2.getPrice()); I go the following result: erp.client.tes...@1bafdb4 Ahmed 500.0 erp.client.univers...@1663655 Hassan 1000.0 I don't really understand how did the first object report it self as being the parent object. May someone explain, please? And is this behavior GWT specific or applies to desktop java too? Thank you. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Events from SelectionCell in CellTable - GWT 2.1 M1
Hi, How does one handle events from cells in a CellTable( specifically a SelectionCell ) ? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Initializer blocks
Not the parent object. Your class is erp.client.Test but the class of u is erp.client.Test$1. $1 means the first anonymous class of Test. This is a Java behavior. Olivier On Jun 22, 1:22 pm, ahhat...@gmail.com ahhat...@gmail.com wrote: Hi, I tried to do the following: University u = new University() { { setName(Ahmed); setPrice(500); } }; University u2 = new University(); u2.setName(Hassan); u2.setPrice(1000); Window.alert(u.toString() + \n + u.name + \n + u.getPrice() + \n \n + u2.toString() + \n + u2.name + \n + u2.getPrice()); I go the following result: erp.client.tes...@1bafdb4 Ahmed 500.0 erp.client.univers...@1663655 Hassan 1000.0 I don't really understand how did the first object report it self as being the parent object. May someone explain, please? And is this behavior GWT specific or applies to desktop java too? Thank you. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Dynamic Module Loading
I don't know the full story, but maybe the problem is not a technical one. You can't change technology (Flash = GWT) without doing some change in your architecture... If they don't want to explore new way, they must keep their technology. Olivier On Jun 22, 12:34 pm, rudolf michael roud...@gmail.com wrote: Well this is similar to the Generator/Factory concepts. They don't want to go with this approach although i was able to load the Factory/Generator class from the server and use it in the client code to generate my UIs from the definitions POJOs. Since they have a flash background, they want to load an INSTANCE of a UI View from the server and plug it in its appropriate location. I have already told them that my UIObjects are not serializable and i cannot get them from the server but then this might be feasible with native js and static html. I am having hard time to convince them that the Generators are not bad. regards, Rudolf Michael On Tue, Jun 22, 2010 at 1:10 PM, Olivier Monaco olivier.mon...@free.frwrote: If your need is only to define new view (with few logic), maybe using a descriptive language will be better. You can write a templating engine using GWT like a XUL interpreter or something like that. This is not the best approach for optimized JS (file size, speed...) but may be the best compromise. I think GWT compilation is too heavy to be done on server, and worse, on the fly. Olivier On Jun 21, 4:52 pm, ruds roud...@gmail.com wrote: Hello there, I know that this topic has been circling around for a while and i thought to bring it up again just for the sake of discussion and in case someone else has found an alternative for it. One of our requirements is to be able to load a compiled GWT module at runtime, bc we have a compiler unit that runs on the server where you can define the UI Components of a UI View and customized it per user and language. Since we are compiling all the Views through our compiler unit(Not GWT Compiler) then we dont want to load the screen dynamically. it is much like flex/flash, they do the design through a flash designer and then they compile the MXML and generate the SWFs. at runtime you just load the generated SWFs defined per user/language based on some params. We need to be able to do the same thing in GWT, as now they are asking for a Web 2.0 version, so i thought first of loading the module dynamically then it turned out that this is a bad idea. Any hint over Code Splitting +Deferred Binding?? but will those 2 options work in my case? i need to load the generated js of a View as if you have created it and set its properties per user/language. so if my main Module is the application entry point where i have 4 sections to fill in my UIs then i need to load the UIs as if they are ready in terms of design and add them in their appropriate locations. Dunno if i was clear enough in my explanation but comments/suggestions are welcome. Looking forward to hearing from you. best regards, Rudolf Michael -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2Bunsubs cr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Initializer blocks
Thanks for the quick reply, I found out that I was totally misunderstanding what the {{ }} means ... thank you... On Jun 22, 2:58 pm, Olivier Monaco olivier.mon...@free.fr wrote: Not the parent object. Your class is erp.client.Test but the class of u is erp.client.Test$1. $1 means the first anonymous class of Test. This is a Java behavior. Olivier On Jun 22, 1:22 pm, ahhat...@gmail.com ahhat...@gmail.com wrote: Hi, I tried to do the following: University u = new University() { { setName(Ahmed); setPrice(500); } }; University u2 = new University(); u2.setName(Hassan); u2.setPrice(1000); Window.alert(u.toString() + \n + u.name + \n + u.getPrice() + \n \n + u2.toString() + \n + u2.name + \n + u2.getPrice()); I go the following result: erp.client.tes...@1bafdb4 Ahmed 500.0 erp.client.univers...@1663655 Hassan 1000.0 I don't really understand how did the first object report it self as being the parent object. May someone explain, please? And is this behavior GWT specific or applies to desktop java too? Thank you. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
incubator SCrollTable scroll position.
Hello Folks, I am using incubator gen2 ScrollTable. I have a use case, wherein i have to detect that when the user has scrolled to the last row (or somewhere around the last row), then load a fresh set of rows in the table, via a rpc call. TO achieve this i have extented ScrollTable and implemented HasScrollHandlers. public class UbqScrollTable extends ScrollTable implements HasScrollHandlers { public UbqScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable) { super(dataTable, headerTable); } public HandlerRegistration addScrollHandler(ScrollHandler handler) { return addDomHandler(handler, ScrollEvent.getType()); } } And later in some other view i am setting up this table, and the initial data to go along with it. When trying to get the scroll position, i do this. st is the scrolltable. st.addScrollHandler(new ScrollHandler() { public void onScroll(ScrollEvent event) { int top=event.getRelativeElement().getScrollTop(); int scrollHeight=event.getRelativeElement().getScrollHeight(); int left=event.getRelativeElement().getScrollLeft(); int width=event.getRelativeElement().getScrollWidth(); GWT.log(Scroll data: top: +top+, scrollHeight: +scrollHeight+, y: +event.getNativeEvent().getScreenY()+, x: +event.getNativeEvent().getScreenX()+, left: +left+, wiodth: +width+, class: +event.getSource().getClass().getName()); GWT.log(Top: +st.getDataTable().getElement().getScrollTop()); GWT.log(Height: +st.getDataTable().getElement().getScrollHeight()); //st.getElement().setScrollTop(50); } }); All the values top, height, left, width are all constant and not changing. I know there is something wrong with my understanding. Please help. How do i get the scroll position, or Detect that the user is viewing the last few rows of the scroll table so load new rows from backend? Please help. Thanks, Subhro. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Why appear OPTIONS instead of POST in my RPC calls?
Probably because you are trying to make cross-domain requests (a different port, domain or protocol) See this post - http://groups.google.com/group/google-web-toolkit/browse_thread/thread/a080757856163097 http://groups.google.com/group/google-web-toolkit/browse_thread/thread/a080757856163097 --Sri On 22 June 2010 16:19, enTropy Fragment poemcompi...@gmail.com wrote: Hello Here is my problem: When I call my rpc from inside the war everything works well, but when I call the same rpc calls from the same GWT javascript client stuff but injected into an external web site the rpc makes the call with HTTP OPTIONS instead of HTTP POST method. I'm very interested in calling the rpc this way... How can I make this work? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: PushButton in UiBinder
Under here: http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/PushButton.html Go to the super class (CustomButton) and it's detailed there. On Jun 17, 11:54 am, david david.l...@restonrobotics.org wrote: On Jun 14, 1:26 pm, David Grant davidgr...@gmail.com wrote: Anyone know how to put aPushButtonin to a ui.xml file and set the up/down text or up/down image? Dave Use a @uihandler annoration in the java class to change the button text . You may also want to apply a style to changed the button to look as if it is pressed. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Need to build a WYSIWYG XML editor
You may want to simply wrap the excellent code editor CodeMirror (http://marijn.haverbeke.nl/codemirror/). Someone has already wrapped it for GWT: http://code.google.com/p/gwt-codemirror/ -Richard On Jun 18, 1:45 am, NS Gopikrishnan nksgopikrish...@gmail.com wrote: Hi all, I want to develop a WYSIWYG XML editor for a custom schema. I am new to GWT. I wanted to know whether GWT will be the right framework for that. * Whether XML DOM builders are available. * I need to provide the view side using CSS. * Validation of XML for every change in nodes. * view the XML while editing the view (Not necessarily simultaneously) Thanks in advance ! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Implementing login and maintaining sessions
Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); . private void userAuthentication() { if (this.userNameField.getValueAsString().equals()) Window.alert(username must not be empty.); else { loginService = GWT.create(LoginService.class); String username = this.userNameField.getValueAsString(); String password = this.passwordField.getValueAsString(); this.loginService.login(username, password, new AsyncCallbackLoginResponse() { public void onFailure(Throwable caught) { Window.alert(server side failure: + caught); } public void onSuccess(LoginResponse result) { if (result.isLoginSuccess()){ Window.Location.replace(./../Main.html?gwt.codesvr= 127.0.0.1:9997); } else Window.alert(username or password invalid.); } }); } } ON SERVER SIDE (the login method): public LoginResponse login(String username, String password) { LoginPService loginService = ServiceLocator.getLoginService(); Person person = null; try { ManageLogs.info(Try to login for user: +username); person = loginService.getUserByUsername(username); if (person == null){ return new LoginResponse(false, false); } else if (!loginService.checkPassword(password)){ return new LoginResponse(false, false); } } catch (Throwable e) { return new LoginResponse(false, false); } ManageLogs.info(Login sucessful for user: +username); LoginResponse response = new LoginResponse(); response.setLoginSuccess(true); /*Creates de session*/ MainSession padroesSession = mainSession.getInstance(); mainSession.setRequest(getThreadLocalRequest()); mainSession.setUser(person); return response; } THE MainSession private static MainSession mainSession=null; public static MainSession getInstance(){ if(mainSession == null){ mainSession = new MainSession(); return mainSession; } else { return mainSession; } } private MainSession(){ } private static final String USER_SESSION = userSession; private
Re: Implementing login and maintaining sessions
Ok I just answered 1.5 of my questions: #1- It actually does work, using getThreadLocalRequest().getSession(). My test had failed for an alternate reason. #4- (second half) Sessions are per-browser, so multiple tabs in the same browser share sessions, but cross-browser tabs do not. The other questions remain... On Jun 22, 9:16 am, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); . private void userAuthentication() { if (this.userNameField.getValueAsString().equals()) Window.alert(username must not be empty.); else { loginService = GWT.create(LoginService.class); String username = this.userNameField.getValueAsString(); String password = this.passwordField.getValueAsString(); this.loginService.login(username, password, new AsyncCallbackLoginResponse() { public void onFailure(Throwable caught) { Window.alert(server side failure: + caught); } public void onSuccess(LoginResponse result) { if (result.isLoginSuccess()){ Window.Location.replace(./../Main.html?gwt.codesvr= 127.0.0.1:9997); } else Window.alert(username or password invalid.); } }); } } ON SERVER SIDE (the login method): public LoginResponse login(String username, String password) { LoginPService loginService = ServiceLocator.getLoginService(); Person person = null; try { ManageLogs.info(Try to login for user: +username); person = loginService.getUserByUsername(username); if (person == null){ return new LoginResponse(false, false); } else if (!loginService.checkPassword(password)){ return new LoginResponse(false, false); } } catch (Throwable e) { return new LoginResponse(false, false); } ManageLogs.info(Login sucessful for user: +username); LoginResponse response = new LoginResponse(); response.setLoginSuccess(true); /*Creates de session*/ MainSession padroesSession = mainSession.getInstance(); mainSession.setRequest(getThreadLocalRequest());
Re: UIBinder Benefits?
Almost all of the problem's listed below are bad advice and I suggest you disregard them. Except for the it's a graphic designer mindset - this statement is correct. Thankfully we no longer need to code our layout and style in java! The main problem I have with UiBinder is that when you try and use it with the MVP architecture best practice, you have to boilerplate all the parent/child (view) widget's. Which means you'll see a lot of. @UiField(provided=true) You then need to programatically decide/code when the uibinder should be called. I would still recommend it. On Mon, Jun 21, 2010 at 11:47 PM, Stefan Bachert stefanbach...@yahoo.dewrote: Hi, I don't use UiBinder in general. It may be nice for some hacks. UiBinder has a lot of problems * a further language. No way to debug it * limited to a set of widgets * it is a graphic designer mindset (we do this app, the app is our concern) not a developer mindset (we do this class of apps, we separate concerns) * no clear separation, no SoC. A big bunch of widgets and css-styles. * no separation of theme/skin When you watch the video with Ray Rian (gwt wave, discussion) you clearly read between the lines that he doesn't like UiBinder, too. The only advantage I see, it is faster to create a fragment of HTML code than to build it via java/javascript code. But how often you will create a html-structure? In a good design this will rarely happen. And performance is one but the only design goal. Stefan Bachert http://gwtworld.de On Jun 21, 3:23 am, spierce7 spier...@gmail.com wrote: Does using the UI Binder provide any benefits? I watched some of the I/ O conference, and it seemed like they made reference that the UI Binder using the browsers native rendering engine (or something like that), and it being a lot faster, but they didn't really specify whether that was the layout panels, or using the ui binder. What are the benefits to using the UIBinder, and where can I learn to use it? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Error: Permission denied for domain2 to get property Location.href from domain1.
I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
Actually since my application has multiple segments, I cannot use cross site linker. PageA really has nothing to do with the script, but it seems GWT hosted.html tries to get Location.href from the parent window rather than the iFrame. On Jun 22, 9:41 am, randasin r4nd7...@gmail.com wrote: I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
Hi, I don't want to say stupidities, but isn't it a violation of the SOP (Same Origin Policy)? If so, i recommend you to have a look here http://en.wikipedia.org/wiki/Same_origin_policy and here http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP Regards, Jeff On 22 juin, 15:41, randasin r4nd7...@gmail.com wrote: I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Million access to GWT Appl ??
Hi manish, the opposite is true. An AJAX/GWT-approach reduces dramatically the load from the servers. I showed in an estimation that with GWT/AJAX a server is able to drive 10-50 times more clients, compared to classical web technology like JSP, JSF So using GWT is also a green IT topic. The german reading audience may look at http://gwtworld.de/bin/Offen/Strom%20sparen%20mit%20GWT Till now I do not see any technology which is using energy and performance more efficient and responsible than GWT. I dont know exactly how many users are using Google wave. Google wave is a GWT application, it is fast, and I guess it has millions of users. When you are really going to develop an applications for millions of users, you urgently should use GWT. Stefan Bachert http://gwtworld.de On Jun 20, 4:44 am, manish kumar manish.online2...@gmail.com wrote: Hi, i have gone through many articles on web and found that GWT is not good for an application that has million users access simultaniouly. Is that really true? If not then what should i do make it accessible by million users?Is that really tough job in GWT? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Implementing login and maintaining sessions
FYI, On Tue, Jun 22, 2010 at 2:16 PM, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? It works fine for multiple users because for each new request a new different session ID will be generated, and so a new session. 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? I need those 2 because I can olny load the content if the authentication was successful, and when that happens on the server side, the http session is created and also the user information is loaded. An only after this is possible to load the content. With a cookie, then on the client side I need to access to that cookie... actually I didn't check that, but the access to the cookie is not done on the server side, also ? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? The session time out control actual do more than that it uses the gwt Timer to initialize an schedule in a new thread for a defined period of time, and the alert the user when the session is about to expire, if there the user do any event it will send a keep alive and re-initialize the schedule, otherwise invalidate session e redirects to Login page. Across tabs will keep the same session until the user logout or the session time out happens. Across browsers a new session is nedded. Hope it helps :) Bruno Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); . private void userAuthentication() { if (this.userNameField.getValueAsString().equals()) Window.alert(username must not be empty.); else { loginService = GWT.create(LoginService.class); String username = this.userNameField.getValueAsString(); String password = this.passwordField.getValueAsString(); this.loginService.login(username, password, new AsyncCallbackLoginResponse() { public void onFailure(Throwable caught) { Window.alert(server side failure: + caught); } public void onSuccess(LoginResponse result) { if (result.isLoginSuccess()){ Window.Location.replace(./../Main.html?gwt.codesvr= 127.0.0.1:9997); } else Window.alert(username or password invalid.); } }); } } ON SERVER SIDE (the login method): public LoginResponse login(String username, String password) { LoginPService loginService = ServiceLocator.getLoginService(); Person person = null; try {
Re: Implementing login and maintaining sessions
FYI, On Tue, Jun 22, 2010 at 2:33 PM, Rodrigo ipi...@gmail.com wrote: Ok I just answered 1.5 of my questions: #1- It actually does work, using getThreadLocalRequest().getSession(). My test had failed for an alternate reason. great! it works with me too :) #4- (second half) Sessions are per-browser, so multiple tabs in the same browser share sessions, but cross-browser tabs do not. That's true The other questions remain... see my other answer On Jun 22, 9:16 am, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); . private void userAuthentication() { if (this.userNameField.getValueAsString().equals()) Window.alert(username must not be empty.); else { loginService = GWT.create(LoginService.class); String username = this.userNameField.getValueAsString(); String password = this.passwordField.getValueAsString(); this.loginService.login(username, password, new AsyncCallbackLoginResponse() { public void onFailure(Throwable caught) { Window.alert(server side failure: + caught); } public void onSuccess(LoginResponse result) { if (result.isLoginSuccess()){ Window.Location.replace(./../Main.html?gwt.codesvr= 127.0.0.1:9997); } else Window.alert(username or password invalid.); } }); } } ON SERVER SIDE (the login method): public LoginResponse login(String username, String password) { LoginPService loginService = ServiceLocator.getLoginService(); Person person = null; try { ManageLogs.info(Try to login for user: +username); person = loginService.getUserByUsername(username); if (person == null){ return new LoginResponse(false, false); } else if (!loginService.checkPassword(password)){ return new LoginResponse(false, false); } } catch (Throwable e) { return new LoginResponse(false, false); } ManageLogs.info(Login sucessful for user: +username);
Re: Implementing login and maintaining sessions
Not sure if I understood your question.. But yes, the cookie is accessed both at the client and at the server. So the server would set it to 'loggedIn=true' upon a successful login, and clear it whenever the user logs out OR if the server gets a request for private information but the Session indicates that the user is not logged in.. In that case, it clears the cookie and fails with an AuthenticationException. The client redirects the user to login whenever an AuthenticationException is received. Thus, the usage of the cookie allows the client to save some RPC calls to the server. If a page doesn't contain private user-specific content, but should still look different based on whether the user is logged in or not, then the client can go off the cookie's information and decide whether to display a 'Login' or 'Logout' button, for example. On Jun 22, 9:54 am, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: FYI, On Tue, Jun 22, 2010 at 2:16 PM, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? It works fine for multiple users because for each new request a new different session ID will be generated, and so a new session. 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? I need those 2 because I can olny load the content if the authentication was successful, and when that happens on the server side, the http session is created and also the user information is loaded. An only after this is possible to load the content. With a cookie, then on the client side I need to access to that cookie... actually I didn't check that, but the access to the cookie is not done on the server side, also ? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? The session time out control actual do more than that it uses the gwt Timer to initialize an schedule in a new thread for a defined period of time, and the alert the user when the session is about to expire, if there the user do any event it will send a keep alive and re-initialize the schedule, otherwise invalidate session e redirects to Login page. Across tabs will keep the same session until the user logout or the session time out happens. Across browsers a new session is nedded. Hope it helps :) Bruno Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); . private void userAuthentication() { if (this.userNameField.getValueAsString().equals()) Window.alert(username must not be empty.); else { loginService =
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
It shouldn't violated SOP since PageA really has nothing to do with PageB. PageA just displays PageB in an iframe. PageB scipts should do their work in the context of host page B. and I have no intention to violate SOP. But I don't know GWT bootstrap well enough to understand what hosted.html gwtOnLoad function is doing that causes the violation? Feels like a bug. Did I misunderstand SOP? On Jun 22, 9:52 am, Jeff jfha...@gmail.com wrote: Hi, I don't want to say stupidities, but isn't it a violation of the SOP (Same Origin Policy)? If so, i recommend you to have a look herehttp://en.wikipedia.org/wiki/Same_origin_policy and herehttp://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP Regards, Jeff On 22 juin, 15:41, randasin r4nd7...@gmail.com wrote: I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
Ok I confirmed it's not SOP violation in my design. The script runs fine in web mode. It's only considered a violation in host/ development mode. I am not sure how to configure the DevMode to get around the violation. Any thoughts would be appreciated. On Jun 22, 10:07 am, randasin r4nd7...@gmail.com wrote: It shouldn't violated SOP since PageA really has nothing to do with PageB. PageA just displays PageB in an iframe. PageB scipts should do their work in the context of host page B. and I have no intention to violate SOP. But I don't know GWT bootstrap well enough to understand what hosted.html gwtOnLoad function is doing that causes the violation? Feels like a bug. Did I misunderstand SOP? On Jun 22, 9:52 am, Jeff jfha...@gmail.com wrote: Hi, I don't want to say stupidities, but isn't it a violation of the SOP (Same Origin Policy)? If so, i recommend you to have a look herehttp://en.wikipedia.org/wiki/Same_origin_policy and herehttp://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP Regards, Jeff On 22 juin, 15:41, randasin r4nd7...@gmail.com wrote: I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
Actually, if i'm not wrong, the JavaScript that your client recieves comes from page B, on domain 2. Well, you got this error : Permission denied for Domain2 to get property Location.href from Domain1. It looks like you're trying to use something situated on domain 1 (Location.href) from domain 2. This is very likely to be a SOP violation. But i'm not considering me as an expert so if we could have confirmation from someone more experimented... ^^ On 22 juin, 16:07, randasin r4nd7...@gmail.com wrote: It shouldn't violated SOP since PageA really has nothing to do with PageB. PageA just displays PageB in an iframe. PageB scipts should do their work in the context of host page B. and I have no intention to violate SOP. But I don't know GWT bootstrap well enough to understand what hosted.html gwtOnLoad function is doing that causes the violation? Feels like a bug. Did I misunderstand SOP? On Jun 22, 9:52 am, Jeff jfha...@gmail.com wrote: Hi, I don't want to say stupidities, but isn't it a violation of the SOP (Same Origin Policy)? If so, i recommend you to have a look herehttp://en.wikipedia.org/wiki/Same_origin_policy and herehttp://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP Regards, Jeff On 22 juin, 15:41, randasin r4nd7...@gmail.com wrote: I have two pages, the first page contains an iFrame that loads the second page. The two pages are on different hosts. The GWT application runs in the second page. To be more precise, let the first page = PageA, and the second page = PageB - PageA is on Domain1. It has iFrame src points to PageB - PageB is on Domain2. It has my GWT application. When I go to PageA, FireFox gives me this error Error: Permission denied for Domain2 to get property Location.href from Domain1. Source File: My gwt app path/hosted.html?My GWT application name Line: 227 I tried adding xs linker (add-linker name=xs/) to my module xml; it doesn't seem to work. I am not sure if I am using it correctly. Does anyone know of a solution to this issue? Any thoughts would be appreciated. Also I would appreciate if someone can refer me the location of the official GWT documentation on cross site linker. Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
It's this line on hosted.html in GWT bootstrap process that causes SOP violation Line 227: var url = topWin.location.href; I am guessing GWT only uses hosted.html in DevMode. That's why there is no violation in web mode? Does anyone have insights on a workaround? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT eclipse plugin source code
Hi, At this time, we haven't set a date for open-sourcing the code. Rajeev On Thu, Jun 10, 2010 at 9:06 AM, fedy2 defav...@gmail.com wrote: Hi, when the GWT eclipse plugin source code will be released? Thanks, Federico -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Regarding GWT 2.0.3
hi Andres, I m encountering the following errors while running the application. Plz check them The site for access:http://www.ndbc.noaa.gov/data/5day2/42040_5day.txt [WARN] Server class 'com.google.gwt.json.client.JSONException' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/rakesh/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/gwt-user.jar' to the web app classpath for this session For additional info see: file:/C:/Users/rakesh/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html [WARN] Server class 'com.google.gwt.visualization.client.AbstractDataTable$ColumnType' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/D:/My%20Work/Visualization%20files/gwt-visualization-1.1.0/gwt-visualization.jar' to the web app classpath for this session For additional info see: file:/C:/Users/rakesh/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html [WARN] Server class 'com.google.gwt.widgetideas.table.client.RowPagingListenerCollection' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/D:/cosemware/BuoyApplication/lib/gwt-incubator-10-25-07.jar' to the web app classpath for this session For additional info see: file:/C:/Users/rakesh/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/doc/helpInfo/webAppClassPath.html INSIDE GET MEASUREMENTS1 Number of lines read:0 java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2 at java.util.Vector.get(Unknown Source) at edu.msstate.gri.server.BuoyDataServiceImpl.getMeasurements1(BuoyDataServiceImpl.java:150) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) INSERT INTO feature_of_interest VALUES ('id_42040','Station 42040','Freeport, TX 60 NM South of Freeport, TX',GeometryFromText('POINT(29.18 88.21)',4236),'http://www.ndbc.noaa.gov'); INSERT INTO procedure VALUES ('urn:ogc:def:procedure:DACT-42040','DACT buoy station','Buoy for DACT PAYLOAD)'); INSERT INTO proc_phen VALUES ('urn:ogc:def:procedure:DACT-42040','urn:ogc:def:phenomenon:windDirection'); INSERT INTO proc_foi VALUES ('urn:ogc:def:procedure:DACT-42040','id_42040'); org.postgresql.util.PSQLException: ERROR: duplicate key violates unique constraint procedure_pkey at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337) at
Re: Implementing login and maintaining sessions
Hey, I try your approach with cookies and seems to works fine! Thanks :) On Tue, Jun 22, 2010 at 3:07 PM, Rodrigo ipi...@gmail.com wrote: Not sure if I understood your question.. But yes, the cookie is accessed both at the client and at the server. So the server would set it to 'loggedIn=true' upon a successful login, and clear it whenever the user logs out OR if the server gets a request for private information but the Session indicates that the user is not logged in.. In that case, it clears the cookie and fails with an AuthenticationException. The client redirects the user to login whenever an AuthenticationException is received. Thus, the usage of the cookie allows the client to save some RPC calls to the server. If a page doesn't contain private user-specific content, but should still look different based on whether the user is logged in or not, then the client can go off the cookie's information and decide whether to display a 'Login' or 'Logout' button, for example. On Jun 22, 9:54 am, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: FYI, On Tue, Jun 22, 2010 at 2:16 PM, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? It works fine for multiple users because for each new request a new different session ID will be generated, and so a new session. 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? I need those 2 because I can olny load the content if the authentication was successful, and when that happens on the server side, the http session is created and also the user information is loaded. An only after this is possible to load the content. With a cookie, then on the client side I need to access to that cookie... actually I didn't check that, but the access to the cookie is not done on the server side, also ? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? The session time out control actual do more than that it uses the gwt Timer to initialize an schedule in a new thread for a defined period of time, and the alert the user when the session is about to expire, if there the user do any event it will send a keep alive and re-initialize the schedule, otherwise invalidate session e redirects to Login page. Across tabs will keep the same session until the user logout or the session time out happens. Across browsers a new session is nedded. Hope it helps :) Bruno Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel(); LogUtils.info(Showing Login page); loginButton = new Button(Login); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication();
Re: Error: Permission denied for domain2 to get property Location.href from domain1.
Created a bug report: http://code.google.com/p/google-web-toolkit/issues/detail?id=5049q=same%20origin%20policy%20violation On Jun 22, 10:32 am, randasin r4nd7...@gmail.com wrote: It's this line on hosted.html in GWT bootstrap process that causes SOP violation Line 227: var url = topWin.location.href; I am guessing GWT only uses hosted.html in DevMode. That's why there is no violation in web mode? Does anyone have insights on a workaround? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
JSNI reference in iframe
I have some JSNI code that assign a function to a variable in the window as suggested in JSNI document: Calling a Java Method from Handwritten JAvascript (http://code.google.com/webtoolkit/doc/latest/ DevGuideCodingBasicsJSNI.html#calling) The problem is if the JSNI code runs inside an iframe, then the function is registered in the top window, and I get a Object expected (or Object is null) script error on IE. How could I make sure the function is registered in the iframe, and not to the window? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Need to build a WYSIWYG XML editor
Hi, I'm not sure this answers your question, but GWT does have an XML API, see [1]. FWIW I did do some work previously with GWT and XML, but the lack of a createElementNS method was a real blocker. You can seach an XML document in a namespace aware manner, because the Node interface has a getNamespaceURI() method, but you cannot build an XML document with namespaces, except by constructing the document as text, then calling XMLParser.parse(). If you want to create a code editor, that may be a valid workaround for you. I did write some convenience code to work around this a while ago, see [2], however this is a bit of a hack, and I've since moved away from GWT to using XForms and Orbeon [3] for that particular project, because of the much better XML support. Hth Alistair [1] http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/xml/client/package-summary.html [2] http://code.google.com/p/dsn-chassis/source/browse/trunk/generic/lib/gwt/src/main/java/org/cggh/chassis/generic/xml/client/ [3] http://www.orbeon.com/ On Jun 18, 1:45 am, NS Gopikrishnan nksgopikrish...@gmail.com wrote: Hi all, I want to develop a WYSIWYG XML editor for a custom schema. I am new to GWT. I wanted to know whether GWT will be the right framework for that. * Whether XML DOM builders are available. * I need to provide the view side using CSS. * Validation of XML for every change in nodes. * view the XML while editing the view (Not necessarily simultaneously) Thanks in advance ! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Modify Java source file at compile time, possible?
Kevin, It depends one the which generator can know which interface. If the generators can know both interfaces, you can create only one generator. All code generator is pushed to sub classes like IntrerfaceAWriter and InterfaceBWriter. The generator looks for several interfaces from the marker interface and call the corresponding writers. If one generator (generatorB) can know the other interface (intefaceA) but not the reverse, it can add a field like: private InterfaceA wrapped = GWT.create(InterfaceA.class); Then it implements all InterfaceA's methods and forward call to the wrapped field. If none of them can know the other interface (like generators from two frameworks), you can create an InterfaceC that extends InterfaceA and InterfaceB. You add a generator that proxy all call to some wrapped field like in the previous case, but for the two interfaces. Do you like it? Olivier On 14 juin, 16:14, Kevin Qiu kevin.jing@gmail.com wrote: e.g., class Foo implements InterfaceA, InterfaceB { } and in .gwt.xml file, you have generate-with class=generatorA when-type-assignable class=InterfaceA / /generate-with generate-with class=generatorB when-type-assignable class=InterfaceB / /generate-with How do I write generatorA and generatorB so that they generate the same file, but cascading the effects? Obviously, I'm only looking for general directions, not specific details. Thanks, On Sun, Jun 13, 2010 at 8:10 PM, Olivier Monaco olivier.mon...@free.frwrote: Not sure it's a problem. It's depends on you exact use case. Can you give me a more exact example? Olivier On 12 juin, 01:16, Kevin Qiu kevin.jing@gmail.com wrote: thanks for the reply. the problem is (I should've pointed out) that my Foo class is already managed through dependency injection container (gin), which means there's already a deferred binding implementation generated by ginjector. On Fri, Jun 11, 2010 at 5:58 PM, Olivier Monaco olivier.mon...@free.fr wrote: Hi Kevin, You can rewrite your Foo class as: public class Foo implements MagicClass { �...@trace �...@secured public void bar() { } } Then, associate a generator for sub-types of MagicClass and use GWT.create to instantiate a new Foo. GWT.create(Foo.class); So your generator will be called. It can generate a FooImpl class that extends the Foo class and override the bar method as follow: public class FooImpl extends Foo { public void bar() { Log.log(begin of bar); try { SecurityContext.checkAuthorized(); super.bar(); } finally { Log.log(end of bar); } } } Where Log.log print some logs and SecurityContext.checkAuthorized throws an error is the user is not authorized. This could be funny and not really hard to do. Olivier On 11 juin, 18:09, Kevin Qiu kevin.jing@gmail.com wrote: Hi, I know GWT can generate Java source code with deferred binding. But sometimes, I don't want to generate a new implementation, but based on some annotations, I want to have the ability of injecting code at compile time. e.g., with the class below public class Foo { @Log public void bar() { @CheckPermission dosomething(); } } At compile time, I want to have the ability to get the annotations available on items, and inject code according to my application logic. So here, the compiler should see: public class Foo { public void bar() { log(begin); if (hasPermission()) { doSomething(); } else { error(); } } } with the extra code being injected. I'm wondering if anything in GWT allows me to do that? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com google-web-toolkit%2bunsubscr...@googlegroups.comgoogle-web-toolkit%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To
Re: JSNI reference in iframe
The iframe is the GWT iframe or another one? Do you have a usecase ? Olivier On 22 juin, 18:37, randasin r4nd7...@gmail.com wrote: I have some JSNI code that assign a function to a variable in the window as suggested in JSNI document: Calling a Java Method from Handwritten JAvascript (http://code.google.com/webtoolkit/doc/latest/ DevGuideCodingBasicsJSNI.html#calling) The problem is if the JSNI code runs inside an iframe, then the function is registered in the top window, and I get a Object expected (or Object is null) script error on IE. How could I make sure the function is registered in the iframe, and not to the window? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
cursor while server processing
hi, is there any way to change the cursor (doesn't matter its position on screen or if it is over certain widget) during an operation in the server side? I've tried adding a cursor style to the main panel with addStyleName method, but it doesn't work. I don't know if it is for the server call (in other situations it works properly) or because I only change the cursor for the main panel. Thanks in advance! Iván -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: cursor while server processing
I don't why it doesn't work, but I'd rule out the fact that there's a server call in process. That shouldn't affect styling whatsoever. On Jun 22, 2:06 pm, Iván Navarro ivan.navarro...@gmail.com wrote: hi, is there any way to change the cursor (doesn't matter its position on screen or if it is over certain widget) during an operation in the server side? I've tried adding a cursor style to the main panel with addStyleName method, but it doesn't work. I don't know if it is for the server call (in other situations it works properly) or because I only change the cursor for the main panel. Thanks in advance! Iván -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Safari 5 - (RangeError): Maximum call stack size exceeded
There is an Issue 4393 about this bug. I've applyed dunhamsteve's patch and also in all binarySearch() functions in Arrays.java and Collections.java changed: - final int mid = low + ((high - low) 1) + final int length = high - low; + final int half = length 1; + final int mid = low + half; and just repacked gwt-user.jar replacing those files. This worked for me. On 16 июн, 03:12, DenNukem alt...@gmail.com wrote: So did you end up rebuilding the GWT itself? Where do I start to apply this patch? On Jun 9, 4:31 pm, dunhamst...@gmail.com dunhamst...@gmail.com wrote: This is occurring for us in the Arrays.mergeSort() code. A reduced testcase (which looks like the binarySearch code) is in the webkit bug tracking system at: https://bugs.webkit.org/show_bug.cgi?id=40355 It appears that in some complex expressions the right shift operator is not evaluating correctly. Assigning the result of the right shift to a temporary variable and then using it appears to make the problem go away. As a temporary fix, we're patching Arrays.java:mergeSort() to assign the result of the right shift to a temporary variable before using it. If you're using binary search you'd need to patch those functions as well. It's a bit of a hack, but it seems to work. I've included our patch below, in case it is helpful to someone. diff --git a/super/com/google/gwt/emul/java/util/Arrays.java b/super/ com/google/ index 89dcc33..b7ba6fa 100644 --- a/super/com/google/gwt/emul/java/util/Arrays.java +++ b/super/com/google/gwt/emul/java/util/Arrays.java @@ -1322,7 +1322,8 @@ public class Arrays { // recursively sort both halves, using the array as temp space int tempLow = low + ofs; int tempHigh = high + ofs; - int tempMid = tempLow + ((tempHigh - tempLow) 1); + int half = length 1; + int tempMid = tempLow + half; mergeSort(array, temp, tempLow, tempMid, -ofs, comp); mergeSort(array, temp, tempMid, tempHigh, -ofs, comp); -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: cursor while server processing
Try applying the style to a Widget the mouse cursor will certainly hover above and that is not covered by other Widgets, for example a Button. Make sure you place the cursor above that Widget. I'm not sure if this will help, but in case the Style is properly changed on that Widget it should also be changed on the RootPanel. In that case it may simply be completely covered and MouseEvents are not propagated to the RootPanel. I had a similar problem regarding MouseEventHandlers. Anyway I'm not sure if browser side changes to the cursor icon are based on MouseEvents so it really is just a suggestions. Give it a try though. Andreas 2010/6/22 Rodrigo ipi...@gmail.com I don't why it doesn't work, but I'd rule out the fact that there's a server call in process. That shouldn't affect styling whatsoever. On Jun 22, 2:06 pm, Iván Navarro ivan.navarro...@gmail.com wrote: hi, is there any way to change the cursor (doesn't matter its position on screen or if it is over certain widget) during an operation in the server side? I've tried adding a cursor style to the main panel with addStyleName method, but it doesn't work. I don't know if it is for the server call (in other situations it works properly) or because I only change the cursor for the main panel. Thanks in advance! Iván -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- Andreas Horst Sohnreystraße 8, 30173 Hannover Tel. +49 (0)170 4162251, mailto:horst.andrea...@googlemail.com -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Implementing login and maintaining sessions
You are right about multiple session's, I have to implements an store to keep the sessions ID in order to be able to have multiple users logged in without losing their sessions :) On Tue, Jun 22, 2010 at 4:38 PM, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: Hey, I try your approach with cookies and seems to works fine! Thanks :) On Tue, Jun 22, 2010 at 3:07 PM, Rodrigo ipi...@gmail.com wrote: Not sure if I understood your question.. But yes, the cookie is accessed both at the client and at the server. So the server would set it to 'loggedIn=true' upon a successful login, and clear it whenever the user logs out OR if the server gets a request for private information but the Session indicates that the user is not logged in.. In that case, it clears the cookie and fails with an AuthenticationException. The client redirects the user to login whenever an AuthenticationException is received. Thus, the usage of the cookie allows the client to save some RPC calls to the server. If a page doesn't contain private user-specific content, but should still look different based on whether the user is logged in or not, then the client can go off the cookie's information and decide whether to display a 'Login' or 'Logout' button, for example. On Jun 22, 9:54 am, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: FYI, On Tue, Jun 22, 2010 at 2:16 PM, Rodrigo ipi...@gmail.com wrote: Thanks for the response... A few questions come up: 1. I'm using an HttpServlet for authentication, along with RemoteServiceServlets for GWT-RPCs. But if I create an HttpSession in my authentication servlet, I cannot seem to access it on the RemoteServiceServlet... How am I supposed to access it? Example: // In authentication HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // ... req.getSession().setAttribute(user, new User(testUser)); // creates a session if it didn't exist beforehand // ... } // In GWT RPC servlet public ListOffer getOffers(int productId) { // ... User user = (User) getThreadLocalRequest().getSession().getAttribute(user); // returns null // ... } 2. Why are you using a MainSession singleton object? I don't see it... Wouldn't it also fail once you have multiple users logged in at the same time? It works fine for multiple users because for each new request a new different session ID will be generated, and so a new session. 3. In your Main page, you're doing 2 sequential RPC calls before you render anything: one to check logged in status, and one to load page contents. Is this advisable or could it be avoided somehow? For example, the server could set up a cookie with 'loggedIn=true' so that you can skip the first RPC at least. And whenever you actually have to fetch private content, the server can fail with a AuthenticationException if the user is in fact not logged in. So if a malicious user fakes the cookie to say he's logged in, the most he'll ever see is a 'Logout' button when there shouldn't be one. Any other place that needs to show user-specific information would still be protected at the server. Does this make sense? What are the drawbacks of this? I need those 2 because I can olny load the content if the authentication was successful, and when that happens on the server side, the http session is created and also the user information is loaded. An only after this is possible to load the content. With a cookie, then on the client side I need to access to that cookie... actually I didn't check that, but the access to the cookie is not done on the server side, also ? 4. I assume the SessionTimeoutControl() object just sends an RPC to the server every x seconds to check if the session is still alive or not, correct? How do HttpSessions work across tabs and browsers? If my user has 2 tabs open at my site, does he have 1 or 2 sessions? If it's 2 browsers? The session time out control actual do more than that it uses the gwt Timer to initialize an schedule in a new thread for a defined period of time, and the alert the user when the session is about to expire, if there the user do any event it will send a keep alive and re-initialize the schedule, otherwise invalidate session e redirects to Login page. Across tabs will keep the same session until the user logout or the session time out happens. Across browsers a new session is nedded. Hope it helps :) Bruno Thanks! On Jun 21, 6:58 pm, Bruno Lopes bruno.lourenco.lo...@gmail.com wrote: HI, maybe this peace of code can Help :) : You can use two modules/entries, one for the login other after login on login Client side: public void onModuleLoad() { this.setLoginPanel();
RPC call does not work after upgrading to Safari 5
I have a get app that has been working fine with Safari 4 for some time. It appears that my initial RPC call no longer works after upgrading today to Safari 5. The app works fine in Chrome, IE, and Firefox. I un-installed Safari 5 and re-installed version 4 and the app no longer works in that version either. Any suggestions as to why the app will not work in the Safari browser? Thank You -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: JSNI reference in iframe
another iframe The setup is like this: domain1/page1 has an iframe that loads domain2/page2 domain2/page2 has the GWT module. In other words DOM looks like: domain/page1 iframe (domain/page2) iframe (gwt) The module has the JSNI code that is intended to register a function in page2 so other none-gwt components (again in page2) can use, something like $wnd.myfunc = function() {...} And in my HTML, I do input type=button onclick=myfunc()/input I know it feels like I am trying to some cross site stuff between page1 and page2, but I am not. Page1 is simply a wrapper for displaying page2. All GWT and JSNI codes are intended to use within Page2 alone. That's where I am having problem. I think because GWT itself is in iframe and $wnd is intended to get top window, it works in most cases when the host page is in the top window and on the same domain. But my hostpage is an iframe and different domain. Right now my workaround is to declare a new javascript object on page2, like var myfuncHelper = new Object(); then my JSNI looks like $wnd.myfuncHelper.myfunc = function() {...} and the onclick=myfuncHelper.myfunc() That works. I am wondering if there is better implementation though. On Jun 22, 1:29 pm, Olivier Monaco olivier.mon...@free.fr wrote: The iframe is the GWT iframe or another one? Do you have a usecase ? Olivier On 22 juin, 18:37, randasin r4nd7...@gmail.com wrote: I have some JSNI code that assign a function to a variable in the window as suggested in JSNI document: Calling a Java Method from Handwritten JAvascript (http://code.google.com/webtoolkit/doc/latest/ DevGuideCodingBasicsJSNI.html#calling) The problem is if the JSNI code runs inside an iframe, then the function is registered in the top window, and I get a Object expected (or Object is null) script error on IE. How could I make sure the function is registered in the iframe, and not to the window? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: gwt 2.1 m1 questions
I am sorry I cannot help you but I join your request for a better documentation of 2.1 Data Widget :p On 22 juin, 03:27, asianCoolz second.co...@gmail.com wrote: 1. Is CellListPlacePickerView show all items even for huge list? not using async? 2. Is activitymanager using aysnc? 3. i assume CellListPlacePickerView will be replaced in future,because mentioned in sourcecode -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
?gwt.codesvr=127.0.0.1:9997, GWT debugging
Wouldn't it be better to copy the *gwt.codesvr* parameter also to a cookie? (Probably with maxAge -1 so it would last only till browser exit.) ...so we could debug even after clicking a link. Regards J. Záruba -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Safari 5 - (RangeError): Maximum call stack size exceeded
Hi, Has the workaround been included in the codebase somewhere? Is there a chance that there will be a point release soon? Regards, Pascal -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
blank page in IE8
Hi, I have problem on my GWT application. its working correctly under chrome and Firefox but not IE. can someone help me to troubleshoot it, is it CSS problem or scripts problem? thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
[gwt-contrib] Re: List.subList not fully compatibile with java.util.List interface. (issue620802)
Here are some more comments about the things that rice pointed out. http://gwt-code-reviews.appspot.com/620802/diff/8001/9002 File user/test/com/google/gwt/emultest/java/util/ListTestBase.java (right): http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode199 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:199: public void testSubList() { @rice. Why do you think this would fail? I have simulated this in 1.5 compliance environment and this worked as expected. On 2010/06/21 20:40:24, Dan Rice wrote: I think this test will fail (passes in JDK 1.6): ArrayListString wrappedList = new ArrayListString(); wrappedList.add(A); wrappedList.add(B); ListString sub = wrappedList.subList(1, 1); sub.remove(A); // no A in range // original list is unchanged assertEquals(2, wrappedList.size()); assertEquals(A, wrappedList.get(0)); http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode212 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:212: assertEquals(testList, Arrays.asList(2, 6, 4)); (E remove(int index)) returns the removed element. (boolean remove(Object o)) returns true if the list contained element. Otherwise false. The first definition is applied here. I think there's nothing wrong with this test case. http://gwt-code-reviews.appspot.com/620802/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: UiBinder. Code style for constant parsers.
Pretty much everything we've done so far has been limited to automatically exposing the Java-level APIs in all their ugliness. The h/v alignment values are implemented somewhat manually, but for things like enums I really like the idea that they can be exposed completely automatically. On the other hand, it would be nice to have prettier names. Perhaps we could find some sort of convention for exposing prettier names for [pseudo-]enums. What about a shortName() method on the enum itself? Hm... Yes, I think that it is possible to create some generic parser for enum-like constants. However because they are not real enums, following things come to mind: 1. During registration in AttributeParsers we will need to pass list of values; 2. To check for shortName() using reflection; 3. To test that each such constant parser instance works correctly, I would write special ui.xml file. Also one more thing worries me. Do you think that it is OK to add into GWT classes on this level information which is used only by some presentation of GWT? I mean that parsing ui.xml files is part of UiBinder, so it should be problem of UiBinder how to parse it. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] UiBinder. Parser for TextAlignConstant (issue612803)
Reviewers: jgw, Description: It uses friendly names. I will post patch with adding support for names like this for horizontal/vertical alignments (in addition, not replace to keep compatibility with existing code) later. Please review this at http://gwt-code-reviews.appspot.com/612803/show Affected files: user/src/com/google/gwt/uibinder/attributeparsers/AttributeParsers.java user/src/com/google/gwt/uibinder/attributeparsers/TextAlignConstantParser.java user/test/com/google/gwt/uibinder/UiBinderJreSuite.java user/test/com/google/gwt/uibinder/attributeparsers/TextAlignConstantParser_Test.java user/test/com/google/gwt/uibinder/test/UiJavaResources.java -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: List.subList not fully compatibile with java.util.List interface. (issue620802)
I think we need a few more tests to be sure that sublists are working as intended. If things are problematic after adding more tests, another approach that might help would be to move the fromIndex and toIndex fields into AbstractList -- then fix every list operation to respect those bounds rather than using 0 and array.length or whatever. Then sublist becomes trivial. http://gwt-code-reviews.appspot.com/620802/diff/8001/9002 File user/test/com/google/gwt/emultest/java/util/ListTestBase.java (right): http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode199 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:199: public void testSubList() { My concern is that since there is no overriden version of remove(Object), the superclass version won't respect fromIndex and toIndex, so it will remove the element from the base list even though it is not part of the sublist. It's possible that this works fine -- I haven't tried to examine all the superclass code -- but in any case I would like to see it as part of the test case. http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode212 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:212: assertEquals(testList, Arrays.asList(2, 6, 4)); OK http://gwt-code-reviews.appspot.com/620802/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Escaping HTML strings from the client as a good practice to avoid XSS vulnerabilities in apps th... (issue619803)
Reviewers: mmendez, Description: Escaping HTML strings from the client as a good practice to avoid XSS vulnerabilities in apps the build off of the default app. Review by: mmen...@google.com Please review this at http://gwt-code-reviews.appspot.com/619803/show Affected files: M user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc Index: user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc === --- user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc (revision 8291) +++ user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc (working copy) @@ -22,7 +22,34 @@ String serverInfo = getServletContext().getServerInfo(); String userAgent = getThreadLocalRequest().getHeader(User-Agent); + +// Escape data from the client to avoid cross-site script vulnerabilities. +input = escapeHtml(input); +userAgent = escapeHtml(userAgent); + return Hello, + input + !brbrI am running + serverInfo + .brbrIt looks like you are using:br + userAgent; } + + /** + * p + * Escape an html string. + * /p + * p + * Escaping data received from the client helps to prevent cross-site script + * vulnerabilities. In this application, it less important because the client + * data is sent back to the same client. However, its good practice to always + * escape client data, especially if the data might be shared with other + * clients. + * /p + * + * @param html the html string to escape + * @return the escaped string + */ + private String escapeHtml(String html) { +if (html == null) { + return null; +} +return html.replaceAll(, lt;).replaceAll(, gt;); + } } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: List.subList not fully compatibile with java.util.List interface. (issue620802)
LGTM but would like to see more tests if possible http://gwt-code-reviews.appspot.com/620802/diff/8001/9002 File user/test/com/google/gwt/emultest/java/util/ListTestBase.java (right): http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode199 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:199: public void testSubList() { OK, I see that the implementation uses iterators for these operations, which will respect the list bounds. So I'm not as concerned although more tests would still be a good thing. http://gwt-code-reviews.appspot.com/620802/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Any ETA for 2.1?
Le 21 juin 2010 14:29, Chris Ramsdale cramsd...@google.com a écrit : While this shouldn't be taken as a binding set of dates, we are looking to wrap up a 2.1 RC in late Q3, with GA release in early Q4. On 21 juin, 20:50, Joel Webber j...@google.com wrote: We're also working to get the new widgets libraries stabilized well before that, though we don't have hard dates. One thing to look for would be the removal of the Note: This class is new and its interface subject to change. warnings in the javadoc. Or just ask here :) Thanks guys, this is really good news for us, as it means we'll be able to use ActivityManager and data presentation widgets (and eventually RequestFactory if it suits our needs) -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: List.subList not fully compatibile with java.util.List interface. (issue620802)
On 2010/06/21 21:54:34, markovuksanovic wrote: in javadoc is says The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.) Does this mean that once a sublist view is defined, and the underlaying list is modified - is the afore mentioned sublist view, sort of, invalidated? I would say yes, but would like to hear other comments as well. I tried this on sun jdk and once I modified the underlaying list and afterwords tried to access and/or modify the sublist view I got exceptions thrown. Yes, it means if you modify the underlying list in a way that would invalidate iterators on it (such as adding an element), the behavior of the sublist is undefined. That means it could work properly, it might throw exceptions, or it might totally destroy the underlying data structure. In general, the Sun JRE detects such conditions and throws exceptions, but we don't do so in our JRE - the overhead would be rather large. http://gwt-code-reviews.appspot.com/620802/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: List.subList not fully compatibile with java.util.List interface. (issue620802)
Thanks for the explanations. I'll add some tests and if necessary override the remove method. http://gwt-code-reviews.appspot.com/620802/diff/8001/9002 File user/test/com/google/gwt/emultest/java/util/ListTestBase.java (right): http://gwt-code-reviews.appspot.com/620802/diff/8001/9002#newcode199 user/test/com/google/gwt/emultest/java/util/ListTestBase.java:199: public void testSubList() { I'll add some tests to verify the behavior. http://gwt-code-reviews.appspot.com/620802/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Escaping HTML strings from the client as a good practice to avoid XSS vulnerabilities in apps th... (issue619803)
Sorry to step in without being invited (though I was earlier told that it should be expected when developing in the open), but... (see below) http://gwt-code-reviews.appspot.com/619803/diff/1/2 File user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc (right): http://gwt-code-reviews.appspot.com/619803/diff/1/2#newcode53 user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc:53: return html.replaceAll(, lt;).replaceAll(, gt;); is harmless, contrary to . This should read: return html.replaceAll(, amp;).replaceAll(, lt;); http://gwt-code-reviews.appspot.com/619803/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Early feedback on PlaceController/ActivityManager
Aside from not being plugged with the History (yet), the one thing that bothers me (a little), something that I have in my current (very own) PlaceManager that isn't in PlaceController/ActivityManager, and contrary to History-binding has an impact on the API, is plumbing between PlaceController and WindowClosingEvent. As it is done now, a PlaceChangeRequestedEvent can be rejected, which prevents a PlaceChangeEvent from being fired subsequently. At the Activity level, the current activity can refuse to stop (willStop() returns false). I suppose the intended use that the PlaceChangeRequestedEvent handlers (or the current Activity) eventually displays a Window.confirm(...) to condition the call to reject() (or the return value of willStop()). All is well, but what happens when the user closes the browser window/ tab? In my PlaceManager, the PlaceChangingEvent is very similar to the WindowClosingEvent, i.e. you can cancel the action, but you have to give a message to be shown to the user. The Window.confirm(...) call is done in a ConfirmationCallback given to the PlaceManager. What it means is that on a WindowClosingEvent, a PlaceChangingEvent is fired. If a handler wants to request cancellation, it sets a message on the event. The message is then set on the WindowClosingEvent so that the browser shows its own confirmation dialog, with the application- provided message. In other cases (i.e. not WindowClosingEvent, that can be a history- driven or programmatic navigation), when a PlaceChangingEvent is rejected, the message is passed to the ConfirmationCallback, which returns a boolean, which conditions the firing of a PlaceChangeEvent. (in my original design, the ConfirmationCallback could be asynchronous to allow uses of a DialogBox for instance, but it has all sorts of implications –i.e. what happens when a WindowClosingEvent or history's ValueChangeEvent is fired while confirming a previous navigation request?– so I only implemented the synchronous confirmation, in the form of a boolean confirm(String message) method on the ConfirmationCallback interface). My design supposes a PlaceChangingEvent's rejection is always subject to a confirmation (by the user), which is maybe not the case in the proposed GWT's PlaceChangeRequestedEvent. Do not hesitate to ask for more information on my PlaceManager. Ray (and other G-men; I put Ray in Cc as he's the only one of you who committed on these classes), I have a still-draft detailed description of my PlaceManager and particularly where I started from and how I've arrived there in Wave ( exported to Google Docs), but it's in French (the idea was that Google Docs could help me in translating it to English, so if you want, I can give you access to an automatically- translated-by-Docs version). -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8292 committed - Adding AbstractListViewAdapter#getViews() to get the views associated ...
Revision: 8292 Author: jlaba...@google.com Date: Tue Jun 22 05:03:01 2010 Log: Adding AbstractListViewAdapter#getViews() to get the views associated with an adapter. Also adding some tests for com.google.gwt.view.client. Review at http://gwt-code-reviews.appspot.com/601801 Review by: j...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8292 Added: /trunk/user/test/com/google/gwt/view /trunk/user/test/com/google/gwt/view/client /trunk/user/test/com/google/gwt/view/client/AbstractListViewAdapterTest.java /trunk/user/test/com/google/gwt/view/client/AsyncListViewAdapterTest.java /trunk/user/test/com/google/gwt/view/client/DefaultNodeInfoTest.java /trunk/user/test/com/google/gwt/view/client/MockPagingListView.java /trunk/user/test/com/google/gwt/view/client/RangeTest.java Modified: /trunk/user/src/com/google/gwt/user/cellview/client/CellListImpl.java /trunk/user/src/com/google/gwt/view/client/AbstractListViewAdapter.java /trunk/user/src/com/google/gwt/view/client/DefaultSelectionModel.java /trunk/user/src/com/google/gwt/view/client/Range.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/view/client/AbstractListViewAdapterTest.java Tue Jun 22 05:03:01 2010 @@ -0,0 +1,311 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.view.client; + +import com.google.gwt.junit.client.GWTTestCase; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Test cases for {...@link AbstractListViewAdapter}. + */ +public class AbstractListViewAdapterTest extends GWTTestCase { + + /** + * A mock {...@link AbstractListViewAdapter} used for testing. + * + * @param T the data type + */ + static class MockListViewAdapterT extends AbstractListViewAdapterT { + +private ListViewT lastChanged; + +public void assertLastRangeChanged(ListViewT expected) { + assertEquals(expected, lastChanged); +} + +public void clearLastRangeChanged() { + lastChanged = null; +} + +@Override +protected void onRangeChanged(ListViewT view) { + lastChanged = view; +} + } + + @Override + public String getModuleName() { +return com.google.gwt.view.View; + } + + public void testAddRemoveView() { +MockListViewAdapterString adapter = new MockListViewAdapterString(); + +// Test with no views. +adapter.updateDataSize(10, true); +adapter.assertLastRangeChanged(null); + +// Add the first view. +MockPagingListViewString view0 = new MockPagingListViewString(); +adapter.addView(view0); +adapter.assertLastRangeChanged(view0); + +// Add a second view. +MockPagingListViewString view1 = new MockPagingListViewString(); +adapter.addView(view1); +adapter.assertLastRangeChanged(view1); + +// Try to remove an invalid view. +MockPagingListViewString invalidView = new MockPagingListViewString(); +try { + adapter.removeView(invalidView); + fail(Expected IllegalStateException); +} catch (IllegalStateException e) { + // Expected. +} + +// Remove a valid view. +adapter.removeView(view1); + +// Make sure the remaining view triggers the delegate. +adapter.assertLastRangeChanged(view1); +view0.setRange(100, 20); +view1.setRange(100, 20); // Shouldn't affect the adapter. +adapter.assertLastRangeChanged(view0); + } + + public void testGetRanges() { +AbstractListViewAdapterString adapter = createListViewAdapter(); + +// No ranges. +{ + Range[] ranges = adapter.getRanges(); + assertEquals(0, ranges.length); +} + +// One range. +{ + MockPagingListViewString view0 = new MockPagingListViewString(); + view0.setRange(0, 10); + adapter.addView(view0); + Range[] ranges = adapter.getRanges(); + assertEquals(1, ranges.length); + assertEquals(new Range(0, 10), ranges[0]); +} + +// Multiple ranges. +{ + MockPagingListViewString view1 = new MockPagingListViewString(); + view1.setRange(3, 10); + adapter.addView(view1); + MockPagingListViewString view2 = new MockPagingListViewString(); + view2.setRange(30, 35); + adapter.addView(view2); + SetRange ranges = new HashSetRange(); + for (Range range : adapter.getRanges()) { +ranges.add(range); + } + assertEquals(3,
[gwt-contrib] [google-web-toolkit] r8293 committed - Escaping HTML strings from the client as a good practice to avoid XSS ...
Revision: 8293 Author: jlaba...@google.com Date: Tue Jun 22 05:23:16 2010 Log: Escaping HTML strings from the client as a good practice to avoid XSS vulnerabilities in apps the build off of the default app. Review at http://gwt-code-reviews.appspot.com/619803 Review by: mmen...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8293 Modified: /trunk/user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc === --- /trunk/user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc Wed Jan 6 12:18:02 2010 +++ /trunk/user/src/com/google/gwt/user/tools/RpcServerTemplate.javasrc Tue Jun 22 05:23:16 2010 @@ -22,7 +22,27 @@ String serverInfo = getServletContext().getServerInfo(); String userAgent = getThreadLocalRequest().getHeader(User-Agent); + +// Escape data from the client to avoid cross-site script vulnerabilities. +input = escapeHtml(input); +userAgent = escapeHtml(userAgent); + return Hello, + input + !brbrI am running + serverInfo + .brbrIt looks like you are using:br + userAgent; } -} + + /** + * Escape an html string. Escaping data received from the client helps to + * prevent cross-site script vulnerabilities. + * + * @param html the html string to escape + * @return the escaped string + */ + private String escapeHtml(String html) { +if (html == null) { + return null; +} +return html.replaceAll(, amp;).replaceAll(, lt;).replaceAll( +, gt;); + } +} -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8294 committed - Reduce Eclipse warnings to a dull roar...
Revision: 8294 Author: r...@google.com Date: Tue Jun 22 06:26:45 2010 Log: Reduce Eclipse warnings to a dull roar Review at http://gwt-code-reviews.appspot.com/640802 Review by: j...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8294 Modified: /trunk/dev/core/src/com/google/gwt/core/ext/linker/Artifact.java /trunk/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java /trunk/dev/core/src/com/google/gwt/core/ext/soyc/impl/SizeMapRecorder.java /trunk/dev/core/src/com/google/gwt/core/ext/soyc/impl/StandardFunctionMember.java /trunk/dev/core/src/com/google/gwt/dev/HeadlessUI.java /trunk/dev/core/src/com/google/gwt/dev/WebServerPanel.java /trunk/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java /trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java /trunk/dev/core/src/com/google/gwt/dev/js/ast/JsName.java /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java /trunk/dev/core/src/com/google/gwt/dev/shell/DispatchClassInfo.java /trunk/dev/core/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java /trunk/dev/core/src/com/google/gwt/dev/shell/JavaDispatchImpl.java /trunk/dev/core/src/com/google/gwt/dev/shell/JavaObject.java /trunk/dev/core/src/com/google/gwt/dev/shell/Jsni.java /trunk/dev/core/src/com/google/gwt/dev/shell/tomcat/CommonsLoggerAdapter.java /trunk/dev/core/src/com/google/gwt/dev/util/collect/IdentitySingletonMap.java /trunk/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java /trunk/user/src/com/google/gwt/core/client/impl/CrossSiteLoadingStrategy.java /trunk/user/src/com/google/gwt/dom/client/DOMImplSafari.java /trunk/user/src/com/google/gwt/event/dom/client/PrivateMap.java /trunk/user/src/com/google/gwt/i18n/client/impl/ConstantMap.java /trunk/user/src/com/google/gwt/junit/CompileStrategy.java /trunk/user/src/com/google/gwt/logging/client/DefaultLevel.java /trunk/user/src/com/google/gwt/logging/client/FirebugLogHandler.java /trunk/user/src/com/google/gwt/logging/client/LoggingPopup.java /trunk/user/src/com/google/gwt/logging/client/SystemLogHandler.java /trunk/user/src/com/google/gwt/logging/client/TextLogFormatter.java /trunk/user/src/com/google/gwt/resources/css/ast/CssCompilerException.java /trunk/user/src/com/google/gwt/uibinder/elementparsers/InterpreterPipe.java /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java /trunk/user/src/com/google/gwt/user/client/rpc/core/java/util/Collections.java /trunk/user/src/com/google/gwt/user/client/ui/FastStringMap.java /trunk/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanel.java /trunk/user/src/com/google/gwt/user/client/ui/TabPanel.java /trunk/user/src/com/google/gwt/user/client/ui/VerticalSplitPanel.java /trunk/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java /trunk/user/src/com/google/gwt/user/rebind/rpc/SerializationUtils.java /trunk/user/src/com/google/gwt/user/rebind/rpc/TypeSerializerCreator.java /trunk/user/src/com/google/gwt/util/regexfilter/RegexFilter.java /trunk/user/test/com/google/gwt/emultest/benchmarks/java/util/ArrayListBenchmark.java /trunk/user/test/com/google/gwt/http/client/RequestBuilderTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/FooImage.java /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java === --- /trunk/dev/core/src/com/google/gwt/core/ext/linker/Artifact.java Wed Mar 3 09:01:30 2010 +++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/Artifact.java Tue Jun 22 06:26:45 2010 @@ -58,7 +58,7 @@ */ @Override public final boolean equals(Object obj) { -if (obj instanceof Artifact) { +if (obj instanceof Artifact?) { return compareTo((Artifact?) obj) == 0; } else { return false; === --- /trunk/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java Mon Apr 6 06:27:37 2009 +++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java Tue Jun 22 06:26:45 2010 @@ -103,7 +103,7 @@ * UnsupportedOperationException. */ public void freeze() { -if (treeSet instanceof TreeSet) { +if (treeSet instanceof TreeSet?) { treeSet = Collections.unmodifiableSortedSet(treeSet); } } === --- /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java Thu Apr 15 12:40:56 2010 +++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java Tue Jun 22 06:26:45 2010 @@ -226,6 +226,11 @@ + .nocache.js, lastModified); } + /** + * @param logger a TreeLogger + * @param context a LinkerContext + * @param fragment the fragment number + */ protected String generateDeferredFragment(TreeLogger logger, LinkerContext
[gwt-contrib] Re: Adding AbstractListViewAdapter#getViews() to get the views associated with an adapter. Also add... (issue601801)
committed as r8292 http://gwt-code-reviews.appspot.com/601801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Escaping HTML strings from the client as a good practice to avoid XSS vulnerabilities in apps th... (issue619803)
committed as r8293 http://gwt-code-reviews.appspot.com/619803/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Support composition as well as extension. (issue653801)
LGTM if you update com/google/gwt/rpc/server/RpcServlet with this same pattern as well. http://gwt-code-reviews.appspot.com/653801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Set and MutableSet. Bytecode implementation. (issue636801)
http://gwt-code-reviews.appspot.com/636801/diff/1/4 File /bikeshed/src/com/google/gwt/collections/MutableSet.java (right): http://gwt-code-reviews.appspot.com/636801/diff/1/4#newcode23 /bikeshed/src/com/google/gwt/collections/MutableSet.java:23: public final class MutableSetE extends SetE { On 2010/06/17 19:22:07, Dan Rice wrote: Need to document the null behavior of each method Done. http://gwt-code-reviews.appspot.com/636801/diff/1/4#newcode58 /bikeshed/src/com/google/gwt/collections/MutableSet.java:58: public boolean containsAll(SetE source) { On 2010/06/17 19:22:07, Dan Rice wrote: Assert or check source != null (also other methods that take a source param) Done. http://gwt-code-reviews.appspot.com/636801/diff/1/4#newcode83 /bikeshed/src/com/google/gwt/collections/MutableSet.java:83: public boolean isEqual(SetE source) { On 2010/06/17 19:22:07, Dan Rice wrote: Faster approach: first check source.size == this.size, then do a single containsAll() Also, need to check source != null before you do anything else Done. http://gwt-code-reviews.appspot.com/636801/diff/1/4#newcode107 /bikeshed/src/com/google/gwt/collections/MutableSet.java:107: elements.remove(adapt(element)); On 2010/06/17 19:22:07, Dan Rice wrote: Check if adapt(element) == null as you do in add(element) Done. http://gwt-code-reviews.appspot.com/636801/diff/1/6 File /bikeshed/src/com/google/gwt/collections/Set.java (right): http://gwt-code-reviews.appspot.com/636801/diff/1/6#newcode85 /bikeshed/src/com/google/gwt/collections/Set.java:85: final String adapt(Object value) { On 2010/06/17 19:22:07, Dan Rice wrote: This could also be done by initializing with a defailt adapter protected RelationObject, String adapter = new RelationObject, String() { String adapt(Object value) { return (String) value; } } and ensure the logic for setAdapter allows the default adapter to be replaced. This avoids if tests every time Done. http://gwt-code-reviews.appspot.com/636801/diff/6001/7003 File /bikeshed/src/com/google/gwt/collections/MutableSet.java (right): http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode23 /bikeshed/src/com/google/gwt/collections/MutableSet.java:23: * creating the Set with {...@link CollectionFactory#createMutableSet(Relation)}. On 2010/06/21 18:16:23, Dan Rice wrote: Document that the index strings must be unique. Document that each Set can have a different adapter with a different mapping from elements to index strings. Done. http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode35 /bikeshed/src/com/google/gwt/collections/MutableSet.java:35: * if (value == null || !(value instanceof Foo) ) { On 2010/06/21 18:16:23, Dan Rice wrote: 'null' always fails an instanceof check -- so it is safe to say: if (!(value instanceof Foo)) { // includes value == null A nicer way to write the code might be: return (value instanceof Foo) ? ((Foo) value).getIndex() : null; Done. http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode45 /bikeshed/src/com/google/gwt/collections/MutableSet.java:45: * {...@link CollectionFactory#createMutableSet()}. This adapter provides uses On 2010/06/21 18:16:23, Dan Rice wrote: Remove 'provides' (if I understand your intent correctly) Done. http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode48 /bikeshed/src/com/google/gwt/collections/MutableSet.java:48: * codenull/code.) On 2010/06/21 18:16:23, Dan Rice wrote: . outside ) Done. http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode55 /bikeshed/src/com/google/gwt/collections/MutableSet.java:55: * Adds an {...@code element} to this set. {...@code element} must be a value On 2010/06/21 18:16:23, Dan Rice wrote: I rarely see {...@code} in GWT sources -- if you do use it, I suggest just tagging the first use of a given symbol. Also, when referencing a method you can use {...@link} instead so you will have not only code style but an active link as well. Be sure to use a # to separate the class and method names. This made me remember reading about this in coding style guides, so I went and looked around. The java style in Google and elsewhere indicates the use of {...@code} tags to visually format code snippets, keywords and such, not just the first instance. I also like using {...@link} but using it too much seems to be frowned upon, with {...@code} being preferred after the first {...@link}. See http://www.corp.google.com/~codewalk/1259/ for example. {...@code} is even preferred to code as the former works well with '' and '' while the latter requires using lt; and gt;. A quick grep in trunk (outside bikeshed) would seem to indicate {...@code} usage has been picking up lately (79 files, 1092+ instances). http://gwt-code-reviews.appspot.com/636801/diff/6001/7003#newcode59 /bikeshed/src/com/google/gwt/collections/MutableSet.java:59: * @param element element to add. On 2010/06/21 18:16:23, Dan Rice wrote: No .
[gwt-contrib] Adding a null check to ShowcaseGenerator so that we don't try to write to a public resource that... (issue646802)
Reviewers: jgw, Description: Adding a null check to ShowcaseGenerator so that we don't try to write to a public resource that has already been created. This fixes a bug when multiple examples reference the same raw source files. Please review this at http://gwt-code-reviews.appspot.com/646802/show Affected files: M samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java Index: samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java === --- samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java (revision 8294) +++ samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java (working copy) @@ -33,8 +33,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; /** * Generate the source code, css styles, and raw source used in the Showcase @@ -65,6 +67,12 @@ * The {...@link TreeLogger} used to log messages. */ private TreeLogger logger = null; + + /** + * The set of raw files that have already been generated. Raw files can be + * reused by different examples, but we only generate them once. + */ + private SetString rawFiles = new HashSetString(); @Override public String generate(TreeLogger logger, GeneratorContext context, @@ -115,15 +123,22 @@ * @param partialPath the path to the file relative to the public directory * @param contents the file contents */ - private void createPublicResource(String partialPath, String contents) { + private void createPublicResource(String partialPath, String contents) + throws UnableToCompleteException { try { OutputStream outStream = context.tryCreateResource(logger, partialPath); + if (outStream == null) { +String message = Attempting to generate duplicate public resource: ++ partialPath ++ .\nAll generated source files must have unique names.; +logger.log(TreeLogger.ERROR, message); +throw new UnableToCompleteException(); + } outStream.write(contents.getBytes()); context.commitResource(logger, outStream); -} catch (UnableToCompleteException e) { - logger.log(TreeLogger.ERROR, Failed while writing, e); } catch (IOException e) { - logger.log(TreeLogger.ERROR, Failed while writing, e); + logger.log(TreeLogger.ERROR, Error writing file: + partialPath, e); + throw new UnableToCompleteException(); } } @@ -146,6 +161,13 @@ // Generate each raw source file String[] filenames = type.getAnnotation(ShowcaseRaw.class).value(); for (String filename : filenames) { + // Check if the file has already been generated. + String path = pkgName + filename; + if (rawFiles.contains(path)) { +continue; + } + rawFiles.add(path); + // Get the file contents String fileContents = getResourceContents(pkgPath + filename); @@ -230,7 +252,7 @@ * @param outDir the output directory */ private void generateStyleFiles(JClassType type, String styleDefs, - String outDir) { + String outDir) throws UnableToCompleteException { // Look for annotation if (!type.isAnnotationPresent(ShowcaseStyle.class)) { return; -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: [gwt-contrib] Re: Improving event handling, as initiated in 1.6
Just to let everyone know, I've finally gotten around to picking up this task again, and have updated the linked wave with my proposals. Please feel free to chime in; I could use the feedback. Le 11 juin 2010 11:13, Thomas Broyer t.bro...@gmail.com a écrit : On Thu, Jun 10, 2010 at 11:59 PM, Dan ddum...@gmail.com wrote: I don't suppose you could bump the wave Thomas? I seem to not have access to do anything but add blank replies... I've added you to the wave. Don't know what happened as you're a member of GWT-Contrib, which has full access to the wave... -- http://groups.google.com/group/Google-Web-Toolkit-Contributors -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8299 committed - Better implementation for getHandlers (the old one threw an exception ...
Revision: 8299 Author: unn...@google.com Date: Tue Jun 22 10:23:10 2010 Log: Better implementation for getHandlers (the old one threw an exception in Web mode) Review at http://gwt-code-reviews.appspot.com/651801 Review by: fre...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8299 Modified: /trunk/user/src/com/google/gwt/logging/impl/LoggerImplRegular.java === --- /trunk/user/src/com/google/gwt/logging/impl/LoggerImplRegular.java Tue Jun 15 15:09:25 2010 +++ /trunk/user/src/com/google/gwt/logging/impl/LoggerImplRegular.java Tue Jun 22 10:23:10 2010 @@ -61,7 +61,7 @@ public Handler[] getHandlers() { if (handlers.size() 0) { - return (Handler[]) handlers.toArray(); + return handlers.toArray(new Handler[handlers.size()]); } return null; } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8300 committed - Work around Safari 5 failures where right-shift of a non-integer is no...
Revision: 8300 Author: j...@google.com Date: Tue Jun 22 11:13:30 2010 Log: Work around Safari 5 failures where right-shift of a non-integer is not coerced to an integer. See https://bugs.webkit.org/show_bug.cgi?id=40367 and http://trac.webkit.org/changeset/60990 for details. Patch by: jat Review by: spoon, jgw http://code.google.com/p/google-web-toolkit/source/detail?r=8300 Added: /trunk/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java /trunk/dev/core/test/com/google/gwt/dev/js/JsCoerceIntShiftTest.java Modified: /trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java === --- /dev/null +++ /trunk/dev/core/src/com/google/gwt/dev/js/JsCoerceIntShift.java Tue Jun 22 11:13:30 2010 @@ -0,0 +1,97 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.dev.js; + +import com.google.gwt.core.ext.BadPropertyValueException; +import com.google.gwt.core.ext.PropertyOracle; +import com.google.gwt.core.ext.SelectionProperty; +import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.dev.jjs.SourceInfo; +import com.google.gwt.dev.js.ast.JsBinaryOperation; +import com.google.gwt.dev.js.ast.JsBinaryOperator; +import com.google.gwt.dev.js.ast.JsContext; +import com.google.gwt.dev.js.ast.JsExpression; +import com.google.gwt.dev.js.ast.JsModVisitor; +import com.google.gwt.dev.js.ast.JsPrefixOperation; +import com.google.gwt.dev.js.ast.JsProgram; +import com.google.gwt.dev.js.ast.JsUnaryOperator; + +/** + * Coerces lhs of right shift operations to int. Necessary for Safari 5 bug + * https://bugs.webkit.org/show_bug.cgi?id=40367 fixed in + * http://trac.webkit.org/changeset/60990 -- this should be removed once that + * fix has been pushed. + */ +public class JsCoerceIntShift { + // TODO(jat): remove this once Safari 5 has the update + + /** + * Rewrite a b as (~~a) b. + */ + private static class MyVisitor extends JsModVisitor { + +@Override +public void endVisit(JsBinaryOperation x, JsContextJsExpression ctx) { + JsBinaryOperator op = x.getOperator(); + if (op != JsBinaryOperator.SHR op != JsBinaryOperator.SHRU) { +return; + } + + SourceInfo sourceInfo = x.getSourceInfo(); + JsExpression lhs = x.getArg1(); + JsExpression rhs = x.getArg2(); + JsExpression newNode = new JsBinaryOperation(sourceInfo, op, + new JsPrefixOperation(sourceInfo, JsUnaryOperator.BIT_NOT, + new JsPrefixOperation(sourceInfo, JsUnaryOperator.BIT_NOT, lhs)), + rhs); + ctx.replaceMe(newNode); +} + } + + /** + * If this permutation may be executed on WebKit, rewrite a b as ~~a b. + * + * @param program + * @param logger + * @param propertyOracles + * @return true if any changes were made + */ + public static boolean exec(JsProgram program, TreeLogger logger, + PropertyOracle[] propertyOracles) { +boolean seenWebKit = false; +for (PropertyOracle oracle : propertyOracles) { + try { +SelectionProperty prop = oracle.getSelectionProperty(logger, +user.agent); +// TODO(jat): more checks if we split up the safari permutation +if (safari.equals(prop.getCurrentValue())) { + seenWebKit = true; + break; +} + } catch (BadPropertyValueException e) { +// if we couldn't get the property, assume this might be used on WebKit. +seenWebKit = true; +break; + } +} +if (!seenWebKit) { + return false; +} +MyVisitor v = new MyVisitor(); +v.accept(program); +return v.didChange(); + } +} === --- /dev/null +++ /trunk/dev/core/test/com/google/gwt/dev/js/JsCoerceIntShiftTest.java Tue Jun 22 11:13:30 2010 @@ -0,0 +1,168 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */
[gwt-contrib] [google-web-toolkit] r8301 committed - Optimized MutableArray creation. Added Benchmark to facilitate compari...
Revision: 8301 Author: rchan...@google.com Date: Mon Jun 14 11:58:23 2010 Log: Optimized MutableArray creation. Added Benchmark to facilitate comparison using a single graph. Review at http://gwt-code-reviews.appspot.com/613801 Review by: r...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8301 Added: /branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/MutableArrayComparisonBenchmark.java Modified: /branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java /branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/CollectionFactory.java /branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/MutableArrayBenchmarkTest.java === --- /dev/null +++ /branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/MutableArrayComparisonBenchmark.java Mon Jun 14 11:58:23 2010 @@ -0,0 +1,131 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.collections; + +import com.google.gwt.benchmarks.client.Benchmark; +import com.google.gwt.benchmarks.client.IntRange; +import com.google.gwt.benchmarks.client.Operator; +import com.google.gwt.benchmarks.client.RangeField; + +import java.util.ArrayList; + +/** + * Benchmarks the performance of various MutableArray methods. + */ +public class MutableArrayComparisonBenchmark extends Benchmark { + + final IntRange elemRange = new IntRange(5, 30005, Operator.ADD, 5000); + final ArrayBuildType[] testKind = {ArrayBuildType.GWT_ADD, + ArrayBuildType.GWT_SET, ArrayBuildType.GWT_SET_INIT, + ArrayBuildType.JRE_ARRAY, ArrayBuildType.JRE_LIST}; + + /** + * Type of array construction to benchmark + */ + protected enum ArrayBuildType { +GWT_ADD(GWT Array add()), GWT_SET(GWT sized create), +GWT_SET_INIT(GWT sized create + initialization), JRE_ARRAY(JRE Array), +JRE_LIST(JRE ArrayList); + +public String description; + +private ArrayBuildType(String description) { + this.description = description; +} + } + + @Override + public String getModuleName() { +return com.google.gwt.collections.Collections; + } + + /** + * Required by benchmarking framework. + */ + public void testComparativePerformance() { + } + + public void testComparativePerformance( + @RangeField(elemRange) Integer numElements, + @RangeField(testKind) ArrayBuildType test) { +switch (test) { + case GWT_ADD: +gwtCollectionsArrayAddGrowth(numElements); +break; + + case GWT_SET: +gwtCollectionsArraySetSizeGrowth(numElements); +break; + + case GWT_SET_INIT: +gwtCollectionsArraySetSizeInitGrowth(numElements); +break; + + case JRE_ARRAY: +javaArraySetGrowth(numElements); +break; + + case JRE_LIST: +jreArrayListAddGrowth(numElements); +break; + + default: +break; +} + } + + private void gwtCollectionsArrayAddGrowth(Integer numElements) { +MutableArrayInteger ma = CollectionFactory.createMutableArray(); + +for (int i = 0; i numElements; i++) { + ma.add(i); +} + } + + private void gwtCollectionsArraySetSizeGrowth(Integer numElements) { +MutableArrayInteger ma = CollectionFactory.createMutableArray(numElements); + +for (int i = 0; i numElements; i++) { + ma.set(i, i); +} + } + + private void gwtCollectionsArraySetSizeInitGrowth(Integer numElements) { +MutableArrayInteger ma = + CollectionFactory.createMutableArray(numElements, new Integer(0)); + +for (int i = 0; i numElements; i++) { + ma.set(i, i); +} + } + + private void javaArraySetGrowth(Integer numElements) { +Integer[] ia = new Integer[numElements]; + +for (int i = 0; i numElements; i++) { + ia[i] = i; +} + } + + private void jreArrayListAddGrowth(Integer numElements) { +ArrayListInteger al = new ArrayListInteger(); + +for (int i = 0; i numElements; i++) { + al.add(i); +} + } + +} === --- /branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java Mon Jun 14 06:05:16 2010 +++ /branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java Mon Jun 14 11:58:23 2010 @@ -29,6 +29,18 @@ public static E
[gwt-contrib] Added a guard against IndexOutOfBoundsException (issue613802)
Reviewers: jlabanca, Description: Added a guard against IndexOutOfBoundsException Review by: jlaba...@google.com Please review this at http://gwt-code-reviews.appspot.com/613802/show Affected files: M bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java Index: bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java === --- bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java (revision 8300) +++ bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java (working copy) @@ -88,6 +88,8 @@ // Replace the current renderer. this.renderer = renderer; cellList.setData(0, places.size(), places); -smodel.setSelected(places.get(0), true); +if (places.size() 0) { + smodel.setSelected(places.get(0), true); +} } } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8302 committed - Added a guard against IndexOutOfBoundsException...
Revision: 8302 Author: amitman...@google.com Date: Tue Jun 22 14:48:58 2010 Log: Added a guard against IndexOutOfBoundsException Review at http://gwt-code-reviews.appspot.com/613802 Review by: jlaba...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8302 Modified: /trunk/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java === --- /trunk/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java Fri Jun 18 20:16:34 2010 +++ /trunk/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java Tue Jun 22 14:48:58 2010 @@ -88,6 +88,8 @@ // Replace the current renderer. this.renderer = renderer; cellList.setData(0, places.size(), places); -smodel.setSelected(places.get(0), true); +if (places.size() 0) { + smodel.setSelected(places.get(0), true); +} } } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors