Re: Async Advice

2013-04-18 Thread Jens

>
>
> Regarding accessing results of a callback elsewhere in the application (if 
> required), what is the best way to do this?
>

Somewhat depends on the concrete case. 

If its very general data that multiple independent components are 
interested in, you could publish that data on an app global EventBus using 
an event. Sometimes you can also store general data somewhere and then 
provide that information through a constructor dependency in other classes. 
For example a client side "UserSession" class could be a dependency in 
multiple app components and filled once by the login process.

If its more like a parent <-> child relationship (1:n) the child could hold 
a reference to the parent and notify it by calling a method on the parent. 
But try to avoid it through multiple layers so you dont end up with 
getParent().getParent().getParent().notify(). You can also use events in a 
parent <-> child scenario to decouple both but I would not send that event 
on the EventBus as its probably relative specific to the parent and child.

Just start hacking and once you feel uncomfortable with the code just ask 
again with a more concrete scenario.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can't find postgres driver from debug mode

2013-04-18 Thread Thomas Broyer
I'd bet your driver's JAR is not in WEB-INF/lib.

On Thursday, April 18, 2013 10:04:35 PM UTC+2, Jamie wrote:
>
> This is driving me crazy.
>
> My (large) project uses Hibernate and Postgres.
> On one machine it works perfectly.
>
> On two machines:
> - All works fine when running externally (from the web server)
> - Other (non gwt) programs work fine, using the same eclipse project, same 
> classpath, same config (persistence.xml) etc.
> - If I launch my project in GWT debug mode, the following code fails 
> immediately:
> emf = Persistence.createEntityManagerFactory("dpu", connectionProperties);
>
> I have confirmed that all the connection properties are the same when 
> connecting.
> There are two things that I am considering:
> - The classpath is incorrect
> - GWT is including hibernate code that is interfering with my EMF.
>
> Has anyone ever seen anything like this?  I really want to use the 
> debugger!!!
> Thanks for your time!
>
> -- Jamie
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Security in gwt application.

2013-04-18 Thread Thomas Broyer
That's more or less what I said: the odds that 
getDirectoryOfFile($doc.location.href) is actually called are a) very low 
b) dependent on how you call the *.nocache.js more than the runtime 
environment.
Starting with 2.1.0, you can "set" the 'base' using  (have a look how Google Groups 
uses it, scoped only to the 'standalone' module so it's 
name="standalone::gwt:property" rather than name="gwt:property").
Starting with 2.1.0 you can also more easily replace that code altogether 
with a custom linker (this was possible in 2.0.3 too but required copying 
the whole IFrameTemplate.js whereas 2.1.0 made it more modular)

On Thursday, April 18, 2013 8:56:15 PM UTC+2, Shashank Raj Holavanalli 
wrote:
>
> Thomas,
>
> This piece of code is in nocache.js
>
> *function getDirectoryOfFile(path){*
>
> *  var hashIndex = path.lastIndexOf('#');*
>
> *  if (hashIndex == -1) {*
>
> *hashIndex = path.length;*
>
> *  }*
>
> *  var queryIndex = path.indexOf('?');*
>
> *  if (queryIndex == -1) {*
>
> *queryIndex = path.length;*
>
> *  }*
>
> *  var slashIndex = path.lastIndexOf('/', Math.min(queryIndex, 
> hashIndex));*
>
> *  return slashIndex >= 0?path.substring(0, slashIndex + 1):'';*
>
> *}*
>
> *
> *
>
> The “path” parameter to this function comes from 
> *document.location.href*attribute.
>
>  
>
> This function is basically finding the last index of “/” in the browser 
> address bar ignoring what is there after “?” and “#”. 
>
> From what I know DOM based XSS can occur by injecting scripts after “?” or 
> “#” like this
>
>  
>
> Server can sanitize this script because the value of the name attribute is 
> sent to the server
>
> *http://domain.com/index.html?name=MALICIOUS_CODE *
>
>
> OR
>
>  
>
> Server cannot sanitize this script because the fragment after “#” is never 
> sent to the server and runs on the browser itself
>
> *http://domain.com/index.html#name=MALICIOUS_CODE*
>
> *
> *
>
> nochache.js also has the following code
>
> *base = getDirectoryOfFile(document.location.href);*
>
> *document.write('

Re: Can't find postgres driver from debug mode

2013-04-18 Thread Jamie
Update: I grabbed the hibernate code, extracted parts, and here's the 
interesting bit:

PersistenceProviderResolver ppr = 
PersistenceProviderResolverHolder.getPersistenceProviderResolver();
List list = ppr.getPersistenceProviders();

On the good machine, the list has the hibernate provider.
On the bad machines, the list is empty.
Ugh.
I even have the provider listed specifically in the persistence unit.

ARGH!

On Thursday, 18 April 2013 16:04:35 UTC-4, Jamie wrote:
>
> This is driving me crazy.
>
> My (large) project uses Hibernate and Postgres.
> On one machine it works perfectly.
>
> On two machines:
> - All works fine when running externally (from the web server)
> - Other (non gwt) programs work fine, using the same eclipse project, same 
> classpath, same config (persistence.xml) etc.
> - If I launch my project in GWT debug mode, the following code fails 
> immediately:
> emf = Persistence.createEntityManagerFactory("dpu", connectionProperties);
>
> I have confirmed that all the connection properties are the same when 
> connecting.
> There are two things that I am considering:
> - The classpath is incorrect
> - GWT is including hibernate code that is interfering with my EMF.
>
> Has anyone ever seen anything like this?  I really want to use the 
> debugger!!!
> Thanks for your time!
>
> -- Jamie
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Can't find postgres driver from debug mode

2013-04-18 Thread Jamie
This is driving me crazy.

My (large) project uses Hibernate and Postgres.
On one machine it works perfectly.

On two machines:
- All works fine when running externally (from the web server)
- Other (non gwt) programs work fine, using the same eclipse project, same 
classpath, same config (persistence.xml) etc.
- If I launch my project in GWT debug mode, the following code fails 
immediately:
emf = Persistence.createEntityManagerFactory("dpu", connectionProperties);

I have confirmed that all the connection properties are the same when 
connecting.
There are two things that I am considering:
- The classpath is incorrect
- GWT is including hibernate code that is interfering with my EMF.

Has anyone ever seen anything like this?  I really want to use the 
debugger!!!
Thanks for your time!

-- Jamie

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Async Advice

2013-04-18 Thread Tim Hill
Hi Jens,

Thanks for your input - much appreciated! I had actually come to the same 
conclusion after posting this when I was thinking about alternative 
solutions to the issue.

Regarding accessing results of a callback elsewhere in the application (if 
required), what is the best way to do this?

Cheers

Tim

On Thursday, 18 April 2013 20:27:39 UTC+1, Jens wrote:
>
> As its a mobile app you should always think about how to reduce server 
> requests by sending the server more information at once. Less requests => 
> less latency in using your app. 
>
> For example the above 4 steps you have described can be done with a single 
> request:
>
> Request: Client logs in: Client sends credentials *AND* current DB 
> version (0 = no DB yet)
> Response: If credentials are valid, the server sends back SQL based on the 
> client db version (either full schema or just an upgrade or nothing at 
> all). If credentials are invalid, an HTTP error code will be send.
>
> In the very rare cases where you really need to wait for a server response 
> before you can immediately (without user interaction required) fire the 
> next server request just use private methods to "flatten" the daisy 
> chaining a bit:
>
> server.fetchFirstThing(new AsyncCallback() {
>void onSuccess() {
>   fetchSecondThing();
>}
> }
>
> But as mentioned, if no user interaction is required between requests, 
> there is a good chance that you can combine these requests into a single 
> one.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Async Advice

2013-04-18 Thread Jens
As its a mobile app you should always think about how to reduce server 
requests by sending the server more information at once. Less requests => 
less latency in using your app. 

For example the above 4 steps you have described can be done with a single 
request:

Request: Client logs in: Client sends credentials *AND* current DB version 
(0 = no DB yet)
Response: If credentials are valid, the server sends back SQL based on the 
client db version (either full schema or just an upgrade or nothing at 
all). If credentials are invalid, an HTTP error code will be send.

In the very rare cases where you really need to wait for a server response 
before you can immediately (without user interaction required) fire the 
next server request just use private methods to "flatten" the daisy 
chaining a bit:

server.fetchFirstThing(new AsyncCallback() {
   void onSuccess() {
  fetchSecondThing();
   }
}

But as mentioned, if no user interaction is required between requests, 
there is a good chance that you can combine these requests into a single 
one.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: GWT - So terribly slow that makes development hard ... very hard ... extremely hard ...

2013-04-18 Thread Paul Stockley
performance improvement definitely seems to be an immediate priority. See 
the draft roadmap

https://docs.google.com/document/d/1bmp0a-d5cb_Sqb4w9rZyfMhg7i6lYfLLt3zymIFoAmo/edit

On Thursday, April 18, 2013 1:22:15 PM UTC-4, Ani wrote:
>
> Now that we have been using GWT for a while ... what do you think? Was it 
> the right choice or thinking of migrating to other framework?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Security in gwt application.

2013-04-18 Thread Shashank Raj Holavanalli
Thomas,

This piece of code is in nocache.js

*function getDirectoryOfFile(path){*

*  var hashIndex = path.lastIndexOf('#');*

*  if (hashIndex == -1) {*

*hashIndex = path.length;*

*  }*

*  var queryIndex = path.indexOf('?');*

*  if (queryIndex == -1) {*

*queryIndex = path.length;*

*  }*

*  var slashIndex = path.lastIndexOf('/', Math.min(queryIndex,
hashIndex));*

*  return slashIndex >= 0?path.substring(0, slashIndex + 1):'';*

*}*

*
*

The “path” parameter to this function comes from
*document.location.href*attribute.



This function is basically finding the last index of “/” in the browser
address bar ignoring what is there after “?” and “#”.

>From what I know DOM based XSS can occur by injecting scripts after “?” or
“#” like this



Server can sanitize this script because the value of the name attribute is
sent to the server

*http://domain.com/index.html?name=MALICIOUS_CODE *


OR



Server cannot sanitize this script because the fragment after “#” is never
sent to the server and runs on the browser itself

*http://domain.com/index.html#name=MALICIOUS_CODE*

*
*

nochache.js also has the following code

*base = getDirectoryOfFile(document.location.href);*

*document.write('

Re: Joda Time Jodatime in GWT server

2013-04-18 Thread Mohammad Al-Quraian
It's not enough to include it in the build path, you have to copy the 
library to the lib folder in your server side (uder war/WEB-INF), and then 
include it in the build path. This is so the server has access to the 
library.

On Tuesday, April 16, 2013 12:36:15 AM UTC+3, Steve Morgan wrote:
>
> I'm using Jodatime in my GWT application, server only. I'm getting a 
> runtime message:  java.lang.ClassNotFoundException: 
> org.joda.time.ReadableInstant. I have included Jodatime 1.6.2 in my project 
> build path. Do I need to add an  it is something extremely simple, I just haven't found it.
> Thanks,
> Steve
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: GWT - So terribly slow that makes development hard ... very hard ... extremely hard ...

2013-04-18 Thread tinnitus007
Are you using Firefox?  If so, there's an issue: 
https://code.google.com/p/google-web-toolkit/issues/detail?id=7648

If not, I can report that SSD drives make a huge difference in GWT dev 
 mode.

On Thursday, April 18, 2013 10:22:15 AM UTC-7, Ani wrote:
>
> Now that we have been using GWT for a while ... what do you think? Was it 
> the right choice or thinking of migrating to other framework?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: GWT - So terribly slow that makes development hard ... very hard ... extremely hard ...

2013-04-18 Thread Juan Pablo Gardella
Hi,

Are you using the same server to run backend and front end? It is very
useful use two servers. Take a look at
https://github.com/tbroyer/gwt-maven-archetypes.

Juan


2013/4/18 Ani 

> Now that we have been using GWT for a while ... what do you think? Was it
> the right choice or thinking of migrating to other framework?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




GWT - So terribly slow that makes development hard ... very hard ... extremely hard ...

2013-04-18 Thread Ani
Now that we have been using GWT for a while ... what do you think? Was it 
the right choice or thinking of migrating to other framework?


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Async Advice

2013-04-18 Thread Tim Hill
Hi there,

I am somewhat of a GWT novice and I am attempting to create my first 
application and I would appreciate if any wise old sages would be able to 
offer some guidance... As part of this application I want to offer offline 
functionality. My thoughts on how this will work are as follows:
> User logs in
> Credentials checked on server
> If ok, check client DB exists (if not, get DDL from server)
> if the server DB has been upgraded apply changes to client

There are more steps to follow, but hopefully you get the general idea of 
what I am trying to achieve. I have been able to use RestyGWT to connect to 
PHP scripts and transfer JSON back and forth and I have also been able to 
use GWT Mobile Webkit to create and interact with a client DB.

However, I am now a bit stuck in that I am unsure what the best way is to 
glue it all together as I am used to synchronous things... The easiest 
option I can see would be to daisy chain the callbacks together so that all 
required steps get executed in the required order. However, that seems 
rather inelegant and so I was wondering if there were any better options 
out there. I thought about an event for each step, but from what I have 
read, that appears to not be the done thing.

I am also slightly confused as to what the best way to interface with the 
results of the callbacks, say if some other part of the application needs 
to make use of the results.

Any advice would be very much appreciated!

Cheers

Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: GWT 2.5.1 now available

2013-04-18 Thread Reuben S
For some reason the combination of the new Eclipse plugin (3.2.2) and the 
new GWT (2.5.1) is not working for me.
Outside eclipse all works fine.
All this worked fine two days ago with the previous plugin (3.2.1) and SDK 
(2.5).

I'll appreciate any suggestions.

 -- Reuben


On Monday, March 11, 2013 9:11:16 PM UTC-4, Matthew Dempsky wrote:
>
> Hi everyone,
>
> We're excited to announce the GWT 2.5.1 release!  There will be an 
> announcement soon on the GWT Blog , 
> and you can download it 
> here.
>  
>  This release has been uploaded to Maven Central with the version string of 
> "2.5.1".
>
> GWT 2.5.1 contains over 50 new bug fixes, many of which were contributed 
> by the community.  Thanks to everyone who reported issues and/or submitted 
> patches.
>
> -Matthew, on behalf of the GWT team
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: FormPanel.SubmitEvent cancel not working

2013-04-18 Thread Thomas Broyer


On Thursday, April 18, 2013 9:30:51 AM UTC+2, Honza Rames wrote:
>
> A little out-of-time response but since this problem still exists in 2.5 I 
> think it's worth sharing another solution. 
>
> If you put "javascript:" into form's action attribute, nothing will happen 
> even if the event is not canceled. I know this isn't helpful in cases where 
> you need to validate the form, but in case you (like me) are preventing the 
> form submit to send the data using GWT RPC instead of the POST to take 
> advantage of the browser's password remembering feature (I'm wrapping 
> FormPanel around already existing form) this is actually helpful.
>

Last time I tried, you had to let the submission go through, so you'd have 
to use action="javascript:foo()" and expose a method as $wnd.foo via JSNI 
where you'd do your RPC.
That was 4 years ago though! 
https://groups.google.com/d/topic/google-web-toolkit/KyzgtqqoJGE/discussion 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to centre fixed size panel inside another layout panel or screen

2013-04-18 Thread stuckagain
Hi Jens,
 
Great, it works exactly as I want! Such a simple approach as well, it 
should be part of GWT though.
 
David

On Thursday, February 2, 2012 1:23:57 AM UTC+1, espinosa_cz wrote:

> Hi guys, 
>
> I manage to put my context panel to the middle of the browser page in 
> Vaadin. Seem my screenshots. It is done purely in Java code, the only 
> CSS used is for setting colors and font sizes. 
> Now I wondering how to make something similar with vanilla GWT. 
>
> In Vaadin it is one line command! 
> ((VerticalLayout)outerContentPanel).setComponentAlignment(contextPanel, 
> Alignment.MIDDLE_CENTER); 
> What is the GWT equivalent? 
>
> How to centre a fixed size panel (LayoutPanel) inside resizable parent 
> container, let's say RootLayoutPanel as it is in this picture? 
>
> http://espinosa.s3-website-eu-west-1.amazonaws.com/vvregform2/vvregform/vvregform_progress_2011-01-24_-_screenshot_1.png
>  
>
> The central panel (form) can grow, see here: 
>
> http://espinosa.s3-website-eu-west-1.amazonaws.com/vvregform2/vvregform/vvregform_progress_2011-01-24_-_screenshot_3.png
>  
> so the solution  must be flexible, accommodate any change in the 
> central panel. 
>
> Preferably programmatically (no UiBinding) and ideally without special 
> CSS tricks. 
>
> I made some progress with encapsulated LayoutPanels and setting 
> WidgetLeftRight and WidgetTopBottom. But I cannot figure out what 
> values make it centered for any particular inner contextPanel sizes: 
>
> // “parent”, outer content panel, make it fill whole screen (page) 
> LayoutPanel outerContentPanel = new LayoutPanel(); 
> outerContentPanel.setStyleName("outerContextPanel"); 
> outerContentPanel.setHeight("100%"); 
> outerContentPanel.setWidth("100%"); 
>
> // inner content panel 
> LayoutPanel contentPanel = new LayoutPanel(); 
> outerContentPanel.add(contentPanel); 
> contentPanel.setStyleName("contextPanel"); 
> contentPanel.setSize("300px", "300px"); 
>
> // make it centered () 
> outerContentPanel.setWidgetLeftRight(contentPanel, 50, Unit.PCT, 0, 
> Unit.PCT); 
> outerContentPanel.setWidgetTopBottom(contentPanel, 50, Unit.PCT, 0, 
> Unit.PCT); 
>
> // put some fancy content iside 
> HTML html = new HTML("Hello world centered!"); 
> contentPanel.add(html); 
>
> // set as 
> RootLayoutPanel.get().add(outerContentPanel) 
>
> As values I tried 50% from all directions sides, it makes central 
> contextPanel nicely centred but also invisible, clipped completely. 
> When I use 50% from top and left only, 0% from bottom and right, the 
> left top corner of the inner panel is centered, nice, but i need to 
> get centered by its center. 
>
> I am out of my wits now 
> Any hints welcome 
> Thank you 
> Espinosa 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: FormPanel.SubmitEvent cancel not working

2013-04-18 Thread Honza Rames
A little out-of-time response but since this problem still exists in 2.5 I 
think it's worth sharing another solution. 

If you put "javascript:" into form's action attribute, nothing will happen 
even if the event is not canceled. I know this isn't helpful in cases where 
you need to validate the form, but in case you (like me) are preventing the 
form submit to send the data using GWT RPC instead of the POST to take 
advantage of the browser's password remembering feature (I'm wrapping 
FormPanel around already existing form) this is actually helpful.

On Saturday, January 29, 2011 8:03:18 PM UTC+1, balkanski wrote:
>
> I have just found the solution for GWT 2.1.1 version. Here it is: 
>
> First you do not use a 'SubmitButton' in your FormPanel, because it 
> turns out that it causes all the troubles. 
>
> Use a 'Button' instead and add a 'ClickHandler' to it, and call 
> 'your_form.submit()' inside the 'onClick()' method. 
>
> You will find that after using 'Button' instead of 'SubmitButton' all 
> the input fields in the form has lost their 
> initial 'submit on Enter' behavior, which was observed at the 
> beginning. 
>
> Now attach to every input field a 'onKeyDown' handler(if you want, of 
> course) and check the event's native key code upon 'ENTER', and if yes 
> - submit the form. 
>
> That is all, now the 'event.cancel()' part in the form's SubmitHandler 
> is perfectly working. 
>
>
> On Jan 5, 10:27 pm, Greg Dougherty  wrote: 
> > I have the following code in a GWT 2.1.0 project: 
> > 
> > public void onSubmit (FormPanel.SubmitEvent event) 
> > { 
> > // This event is fired just before the form is submitted. We can 
> take 
> > // this opportunity to perform validation. 
> > String filename = gDataFileUploader.getFilename (); 
> > if (filename.length () == 0) 
> > { 
> > showAlert ("Need a valid File Name in before we can 
> upload a 
> > file!"); 
> > event.cancel (); 
> > } 
> > 
> > } 
> > 
> > Unfortunately, although it is called, the cancel () call doesn't stop 
> > the submit from happening, and doesn't stop onSubmitComplete from 
> > being called.  Is this a GWT bug or a browser bug?  (FireFox 3.6) 
> > 
> > TIA, 
> > 
> > Greg

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CSRF, XSS protection

2013-04-18 Thread Ed


> but its impossible to hijack the session itself.

Why is this important when you have a whole in your site due to XSS, as you 
assume above?

If some script get full access to your site through XSS, it can set any 
header it wants such that your backend can't see the diference between a 
legal or illegal call.

What do I miss here ?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.