Re: How to use JavaScript to customize both the client and server in a consistent way?

2014-05-14 Thread Phineas Gage
It's true that I can hand-write these explicit bindings for client and 
server, and if I can manage to unit test it, it might not be too hard to 
maintain, but the writing of these bindings is what I wanted to avoid. It's 
looking more and more like I can't avoid it.

For security, I embedded Rhino on the server and implemented a ClassShutter 
(http://blog.notdot.net/2009/10/Server-side-JavaScript-with-Rhino) to 
restrict all classes except java.lang, and may add a few others. I'm not 
yet 100% convinced that this is enough.

I still would _really_ like this to work client-side, if possible, because 
while getPrice could be a server call, I have cases where I'd like to call 
the customer's script repeatedly to test for something across multiple 
dates, for example, which would mean many round-trip calls. Yes, I could 
architect the call to call the server only once, but so far doing this 
client-side still seems the easiest and lowest latency way, if it's 
possible.

In my case, getSomethingUseful is just a placeholder for many methods. I've 
got a number of custom methods on my own BasicDate class I've written, for 
example (because I need a consistent date class between the client and 
server, and since there is no java.util.Calendar on the client side, and 
the Date methods are deprecated, using those is too risky.) I would rather 
they just be able to call into the classes that I allow them to.

I like Groovy, and wish it could be made to work client side. I'm going to 
try this custom glue / explicit bindings approach with JavaScript, and if I 
get lost in the woods, I might end up right where you are! Thanks for your 
response.

On Monday, May 12, 2014 11:29:29 PM UTC+2, Ignacio Baca Moreno-Torres wrote:

 If you only one to expose the JS code to do expressions, you can define a 
 concrete and reduced context where the expression will be executed. For 
 example, if you want to evaluate the price, just add all the properties you 
 may need (probably all properties of the item bean) to the script execution 
 bindings. The creation of this bindings may not be shared between client 
 and server, but it's not complicated. Access random internal classes like 
 MyClass::getSomethingUseful it's a bad idea, it's better to expose explicit 
 binding, so if you want to expose MyClass::getSomethigUseful you may add a 
 util object with a getSomethigUseful method, this is safer, and also solves 
 your client/server problem. Although, the process to add this methods to 
 the context may also be a little different between client and server.

 This reduced context also is a good idea to reduce your second big 
 problem, the security! Execute dangerous code through this script it's very 
 easy, and restrict the access it's difficult. There are a lot of articles 
 and discussions like 
 http://stackoverflow.com/questions/1399505/sandboxing-jsr-223http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F1399505%2Fsandboxing-jsr-223sa=Dsntz=1usg=AFQjCNEPswtww9B4nerJWzT0MQ76C2rcGg.
  
 I try to do something similar, but I end up using Groovy (only server) 
 because this utility 
 http://groovy.codehaus.org/api/org/codehaus/groovy/control/customizers/SecureASTCustomizer.html'solves'
  the security problem.

 On Saturday, May 10, 2014 4:29:56 PM UTC+2, Phineas Gage wrote:

 I am writing a GWT app that will be usable by multiple customers. I'd 
 like for my customers to be able to customize the app, both on the server 
 side and client side by writing JavaScript. In other words, they could do 
 things like:

 - Set some configuration for their site, like its name, their web site 
 URL, address, items on their site, etc.

 - Write a JavaScript function to, for example, calculate the price for 
 some item based on its properties. So the price calculation could be done 
 on both the client and server, and no recompiling would be needed to change 
 the price calculation.

 The beauty of this is that they could write the JavaScript, and it could 
 be run using JSNI on the client and Rhino on the server, giving consistent 
 results. This could also get me out of the business of writing a bunch of 
 administrative UI code to handle the many possibilities for customization 
 that customers would want, and also give them much more flexibility, 
 particularly for price calculations, where the customers want endless 
 flexibility, and writing a rules engine to handle all of those cases would 
 be very complicated.

 Obviously, the JavaScript they write has to be runnable on both the 
 client and server. And, if it's just a matter of returning primitives or 
 the customer writing functions that take and return primitives, it's easy. 
 Simple JavaScript code snippets like this:

 var myname='Joe';

 function getMyName() { return 'Joe' };

 can be syntactically the same for both JSNI and Rhino.

 But the fun soon ends. Let's say I want to allow them to call into 
 methods in Java classes that I've defined, so I can give

Re: How to use JavaScript to customize both the client and server in a consistent way?

2014-05-12 Thread Ignacio Baca Moreno-Torres
If you only one to expose the JS code to do expressions, you can define a 
concrete and reduced context where the expression will be executed. For 
example, if you want to evaluate the price, just add all the properties you 
may need (probably all properties of the item bean) to the script execution 
bindings. The creation of this bindings may not be shared between client 
and server, but it's not complicated. Access random internal classes like 
MyClass::getSomethingUseful it's a bad idea, it's better to expose explicit 
binding, so if you want to expose MyClass::getSomethigUseful you may add a 
util object with a getSomethigUseful method, this is safer, and also solves 
your client/server problem. Although, the process to add this methods to 
the context may also be a little different between client and server.

This reduced context also is a good idea to reduce your second big problem, 
the security! Execute dangerous code through this script it's very easy, 
and restrict the access it's difficult. There are a lot of articles and 
discussions 
like http://stackoverflow.com/questions/1399505/sandboxing-jsr-223. I try 
to do something similar, but I end up using Groovy (only server) because 
this 
utility 
http://groovy.codehaus.org/api/org/codehaus/groovy/control/customizers/SecureASTCustomizer.html
 
'solves' the security problem.

On Saturday, May 10, 2014 4:29:56 PM UTC+2, Phineas Gage wrote:

 I am writing a GWT app that will be usable by multiple customers. I'd like 
 for my customers to be able to customize the app, both on the server side 
 and client side by writing JavaScript. In other words, they could do things 
 like:

 - Set some configuration for their site, like its name, their web site 
 URL, address, items on their site, etc.

 - Write a JavaScript function to, for example, calculate the price for 
 some item based on its properties. So the price calculation could be done 
 on both the client and server, and no recompiling would be needed to change 
 the price calculation.

 The beauty of this is that they could write the JavaScript, and it could 
 be run using JSNI on the client and Rhino on the server, giving consistent 
 results. This could also get me out of the business of writing a bunch of 
 administrative UI code to handle the many possibilities for customization 
 that customers would want, and also give them much more flexibility, 
 particularly for price calculations, where the customers want endless 
 flexibility, and writing a rules engine to handle all of those cases would 
 be very complicated.

 Obviously, the JavaScript they write has to be runnable on both the client 
 and server. And, if it's just a matter of returning primitives or the 
 customer writing functions that take and return primitives, it's easy. 
 Simple JavaScript code snippets like this:

 var myname='Joe';

 function getMyName() { return 'Joe' };

 can be syntactically the same for both JSNI and Rhino.

 But the fun soon ends. Let's say I want to allow them to call into methods 
 in Java classes that I've defined, so I can give them an API to do useful 
 things. The syntax for accessing Java objects from JavaScript is vastly 
 different between Rhino and JSNI:

 // Rhino
 com.abc.package.MyClass.getSomethingUseful();

 // JSNI: first in Java
 public static native String exportGetSomethingUseful() /*-{
getSomethingUseful = 
 $entry(@com.abc.package.MyClass::getSomethingUseful());
 }-*/;

 // JSNI: then in JavaScript
 getSomethingUseful();

 The situation gets more challenging if you want to pass instances of your 
 own Java classes into JavaScript for their use, or call from JavaScript 
 into APIs defined in Java. You've got to define host objects in Rhino, and 
 I'm not even sure how you do it in JSNI without writing glue code by hand 
 so that they wouldn't have to learn JSNI's arcane syntax,

 My question is: I don't think it's possible for the JavaScript syntax to 
 be the same between JSNI and Rhino without writing some glue code on both 
 the client and server in JavaScript to insulate them from these syntactical 
 differences when working with APIs defined in Java. Am I right, or have I 
 missed anything?


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: How to use JavaScript to customize both the client and server in a consistent way?

2014-05-11 Thread Phineas Gage
Thanks for the idea. The options expand if they can call back to the 
server, but I was trying to make something work both client and server side.

The gwt-exporter project looks promising, as a lot of syntax might be 
similar between gwt-exporter and Rhino, but it currently has issues with 
GWT 2.6.0.

On Sunday, May 11, 2014 6:53:19 AM UTC+2, Paul Robinson wrote:

 You could let them write Java code instead and run it in the server only 
 using BeanShell2. Then the syntax and interoperability issues go away. But 
 you have to send results to the client rather than calculating directly on 
 the client.

 HTH
 Paul


-- 
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.
For more options, visit https://groups.google.com/d/optout.


How to use JavaScript to customize both the client and server in a consistent way?

2014-05-10 Thread Phineas Gage
I am writing a GWT app that will be usable by multiple customers. I'd like 
for my customers to be able to customize the app, both on the server side 
and client side by writing JavaScript. In other words, they could do things 
like:

- Set some configuration for their site, like its name, their web site URL, 
address, items on their site, etc.

- Write a JavaScript function to, for example, calculate the price for some 
item based on its properties. So the price calculation could be done on 
both the client and server, and no recompiling would be needed to change 
the price calculation.

The beauty of this is that they could write the JavaScript, and it could be 
run using JSNI on the client and Rhino on the server, giving consistent 
results. This could also get me out of the business of writing a bunch of 
administrative UI code to handle the many possibilities for customization 
that customers would want, and also give them much more flexibility, 
particularly for price calculations, where the customers want endless 
flexibility, and writing a rules engine to handle all of those cases would 
be very complicated.

Obviously, the JavaScript they write has to be runnable on both the client 
and server. And, if it's just a matter of returning primitives or the 
customer writing functions that take and return primitives, it's easy. 
Simple JavaScript code snippets like this:

var myname='Joe';

function getMyName() { return 'Joe' };

can be syntactically the same for both JSNI and Rhino.

But the fun soon ends. Let's say I want to allow them to call into methods 
in Java classes that I've defined, so I can give them an API to do useful 
things. The syntax for accessing Java objects from JavaScript is vastly 
different between Rhino and JSNI:

// Rhino
com.abc.package.MyClass.getSomethingUseful();

// JSNI: first in Java
public static native String exportGetSomethingUseful() /*-{
   getSomethingUseful = 
$entry(@com.abc.package.MyClass::getSomethingUseful());
}-*/;

// JSNI: then in JavaScript
getSomethingUseful();

The situation gets more challenging if you want to pass instances of your 
own Java classes into JavaScript for their use, or call from JavaScript 
into APIs defined in Java. You've got to define host objects in Rhino, and 
I'm not even sure how you do it in JSNI without writing glue code by hand 
so that they wouldn't have to learn JSNI's arcane syntax,

My question is: I don't think it's possible for the JavaScript syntax to be 
the same between JSNI and Rhino without writing some glue code on both the 
client and server in JavaScript to insulate them from these syntactical 
differences when working with APIs defined in Java. Am I right, or have I 
missed anything?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: How to use JavaScript to customize both the client and server in a consistent way?

2014-05-10 Thread Paul Robinson
You could let them write Java code instead and run it in the server only
using BeanShell2. Then the syntax and interoperability issues go away. But
you have to send results to the client rather than calculating directly on
the client.

HTH
Paul

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Passing hashmap as parameter from client to server by rpc

2014-01-14 Thread Leung
Hi,

I need to pass a hashmap from client to server by rpc. I get the following 
exception.
unexpected exception: java.lang.UnsatisfiedLinkError: 
com.google.gwt.user.client.Cookies.loadCookies(Ljava/util/HashMap;)V

I have tried to put the hashmapString, String in a serializable class as a 
wrapper, but I still get the same exception.
Is there any special way to pass the hashmap as input parameters?

Thanks

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Passing hashmap as parameter from client to server by rpc

2014-01-14 Thread Jens
HashMaps can be send using RPC without problems. What does not work is 
using GWT's Cookies class on server side, which is probably what happens.

-- 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Passing hashmap as parameter from client to server by rpc

2014-01-14 Thread Leung
Do hashmap relate to Cookies?





On Tuesday, January 14, 2014 3:56 AM, Jens jens.nehlme...@gmail.com wrote:
 
HashMaps can be send using RPC without problems. What does not work is using 
GWT's Cookies class on server side, which is probably what happens.

-- 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.
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problem in sending large size of data from GWT client to server by cross domain scripting

2013-06-14 Thread Shashank Beerla
if u knw the answer y dont u give a detail procedure to follow instead 
scribblin somethin in vague

On Thursday, May 12, 2011 4:09:52 AM UTC-4, Thomas Broyer wrote:

 There are tricks using a hidden form (FormPanel in GWT), but well, they're 
 a bit hackish... (what's hackish is communicating the result back to your 
 app: you have to send a redirect to a page that's the same origin as the 
 app, and this will call 2 FormPanel.SubmitEvent to be fired; or you could 
 use the window.name trick...)
 Maybe not that helpful to you as i'm a bit vague, but the point is: yes, 
 it's possible.


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: determine if running on client or server OR synchronize time on server/client?

2013-06-08 Thread Magnus
Thanks!

-- 
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.




determine if running on client or server OR synchronize time on server/client?

2013-06-07 Thread Magnus
Hi,

my chess application should trust only the server time.

However, I have a shared class that is used both on server and client. 
Within this class I determine the current time by creating a new Date 
object.

When running on the server, this object represents the correct time. When 
running on the client, I would like to synchronize it with the server 
before using it.

But how can I tell if I am running on the server or the client?

Below is a short pseudo code for illustration.

Thanks
Magnus

-

class ChessClock
{
 ...
 private int offset; // delta between server and client time
 ...

 private Date getCurrentTime ()
 {
  Date d = new Date ();

  if (!runningOnServer ())
  {
   long ms = d.getTime () + offset;
   d = new Date (ms);
  }
 }

 private boolean runningOnServer ()
 {
  // how to determine???
 }
 
}

-- 
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: determine if running on client or server OR synchronize time on server/client?

2013-06-07 Thread Paul Robinson
Use com.google.gwt.core.shared.GWT.isClient()

Paul

On 07/06/13 15:34, Magnus wrote:
 Hi,

 my chess application should trust only the server time.

 However, I have a shared class that is used both on server and client. 
 Within this class I determine the current time by creating a new Date object.

 When running on the server, this object represents the correct time. When 
 running on the client, I would like to synchronize it with the server before 
 using it.

 But how can I tell if I am running on the server or the client?

 Below is a short pseudo code for illustration.

 Thanks
 Magnus

 -

 class ChessClock
 {
  ...
  private int offset; // delta between server and client time
  ...

  private Date getCurrentTime ()
  {
   Date d = new Date ();

   if (!runningOnServer ())
   {
long ms = d.getTime () + offset;
d = new Date (ms);
   }
  }

  private boolean runningOnServer ()
  {
   // how to determine???
  }
  
 }

 -- 
 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.




sharing XML binding classes between client and server side of a GWT-RPC app (no need for marshaling/unmarshaling on the client)

2012-10-03 Thread Erik Torres
Hi,

I've seem the same question a lot of times in this list, but no answers to 
the problem of having XML documents on the server side of a GWT-RPC 
application and binding classes that can be reused on the client side. 
The use case is as follows:

- Binding classes automatically generated from XSD schemas.
- Marshaling and unmarshaling occur on the server side (no XML to 
class/class to XML conversion takes part on the client side).
- XML documents are consumed on the server side (client side consumes Java 
classes).
- Binding classes consumed both on the client and the server side of the 
application.
- GWT-RPC.

What is a valid approach to share XML binding classes between client and 
server side?

I've tried with JAXB, JiBX and XMLBeans, but always find problems with the 
serialization of the binding classes. All these technologies produce 
classes that implement Serializable, but for one reason or another, GWT 
fails to serialize them.

Thanks in advance and kind regards,

Erik

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/dDDfUxHSZ-YJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Access shared class in client and server

2012-07-17 Thread karun
Hi
 
can any one guide me.
 
Thanks
karun
On Friday, July 13, 2012 1:37:29 AM UTC+5:30, karun wrote:

 Hi 
  
 i have class in shared package, its very simple class which has a static 
 variable. i want to assign a value for this static variable in server class 
 and access the same value in client class.
  
 is it possible to access the value of static variable in client class, to 
 which i modify or assign a value in server class ?
  
 * 

 package
 *com.ca.csp.cso.project.shared;* 

 public
 **class* LocalisedString 

 {
 * 

 public
 **static* String *str_value;* 

 **}
  
 *package* com.ca.csp.cso.project.server;
  
 impot com.ca.csp.cso.project.shared.LocalisedString;
 ** 
 *public* *class* SimLookUpImpl *extends* RemoteServiceServlet {
 * 

 public
 **void* init() *throws* ServletException {* 

 super
 *.init(); 

 *try* { 

 LocalisedString.*str_value = samplestring;*

 *}*

 *catch* (Exception e) { 

 }

 }

 }
 * package* com.ca.csp.cso.project.client;
  
 * 

 impot com.ca.csp.cso.project.shared.LocalisedString;

 public
 **class* SimplePanel *extends* FlowPanel { 

 public SimplePanel ()

 {

 window.Alert(LocalisedString.*str_value *); // prints null;

 }

 }

  

 Thanks

 karun


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Owk5rwmydFEJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Access shared class in client and server

2012-07-17 Thread Jens
You have to send an instance of LocalisedString from server to client. 

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/a1URLfjEgD4J.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Access shared class in client and server

2012-07-12 Thread karun kumar
Hi

i have class in shared package, its very simple class which has a static
variable. i want to assign a value for this static variable in server class
and access the same value in client class.

is it possible to access the value of static variable in client class, to
which i modify or assign a value in server class ?

*

package* com.ca.csp.cso.project.shared;
*

public* *class* LocalisedString

{
*

public* *static* String *str_value;*

**}

*package* com.ca.csp.cso.project.server;

impot com.ca.csp.cso.project.shared.LocalisedString;
**
*public* *class* SimLookUpImpl *extends* RemoteServiceServlet {
*

public* *void* init() *throws* ServletException {
*

super*.init();

*try* {

LocalisedString.*str_value = samplestring;*

*}*

*catch* (Exception e) {

}

}

}
* package* com.ca.csp.cso.project.client;

*

impot com.ca.csp.cso.project.shared.LocalisedString;

public* *class* SimplePanel *extends* FlowPanel {

public SimplePanel ()

{

window.Alert(LocalisedString.*str_value *); // prints null;

}

}



Thanks

karun

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Help: GWT/RF.... client to server communication !!

2012-05-15 Thread Jens
Your query() method returns a List of Proxies, so your receiver should also 
contain a list of proxies and not a single one.

if you don't mind, send simple web application using GWT/RF sample code for 
 me


Check out the GWT SDK examples like DynaTableRf or MobileWebApp.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/k-rL6OL5mlwJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: sending data from client to server

2012-05-03 Thread swathi
it returns the listof value proxy.

i have one more query that how can i set data from client side to value proxy.
if possible could you please provide me the sample example to meet my criteria.
Thanks

On Wed, May 2, 2012 at 11:22 PM, Jens jens.nehlme...@gmail.com wrote:
 Shall i use the same proxy for the return result.


 Sounds like it doesn't make sense but I don't know your app nor what you
 want to search.

 If you search for some data in your database then you probably want to
 return a list of EntityProxy-s as a search result (if you want to display
 the search result). If your search is more like a server side calculation,
 e.g. How many matches do I have for that search query?, then you would
 return an Integer for example (or a ValueProxy / List of ValueProxy if the
 result is more complex and does not represent a database entity).

 -- J.

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/5GGMPH5J7jEJ.

 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.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-toolkit@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.



sending data from client to server

2012-05-02 Thread Ashu
Hi Everyone,
 
I have a requirement that, I have to search something from the db and 
get back some results(Like a search button functionality).For this I am 
giving some inputs.
I have to send these inputs(like Beans) to server side.
I am using GWT2.4 request factory.
How can i do this?
do i need to use value proxies here?

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/6nJVoE-VRtEJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: sending data from client to server

2012-05-02 Thread Jens


 do i need to use value proxies here?


Yes, with ValueProxys you can send data/bean like objects between 
client/server that do not have a database identity. 

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/XiLVXD7zDOwJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: sending data from client to server

2012-05-02 Thread swathi
Thanks for the reply.
I have one more small doubt.
Shall i use the same proxy for the return result.

could you please provide me the sample for this criteria.


On Wed, May 2, 2012 at 6:55 PM, Jens jens.nehlme...@gmail.com wrote:
 do i need to use value proxies here?


 Yes, with ValueProxys you can send data/bean like objects between
 client/server that do not have a database identity.

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-web-toolkit/-/XiLVXD7zDOwJ.

 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.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-toolkit@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: sending data from client to server

2012-05-02 Thread Jens


 Shall i use the same proxy for the return result. 


Sounds like it doesn't make sense but I don't know your app nor what you 
want to search. 

If you search for some data in your database then you probably want to 
return a list of EntityProxy-s as a search result (if you want to display 
the search result). If your search is more like a server side calculation, 
e.g. How many matches do I have for that search query?, then you would 
return an Integer for example (or a ValueProxy / List of ValueProxy if the 
result is more complex and does not represent a database entity).

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5GGMPH5J7jEJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Is it possible to transfer list of EntityProxy between client and server using Requestfactory

2012-02-26 Thread July
HI:
Just like below, Is it possible to transfer list of EntityProxy between 
client and server using RequestFactory? i didn't see any spec related to 
this in RF doc. And i always get NPE when using maven processor plugin to 
validate. Thanks.

@Service( value =foo.class, locator = bar.class )
public interface CustomerRequest extends RequestContext
{
RequestLong count( ListString searchparams,* ListMyEntityProxy 
parent* );
}

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/eblIw1Y0kNYJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Separate client and server implementations of a class

2012-02-07 Thread Antón Kuranov
Hello,

I have a problem. How to make a separate implementations of the same
class for client and server side?
I have an util class that must implement deep cloning for a set of
shared beans. On client side cloning can be made via JSNI and on
server side via reflection. Both implementations must be separated on
compile time.

Salu2,
Antó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-toolkit@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: Separate client and server implementations of a class

2012-02-07 Thread Paul Robinson

Look for super-source here:
http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html

and you can also google super-source if you need more.

HTH
Paul

On 07/02/12 17:06, Antón Kuranov wrote:

Hello,

I have a problem. How to make a separate implementations of the same
class for client and server side?
I have an util class that must implement deep cloning for a set of
shared beans. On client side cloning can be made via JSNI and on
server side via reflection. Both implementations must be separated on
compile time.

Salu2,
Antó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-toolkit@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: Bean Validation: Client vs Server

2011-10-03 Thread Piro
What methods are you using with Pattern/RegExp. String.matches isn't
enough?

On 3. Okt, 00:53 h., objectuser kevin.k.le...@gmail.com wrote:
 I'm differentiating validations to be run on the client vs. the server using
 validation groups.

 However, I have one validation for which I'd like a different implementation
 the client, due to the unavailability of the Pattern class there.  So on the
 client, I'd like to use the GWT RegExp class, while on the server, I'd like
 to use the JDK Pattern class.

 So far, I've not figured out a way to do this.  It seems like the only place
 to specify the validator class is in the validatedBy property of the
 @Constraint annotation.

 I even tried creating two different custom validation annotations, but the
 validation framework still seems to load the server version, and I get a
 runtime error due to the unavailability of the Pattern class.

 Thanks for any advice.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Bean Validation: Client vs Server

2011-10-03 Thread Thomas Broyer
Why don't you use the com.google.gwt.regexp.shared.RegExp on the server too?

Otherwise, I believe using super-source you could provide a client-side-only 
implementation.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ycVR8IDUL6wJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Bean Validation: Client vs Server

2011-10-03 Thread objectuser
I thought about just using RegExp on the sever, but it just seemed wrong to 
rely on that on the sever.  Not sure why, since I'm pretty coupled to GWT in 
any case. :)

The super-source idea is interesting.  I didn't know about that feature 
before.  Googling it, it seems pretty interesting.

Thanks for the recommendations!  I think I'll try out the super-source idea 
and then fallback to using RegExp.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Cx4IsOkEJI8J.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Bean Validation: Client vs Server

2011-10-03 Thread objectuser
Yeah, String.matches only matches the entire input.  I need to see if the 
string contains a regular expression, as in pattern.matcher(string).find().

Also, String.matches compiles the expression every time.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/LIxr69EzgHYJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Bean Validation: Client vs Server

2011-10-02 Thread objectuser
I'm differentiating validations to be run on the client vs. the server using 
validation groups.

However, I have one validation for which I'd like a different implementation 
the client, due to the unavailability of the Pattern class there.  So on the 
client, I'd like to use the GWT RegExp class, while on the server, I'd like 
to use the JDK Pattern class.

So far, I've not figured out a way to do this.  It seems like the only place 
to specify the validator class is in the validatedBy property of the 
@Constraint annotation.

I even tried creating two different custom validation annotations, but the 
validation framework still seems to load the server version, and I get a 
runtime error due to the unavailability of the Pattern class.

Thanks for any advice.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/jvwBMVoAzSUJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How do I throw all kinds of objects back and forth between client and server?

2011-09-02 Thread Navigateur
I want to be able to have the same object do client-specific behaviour
when on the client-side (UI etc.), and do some server-specific
behaviour when on the server-side (database etc.). So I want the same
object to hold both a Widget (unused/null on the server side) and a
server-specific Java object (unused/null when on the client side).

To achieve this, do I have to create some dummy GWT emulation for
the unused/null server-specific object on the client side and can I do
the same for the unused/null Widget on the server side? Or does it
work straight out of the box when you put it in the shared package?
If not, what's the best way of making this work?

My reason is simplicity. I don't want to have to put their respective
client and server behaviours away from the object.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How do I throw all kinds of objects back and forth between client and server?

2011-09-02 Thread Thomas Broyer


On Friday, September 2, 2011 12:18:36 PM UTC+2, Navigateur wrote:

 I want to be able to have the same object do client-specific behaviour 
 when on the client-side (UI etc.), and do some server-specific 
 behaviour when on the server-side (database etc.). So I want the same 
 object to hold both a Widget (unused/null on the server side) and a 
 server-specific Java object (unused/null when on the client side). 

 To achieve this, do I have to create some dummy GWT emulation for 
 the unused/null server-specific object on the client side


Yes.
(read about super-source here: 
http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml
 )
 
 

 and can I do 
 the same for the unused/null Widget on the server side? Or does it 
 work straight out of the box when you put it in the shared package?


shared is nothing special, just a convention. There's no such things as 
shared code in GWT; everything that GWT sees (in the source/ paths of 
your modules) has to be translatable to JS (i.e. client code); the client 
vs. shared vs. server is just a convention, where server code shouldn't 
use client code, to make it clear which code an run in both a browser 
(compiled to JS) and standard VM (server, or possibly Java client, such as 
Android, an applet or a desktop app).
But having a field of type Widget won't harm as long as you don't initialize 
the class (i.e. use it); so there's nothing special to do on the serer side.
 

 My reason is simplicity. I don't want to have to put their respective 
 client and server behaviours away from the object.


But then you don't have a clear separation of concerns, as a single class 
plays all shared, client and server roles, where client and serer 
are mutually exclusive.
You'd probably better abstract things behind an interface, and implement it 
in both your server-side specific object and your widget. It would have the 
benefit of adding testability of your code using a mock of that interface.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/tCnKFlMIuWoJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How do I throw all kinds of objects back and forth between client and server?

2011-09-02 Thread J.Ganesan


On Sep 2, 3:18 pm, Navigateur naveen.c...@gmail.com wrote:
 I want to be able to have the same object do client-specific behaviour
 when on the client-side (UI etc.), and do some server-specific
 behaviour when on the server-side (database etc.). So I want the same
 object to hold both a Widget (unused/null on the server side) and a
 server-specific Java object (unused/null when on the client side).

 To achieve this, do I have to create some dummy GWT emulation for
 the unused/null server-specific object on the client side and can I do
 the same for the unused/null Widget on the server side? Or does it
 work straight out of the box when you put it in the shared package?
 If not, what's the best way of making this work?

 My reason is simplicity.

Pack as much as possible in the shared code, that is, to the extent
the emulated JRE admits of. Have helper classes in  your server side
for database etc and in your client side for UI. This is close  to
developing a client-server application in java swing. The emulated JRE
has nice java.util.Collection which is handy  for domain modelling, UI
handling and persistence. I think this is not only a simple way of
developing but also maximally takes advantage of GWT.

J.Ganesan
www.DataStoreGwt.com

I don't want to have to put their respective
 client and server behaviours away from the object.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Seperating the hosting of the client and server

2011-09-02 Thread Sander Smith
Thanks, that's what I was looking for.

By adding the linker code in I was able to serve the HTML file the
Servlet server, and the static JS stuff from a completely different
domain. Not really so intuitive, but I understand that ultimately this
isn't a GWT issue but more like a browser issue.

On Sep 1, 12:18 pm, Thomas Broyer t.bro...@gmail.com wrote:
 On Thursday, September 1, 2011 6:07:23 PM UTC+2, Sander Smith wrote:

  I'm trying to seperate the client side of my GWT app (the JS files)
  from the server side by hosting them in different places. So the
  static JS is atwww.host1.comand the Java web app stuff is at
 www.host2.com.
  To communicate, I simply pass the fully qualified URL (http://
 www.host2.com/...) into setServiceEntryPoint().

  Things aren't working, and I don't know why.

 Same Origin Policy

  I've looked through the
  documentation to see if this is allowed, and can't find anything that
  says it's not. I have a gut feeling that this is violating some sort
  of JS security issue, so I wanted to check before continuing.

  Am I able to do what I want?

 If your HTML host page is on host1, then you won't be able to use GWT-RPC,
 RequestFactory or RequestBuilder to communicate with host2 (well, that's not
 entirely true, but if IE is to be supported, then consider it's simply not
 possible).

 You can however deploy your HTML host page on host2 and your JS at host1.
 You'll have to use the xsiframe linker for your code to be loaded in the
 web page though, but it's as easy as adding a line to your gwt.xml:
 add-linker name=xsiframe /

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Seperating the hosting of the client and server

2011-09-01 Thread Sander Smith
I'm trying to seperate the client side of my GWT app (the JS files)
from the server side by hosting them in different places. So the
static JS is at www.host1.com and the Java web app stuff is at www.host2.com.
To communicate, I simply pass the fully qualified URL (http://
www.host2.com/...) into setServiceEntryPoint().

Things aren't working, and I don't know why. I've looked through the
documentation to see if this is allowed, and can't find anything that
says it's not. I have a gut feeling that this is violating some sort
of JS security issue, so I wanted to check before continuing.

Am I able to do what I want?

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Seperating the hosting of the client and server

2011-09-01 Thread Thomas Broyer


On Thursday, September 1, 2011 6:07:23 PM UTC+2, Sander Smith wrote:

 I'm trying to seperate the client side of my GWT app (the JS files) 
 from the server side by hosting them in different places. So the 
 static JS is at www.host1.com and the Java web app stuff is at 
 www.host2.com. 
 To communicate, I simply pass the fully qualified URL (http:// 
 www.host2.com/...) into setServiceEntryPoint(). 

 Things aren't working, and I don't know why.


Same Origin Policy
 

 I've looked through the 
 documentation to see if this is allowed, and can't find anything that 
 says it's not. I have a gut feeling that this is violating some sort 
 of JS security issue, so I wanted to check before continuing. 

 Am I able to do what I want?


If your HTML host page is on host1, then you won't be able to use GWT-RPC, 
RequestFactory or RequestBuilder to communicate with host2 (well, that's not 
entirely true, but if IE is to be supported, then consider it's simply not 
possible).

You can however deploy your HTML host page on host2 and your JS at host1. 
You'll have to use the xsiframe linker for your code to be loaded in the 
web page though, but it's as easy as adding a line to your gwt.xml:
add-linker name=xsiframe /

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/YZ5pS1lfFUEJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: RequestFactory Best Practices: How to share object between client and server

2011-08-06 Thread br22
Thank you Ryan and Ben.

On Aug 4, 2:45 pm, Ryan McFall mcfall.r...@gmail.com wrote:
 I have frequently wanted to write utility code that processes an
 object in a particular way on both the client and server side
 representation of the object.

 Unfortunately, when usingRequestFactory, it is difficult to make this
 work cleanly.  You can declare that your domain object implements the
 proxy interface, and then write your common code in terms of the proxy
 interface.  But you will then have to come up with a dummy
 implementation of the stableId method required by EntityProxy.  If
 that doesn't bother you, then it should work.

 Ryan

 On Aug 4, 2:32 pm, br22 g22...@gmail.com wrote:

  Thank you, I have a Java code that can run either on the client or the
  server.
  When on the client it uses the Obj1Proxy that it gets from the server,
  but when it runs on the server it has the original Obj1. I assume that
  it can be solved with “generics” and “implements” , but I don't know
  Java that well.
  Thanks.

  On Aug 4, 1:52 pm, Ben Munge ben.mu...@gmail.com wrote:

   You generally shouldn't be doing this from a design standpoint. If you
   want to share some simple objects or utilities you could use the
   shared package, but beyond that would break encapsulation. If you
   could explain your requirements in a bit more detail I might be able
   to provide better assistance.

   On Aug 4, 11:24 am, br22 g22...@gmail.com wrote:

Great, but how you make the SAME Java code (that runs both on the
client and the server) share the SAME object (not 2 objects like Obj1
and Obj1Proxy)?

On Aug 4, 11:34 am, Ben Munge ben.mu...@gmail.com wrote:

 You create a Proxy object on the client for your corresponding server
 object.

http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

 On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:

  Sometimes you want the same Java code to run on the client and 
  server.
  With RPC it is easy to share the same object, what is thebestway to
  do this with RF?
  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-toolkit@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.



RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread br22
Sometimes you want the same Java code to run on the client and server.
With RPC it is easy to share the same object, what is the best way to
do this with RF?
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-toolkit@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: RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread Ben Munge
You create a Proxy object on the client for your corresponding server
object.

http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html


On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:
 Sometimes you want the same Java code to run on the client and server.
 With RPC it is easy to share the same object, what is the best way to
 do this with RF?
 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-toolkit@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: RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread br22
Great, but how you make the SAME Java code (that runs both on the
client and the server) share the SAME object (not 2 objects like Obj1
and Obj1Proxy)?

On Aug 4, 11:34 am, Ben Munge ben.mu...@gmail.com wrote:
 You create a Proxy object on the client for your corresponding server
 object.

 http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

 On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:

  Sometimes you want the same Java code to run on the client and server.
  With RPC it is easy to share the same object, what is the best way to
  do this with RF?
  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-toolkit@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: RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread Ben Munge
You generally shouldn't be doing this from a design standpoint. If you
want to share some simple objects or utilities you could use the
shared package, but beyond that would break encapsulation. If you
could explain your requirements in a bit more detail I might be able
to provide better assistance.

On Aug 4, 11:24 am, br22 g22...@gmail.com wrote:
 Great, but how you make the SAME Java code (that runs both on the
 client and the server) share the SAME object (not 2 objects like Obj1
 and Obj1Proxy)?

 On Aug 4, 11:34 am, Ben Munge ben.mu...@gmail.com wrote:







  You create a Proxy object on the client for your corresponding server
  object.

 http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

  On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:

   Sometimes you want the same Java code to run on the client and server.
   With RPC it is easy to share the same object, what is the best way to
   do this with RF?
   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-toolkit@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: RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread br22
Thank you, I have a Java code that can run either on the client or the
server.
When on the client it uses the Obj1Proxy that it gets from the server,
but when it runs on the server it has the original Obj1. I assume that
it can be solved with “generics” and “implements” , but I don't know
Java that well.
Thanks.

On Aug 4, 1:52 pm, Ben Munge ben.mu...@gmail.com wrote:
 You generally shouldn't be doing this from a design standpoint. If you
 want to share some simple objects or utilities you could use the
 shared package, but beyond that would break encapsulation. If you
 could explain your requirements in a bit more detail I might be able
 to provide better assistance.

 On Aug 4, 11:24 am, br22 g22...@gmail.com wrote:

  Great, but how you make the SAME Java code (that runs both on the
  client and the server) share the SAME object (not 2 objects like Obj1
  and Obj1Proxy)?

  On Aug 4, 11:34 am, Ben Munge ben.mu...@gmail.com wrote:

   You create a Proxy object on the client for your corresponding server
   object.

  http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

   On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:

Sometimes you want the same Java code to run on the client and server.
With RPC it is easy to share the same object, what is the best way to
do this with RF?
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-toolkit@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: RequestFactory Best Practices: How to share object between client and server

2011-08-04 Thread Ryan McFall
I have frequently wanted to write utility code that processes an
object in a particular way on both the client and server side
representation of the object.

Unfortunately, when using RequestFactory, it is difficult to make this
work cleanly.  You can declare that your domain object implements the
proxy interface, and then write your common code in terms of the proxy
interface.  But you will then have to come up with a dummy
implementation of the stableId method required by EntityProxy.  If
that doesn't bother you, then it should work.

Ryan

On Aug 4, 2:32 pm, br22 g22...@gmail.com wrote:
 Thank you, I have a Java code that can run either on the client or the
 server.
 When on the client it uses the Obj1Proxy that it gets from the server,
 but when it runs on the server it has the original Obj1. I assume that
 it can be solved with “generics” and “implements” , but I don't know
 Java that well.
 Thanks.

 On Aug 4, 1:52 pm, Ben Munge ben.mu...@gmail.com wrote:







  You generally shouldn't be doing this from a design standpoint. If you
  want to share some simple objects or utilities you could use the
  shared package, but beyond that would break encapsulation. If you
  could explain your requirements in a bit more detail I might be able
  to provide better assistance.

  On Aug 4, 11:24 am, br22 g22...@gmail.com wrote:

   Great, but how you make the SAME Java code (that runs both on the
   client and the server) share the SAME object (not 2 objects like Obj1
   and Obj1Proxy)?

   On Aug 4, 11:34 am, Ben Munge ben.mu...@gmail.com wrote:

You create a Proxy object on the client for your corresponding server
object.

   http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html

On Aug 4, 5:46 am, br22 g22...@gmail.com wrote:

 Sometimes you want the same Java code to run on the client and server.
 With RPC it is easy to share the same object, what is the best way to
 do this with RF?
 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-toolkit@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.



Trying to get the simplest communication between the client and server.

2011-07-05 Thread Dale12
I'm new to GWT and trying to get the simplest project under my belt.
I've got a project that does nothing but send a string from the client
to the server.  The server adds a string to that string and returns
it.  I've been spinning my wheels on this for days and don't know
where to go from here or what to even ask at this point.  I've read
numerous tutorials and sample projects on the subject and it all makes
sense.

My project compiles fine.  Then when I try to run web application i
get the following message in the browser (Chrome): 

HTTP ERROR 404

Problem accessing /MyGWTModule.html. Reason:

NOT_FOUND

I also get the following warning in the eclipse console.

[WARN] No file found for: /MyGWTModule.html
[WARN] No file found for: /favicon.ico

I compile and then run web application.  Am I missing a step?

If I zipped the project would someone be willing to take a quick look
at it (via email).  Or let me know if there's a better way of sharing
it.  Meanwhile, I'll post the project files in this post in hopes that
it will be enough for someone to help.

 Also, could someone fill me in on what the Util class is for in the
MyRemoteService interface is for?

 Thanks, the help is much appreciated.

**Entry point file
MyGWTModule**

package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.core.client.GWT;

/**
 * Entry point classes define codeonModuleLoad()/code.
 */
public class MyGWTModule implements EntryPoint {

//MyRemoteServiceAsync myRSAsync =
MyRemoteServiceAsync.Util.getInstance();
MyRemoteServiceAsync svc = GWT.create(MyRemoteService.class);

AsyncCallbackString callback = new AsyncCallbackString() {
public void onSuccess(String result) {
Window.alert(result);
}
public void onFailure(Throwable caught) {
Window.alert(RPC Failed.);
}
  };

private Button clickMeButton;
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();

clickMeButton = new Button();
rootPanel.add(clickMeButton);
clickMeButton.setText(Click me!);
clickMeButton.addClickHandler(new ClickHandler(){
public void onClick(ClickEvent event) {
Window.alert(Hello, GWT World!);
String s = ass;
svc.printSomething(s, callback);
Window.alert(s);

}
});
}
}
**End Entry point
file**

*MyRemoteService
Interface***

package com.mycompany.project.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath(MyRemoteService)
public interface MyRemoteService extends RemoteService {
/**
 * Utility class for simplifying access to the instance of async
service.
 */
public String printSomething(String s);

public static class Util {
private static MyRemoteServiceAsync instance;
public static MyRemoteServiceAsync getInstance(){
if (instance == null) {
instance = GWT.create(MyRemoteService.class);
}
return instance;
}
}
}
*End MyRemoteService
Interface***

*MyRemoteServiceAsync
Interface***
package com.mycompany.project.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface MyRemoteServiceAsync {

public void printSomething(String s, AsyncCallbackString callback);

*End MyRemoteServiceAsync
Interface***

*MyRemoteServiceImpl
Interface***
package com.mycompany.project.server;

import com.mycompany.project.client.MyRemoteService;
import

Aw: Trying to get the simplest communication between the client and server.

2011-07-05 Thread Jens
I think your code looks fine.

Do you actually have a MyGWTModule.html file inside your war folder or any 
html page that includes the generated .js files from GWT? 
If not you have to create one (New - HTML Page. The one with the GWT 
icon). 
You can also create it by hand. Just make sure you have

script type=text/javascript language=javascript src=your module 
name/your module name.nocache.js/script

in the html page's head tag and if you ever want to have history support 
you need

iframe src=javascript:'' id=__gwt_historyFrame tabIndex='-1' 
style=position:absolute;width:0;height:0;border:0/iframe

inside the body tag.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/KifRs7lnbNAJ.
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Trying to get the simplest communication between the client and server.

2011-07-05 Thread Dale12
Thanks for the response.  Yes, the HTML file and the CSS file are
there in the war fiolder.  It was created manually when I generated my
GWT module. Possibly the path is messed up somewhere?
I also tried to create a new HTML file as you suggested (not manually)
and when I clicked on finish, nothing happened.

Any other ideas?


On Jul 5, 11:55 am, Jens jens.nehlme...@gmail.com wrote:
 I think your code looks fine.

 Do you actually have a MyGWTModule.html file inside your war folder or any
 html page that includes the generated .js files from GWT?
 If not you have to create one (New - HTML Page. The one with the GWT
 icon).
 You can also create it by hand. Just make sure you have

 script type=text/javascript language=javascript src=your module
 name/your module name.nocache.js/script

 in the html page's head tag and if you ever want to have history support
 you need

 iframe src=javascript:'' id=__gwt_historyFrame tabIndex='-1'
 style=position:absolute;width:0;height:0;border:0/iframe

 inside the body tag.

 -- J.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Trying to get the simplest communication between the client and server.

2011-07-05 Thread Dale12
In addition to that, I can manually open the HTML file and when I
click on the button, I get an RPC failed message, which is what I
programmed it to do onFail().

On Jul 5, 11:55 am, Jens jens.nehlme...@gmail.com wrote:
 I think your code looks fine.

 Do you actually have a MyGWTModule.html file inside your war folder or any
 html page that includes the generated .js files from GWT?
 If not you have to create one (New - HTML Page. The one with the GWT
 icon).
 You can also create it by hand. Just make sure you have

 script type=text/javascript language=javascript src=your module
 name/your module name.nocache.js/script

 in the html page's head tag and if you ever want to have history support
 you need

 iframe src=javascript:'' id=__gwt_historyFrame tabIndex='-1'
 style=position:absolute;width:0;height:0;border:0/iframe

 inside the body tag.

 -- J.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Trying to get the simplest communication between the client and server.

2011-07-05 Thread Rike255
I'm new to GWT too so I'm not much help, but I went through this
tutorial and found it extremely useful:

http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html

It explains basically everything that you posted above.  Note that
there is no Util class in the Service interface though, that's
basically the only difference I could find between the code you posted
and this example.  I was able to get this example working properly in
my Eclipse environment (ran it exactly how you described too... GWT
compile + Run as Web App)

On Jul 5, 2:08 pm, Dale12 dale.prat...@gmail.com wrote:
 In addition to that, I can manually open the HTML file and when I
 click on the button, I get an RPC failed message, which is what I
 programmed it to do onFail().

 On Jul 5, 11:55 am, Jens jens.nehlme...@gmail.com wrote:







  I think your code looks fine.

  Do you actually have a MyGWTModule.html file inside your war folder or any
  html page that includes the generated .js files from GWT?
  If not you have to create one (New - HTML Page. The one with the GWT
  icon).
  You can also create it by hand. Just make sure you have

  script type=text/javascript language=javascript src=your module
  name/your module name.nocache.js/script

  in the html page's head tag and if you ever want to have history support
  you need

  iframe src=javascript:'' id=__gwt_historyFrame tabIndex='-1'
  style=position:absolute;width:0;height:0;border:0/iframe

  inside the body tag.

  -- J.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Caching large datasets on Client or Server?

2011-06-03 Thread Gambo
Hi there,

I am struggling in finding a good solution for a caching method in my
application. The client is sometimes retrieving more than 5000 rows
which will be displayed in a pageable grid for now. In my first
solution everytime the users clicked on next page the server only send
the data snapshot of this side which works ok. But it always gets the
complete dataset from the database.

Now we are adding sorting which should also be done on the server. My
question is now what is the best strategy to follow here?

I thought about caching the complete 5000 rows on server side but I
really dont know how to do this as the server is stateless. The only
thing I have is httpSession to identify but i dont know if its a good
idea to store this cache in a httpsession.

Another problem is that my app supports a filtering option which could
change the data of 5000 rows so the cache would be invalid.

Is it a good idea to cache to rows on client side? I am not sure as
the sorting would be done in Javascript right?

Thanks for your help

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Caching large datasets on Client or Server?

2011-06-03 Thread J.Ganesan


On Jun 3, 12:55 pm, Gambo mark.vanv...@gmail.com wrote:
 Hi there,

 I am struggling in finding a good solution for a caching method in my
 application. The client is sometimes retrieving more than 5000 rows
 which will be displayed in a pageable grid for now. In my first
 solution everytime the users clicked on next page the server only send
 the data snapshot of this side which works ok. But it always gets the
 complete dataset from the database.

 Now we are adding sorting which should also be done on the server. My
 question is now what is the best strategy to follow here?

 I thought about caching the complete 5000 rows on server side but I
 really dont know how to do this as the server is stateless. The only
 thing I have is httpSession to identify but i dont know if its a good
 idea to store this cache in a httpsession.

 Another problem is that my app supports a filtering option which could
 change the data of 5000 rows so the cache would be invalid.

 Is it a good idea to cache to rows on client side?

It is a question of latency. Wait for every page or wait longer
initially and experience ibstant response thereafter. If each row is a
domain object, you get a lot of extensibility - sorting, row-specific
right-click menu, filtering, categorizing. etc. You can make the
user forget that he is viewing in a browser.

J.Ganesan
www.DataStoreGwt.com




I am not sure as
 the sorting would be done in Javascript right?

 Thanks for your help

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Problem in sending large size of data from GWT client to server by cross domain scripting

2011-05-12 Thread Renee Lau
Dear All,

I have followed the tutorial and the application is able to make cross
site communication with GET request and query string in the URL.

However, one of the function of my application is to send the XML
String to the server from the GWT client in cross domain environment.
The GET request cannot fulfill my need as it exceeds the standard
query string size.

What should I do to make it work? Can I make a post request to the the
servlet in cross domain environment?

Please kindly show me some tips on this.
Thanks a lot.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Problem in sending large size of data from GWT client to server by cross domain scripting

2011-05-12 Thread Thomas Broyer
There are tricks using a hidden form (FormPanel in GWT), but well, they're a 
bit hackish... (what's hackish is communicating the result back to your 
app: you have to send a redirect to a page that's the same origin as the 
app, and this will call 2 FormPanel.SubmitEvent to be fired; or you could 
use the window.name trick...)
Maybe not that helpful to you as i'm a bit vague, but the point is: yes, 
it's possible.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Data Structure between client and server

2011-04-18 Thread Raghavan
In case of having separate model for client and server, use dozer mapper
which would map the data from source class to destination the
only prerequisite would be the data member names should be same.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How to get hand on serialized data sent between Client and Server (using GWT RPC)

2011-04-18 Thread Dodge
Hey there,

i would like to ask if there is a way to get hand on the serialized
data sent between Client (RPC Call with AsyncCallback) and Server
(RemoteServiceServlet) to do some stuff with it ;)


For Server-Side i found that i could overwrite the processCall()
method to do execute my desired code on the serialized data. But i
have no idea how to achiev this on clientside. all i found until now
is the
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.class in
gwt-user.jar having a onResponseReceived() method where i should be
able to do my stuff inside, but here i have no idea, how to get my
class/method in place of this original code.

Is there a way, to modify the request data sent from my client to
the server, and also the response from server to client?


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-toolkit@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.



Data Structure between client and server

2011-04-13 Thread Angelo Brandimarte
I have just started working with GWT, for an University Project. I
have to create a classic client-server sistem.
The client and the server must communicate exchanging some
information.
The server uses data structures to maintain a user model and to
execute basic internal functionalities.
The client uses similar data structures to maintain alignment with the
model in the server.
Is it a good idea to have the client and the server use the same data
structures, and use these structures as the information exchange,
putting them in the shared package, or would it be better to use a
different set of data structures?
Which is the best and commonly solution to this problem?
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-toolkit@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: Data Structure between client and server

2011-04-13 Thread Juan Pablo Gardella
I think use the most simple approach is better. So, if share structure data
is simple and enough, use it. I take this approach

2011/4/13 Angelo Brandimarte angelobrandima...@gmail.com

 I have just started working with GWT, for an University Project. I
 have to create a classic client-server sistem.
 The client and the server must communicate exchanging some
 information.
 The server uses data structures to maintain a user model and to
 execute basic internal functionalities.
 The client uses similar data structures to maintain alignment with the
 model in the server.
 Is it a good idea to have the client and the server use the same data
 structures, and use these structures as the information exchange,
 putting them in the shared package, or would it be better to use a
 different set of data structures?
 Which is the best and commonly solution to this problem?
 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-toolkit@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-toolkit@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 to automatically download image to client from server when button clicked

2011-03-16 Thread azuniga
I am having the user click a button that will generate a report on the
server side. The report has embedded charts and graphs but since the
report is generated server side with BIRT libraries, when I return the
report as an HTML string, the images aren't displayed. What I'm trying
to do is have those images downloaded to the user's machine
automatically and then adding an image widget to the panel to display
the charts and graphs. Is there some sample code I can use to do this?
I have the server side servlet code I found from and example and
modified it for my code. I am missing the client side code. Can anyone
help? Also, I'd appreciate any suggestions or advice if I'm not doing
this correctly or if there's some better way to do this.

Server side:
public class FileServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse
resp) throws
ServletException, IOException {

// set the responses content type
resp.setContentType(image/svg+xml);

// set the header for the response
resp.setHeader(Content-Disposition, attachment;
filename=image.svg);

// get the output writer
PrintWriter out = resp.getWriter();

// display a simple message
out.println(This is the output content);
out.println(Probably something dynamic should go in here);

}
}

Client Side:?

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to automatically download image to client from server when button clicked

2011-03-16 Thread Juan Pablo Gardella
You can generate an URL to make the report and use
http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/user/client/ui/Image.html
.

Juan

2011/3/16 azuniga alessandro.zun...@gmail.com

 I am having the user click a button that will generate a report on the
 server side. The report has embedded charts and graphs but since the
 report is generated server side with BIRT libraries, when I return the
 report as an HTML string, the images aren't displayed. What I'm trying
 to do is have those images downloaded to the user's machine
 automatically and then adding an image widget to the panel to display
 the charts and graphs. Is there some sample code I can use to do this?
 I have the server side servlet code I found from and example and
 modified it for my code. I am missing the client side code. Can anyone
 help? Also, I'd appreciate any suggestions or advice if I'm not doing
 this correctly or if there's some better way to do this.

 Server side:
 public class FileServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse
 resp) throws
ServletException, IOException {

// set the responses content type
resp.setContentType(image/svg+xml);

// set the header for the response
resp.setHeader(Content-Disposition, attachment;
 filename=image.svg);

// get the output writer
PrintWriter out = resp.getWriter();

// display a simple message
out.println(This is the output content);
out.println(Probably something dynamic should go in here);

}
 }

 Client Side:?

 --
 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.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-toolkit@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: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-08 Thread Thomas Broyer
...and proxies and contexts are needed at runtime by the 
RequestFactoryServlet, so they should really be in shared.

The domain objects and services should be in server though, of course 
(IMO, even if using interfaces, though YMMV). I use the @ProxyForName and 
@ServiceName annotations (rather than @ProxyFor and @Service) to reference 
them without the need to have them in the classpath.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-08 Thread JosephLi
hi Thomas,

Any plans on getting similar checks that performed by
RequestFactoryInterfaceValidator to the Eclipse plugin so it will show
it immediately there is an error and possibly offered a suggestion
right there  thru Ctrl-1?

Thanks,
Joseph

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-08 Thread Thomas Broyer
I'm sure it's in the works, but I'm not working at Google… ;-)

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-07 Thread Thomas Broyer


On Monday, March 7, 2011 6:51:11 AM UTC+1, zixzigma wrote:

 It is often recommended that, it is a good practice, for components,
 such as client/server communicate through interface. 

 when working with RequestFactory,
 we need to define RequestContext, which makes use of Entity/Value Proxies.
 these are all interfaces. 

 however, Server side code, cannot implement this RequestContext interface.
 server-side code, has no notion of RequestFactory, EntityProxy, etc.

 in other words, client and server do not implement the exact same 
 interface,
 they use a conceptually equivalent interface, but it is not the same.

 if we think of client/server being separate projects,
 how can we enforce the contract ?


Generate one from the other?

There's also 
RequestFactoryInterfaceValidatorhttp://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidator.html
 

 I would like to have a shared interface FooService, declaring my services 
 or DAOs, (findFooBy(id))
 and use
 ClientFoo implements FooService
 ServerFoo implements FooService

 ClientFoo uses RequestFactory related code,
 ServerFoo, a serverside framework
 but these two communicationg through SAME interface, not conceptually 
 similar.
 is this possible ? (I'm afraid it is not, what can be done to minimize the 
 impact) ?


It won't work, because the client-side has to have a RequestX return type 
when the server side returns X. And for proxies vs. domain objects, it can 
only work when you don't reference other objects (as the client would have 
to reference the proxy and the server the domain object).

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-07 Thread Y2i


On Sunday, March 6, 2011 9:51:11 PM UTC-8, zixzigma wrote:

 It is often recommended that, it is a good practice, for components,
 such as client/server communicate through interface. 

 when working with RequestFactory,
 we need to define RequestContext, which makes use of Entity/Value Proxies.
 these are all interfaces. 

 however, Server side code, cannot implement this RequestContext interface.
 server-side code, has no notion of RequestFactory, EntityProxy, etc.

 in other words, client and server do not implement the exact same 
 interface,
 they use a conceptually equivalent interface, but it is not the same.

 if we think of client/server being separate projects,
 how can we enforce the contract ?


I'm looking at this as if Entitiy/Value classes on the server implement 
EntityProxy/ValueProxy interfaces declared by the client.  Even though 
Entitiy/Value classes do not implement the interfaces using Java *implements
* keyword, the implementation is enforced by the GWT compiler.  This makes 
the server classes completely decoupled from the client interfaces while the 
contract is being enforced at the same time.  This system is more flexible 
then Java-based implementation because it allows using legacy server classes 
with the new GWT applications.

And if writing interfaces by hand is tedious there is always a generator 
option (as Thomas suggested and as already implemented by Spring Roo)
 


 I would like to have a shared interface FooService, declaring my services 
 or DAOs, (findFooBy(id))
 and use
 ClientFoo implements FooService
 ServerFoo implements FooService

 ClientFoo uses RequestFactory related code,
 ServerFoo, a serverside framework
 but these two communicationg through SAME interface, not conceptually 
 similar.
 is this possible ? (I'm afraid it is not, what can be done to minimize the 
 impact) ?

 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-toolkit@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: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-07 Thread zixzigma
Thank You.


I am trying to breaking my app into: client, server, and shared modules.

in the shared module, I would like to put
 RequestContext, and Entity/Value Proxy interfaces,
as well as server side Interfaces corresponding to RequestContext, 

for example, this shared module:
EmployeeProxy - used by client
EmployeeRequest - used by client
EmployeeService - used by server, conceptually equivalent of EmployeeRequest

and then on server modules, I implement interfaces defined in the shared 
module above (EmployeeService for example)
but not doing anything about EmployeeProxy and EmployeeRequest. because they 
are going to be implemented by client.
so although the module is shared, client and server implement different 
interfaces.
this made me wonder, whether I have to make it a shared module after all ?
what do you think ?

do you think this way of partitioning is ok ?


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-toolkit@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: How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-07 Thread Y2i
Breaking the app into server, client and shared is a right thing to do, but 
placing proxies, requests and services there does not seem right.  
Proxies and requests belong to the client, services to the server.  
Shared packages should contain code used by both the client and the server 
(common constants, enums, common algorithms, etc).  When using request 
factories, there is no need for DTOs in the shared packages.

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How to solve this design problem, when using RequestFactory ? (how to enforce client and server to use same interface)

2011-03-06 Thread zixzigma
It is often recommended that, it is a good practice, for components,
such as client/server communicate through interface. 

when working with RequestFactory,
we need to define RequestContext, which makes use of Entity/Value Proxies.
these are all interfaces. 

however, Server side code, cannot implement this RequestContext interface.
server-side code, has no notion of RequestFactory, EntityProxy, etc.

in other words, client and server do not implement the exact same interface,
they use a conceptually equivalent interface, but it is not the same.

if we think of client/server being separate projects,
how can we enforce the contract ?

I would like to have a shared interface FooService, declaring my services or 
DAOs, (findFooBy(id))
and use
ClientFoo implements FooService
ServerFoo implements FooService

ClientFoo uses RequestFactory related code,
ServerFoo, a serverside framework
but these two communicationg through SAME interface, not conceptually 
similar.
is this possible ? (I'm afraid it is not, what can be done to minimize the 
impact) ?

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-toolkit@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: Client en Server side validation

2011-01-20 Thread Jeroen Wolff
I've got 2 types of validation. Syntax and business rules.
The syntax can be solved in the presenter, but i don't want to
validate the whole bean if i only want to validate one property of
that bean.

I'm thinking to make it like this:

Class Foo() {
  Date date;
  String otherfield;

 public validateAndSetDate(String textFromWidget, Error errors) {
// try to make the string into a valid date with some date utils
   if not ok, than fill the errors object with an error message
}

Now i can try to set the value after a onBlur() in the presenter to
try to update the model (Foo)

But i want to do the same on the server after a RPC call because the
user could possible tamper the data somehowshould i than check all
the validateSetters? of all my properties with
validateAndSetDate(foo.getDate.asString(),errors) ??

I would be nice that i only check the changed properties after my last
RPC call. Any ideas?

Thanks.

Jeroen

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Client en Server side validation

2011-01-19 Thread Jeroen Wolff
Hi, there has been a lot of discussion already in this group about
validation and the frameworks that can help with it.
Now i'm in a big project which need form/field validation onChange
focus events and the same field validation
need to be done on the server when the domain objects are being send
via RPC to the server.
Based on the concept: Always validate your input. The data coming in
on the server is also input that we want to validate.

Is this a right approach? If so, why can't i find this issue more
spoken of...or does anybody thrust the rpc input?

How do you slove this problem?
If i make the presenter responsible for validating the widgets input,
how does i know on the server which validator to use because on the
server i have no presenter.

Do you have patterns for this problem?

Thanks,

Jeroen Wolff

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Client en Server side validation

2011-01-19 Thread Ben Imp
The correct thing to do, in my mind anyway (admittedly an odd place),
is never trust a client and do your own validation of the data and
operation requested.  This contrasts with my professional experience,
which has been that pretty much everyone just trusts the client and
mindlessly follows its directions.  I should mention that most of the
applications I have dealt with are internal to an organization, so a
rogue client isn't as big of a risk there.

-Ben

On Jan 19, 2:06 pm, Jeroen Wolff jeroen.wo...@gmail.com wrote:
 Hi, there has been a lot of discussion already in this group about
 validation and the frameworks that can help with it.
 Now i'm in a big project which need form/field validation onChange
 focus events and the same field validation
 need to be done on the server when the domain objects are being send
 via RPC to the server.
 Based on the concept: Always validate your input. The data coming in
 on the server is also input that we want to validate.

 Is this a right approach? If so, why can't i find this issue more
 spoken of...or does anybody thrust the rpc input?

 How do you slove this problem?
 If i make the presenter responsible for validating the widgets input,
 how does i know on the server which validator to use because on the
 server i have no presenter.

 Do you have patterns for this problem?

 Thanks,

 Jeroen Wolff

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Client en Server side validation

2011-01-19 Thread Jeff Schwartz
It depends on what you mean by validation. If you mean that the data
conforms to the business rules then IMO you can validate on the client and
all you need to do on the server is authenticate the user.

A practice that I follow is storing the user's session id in encrypted form
on the client. I obtain the session id on the server when the user first
authenticates and I encrypt it and send it back to the client. When the
client communicates with the server I send the encrypted session id as part
of the data payload to the server where it is validated again the user's
current session id. If it isn't the same I force the user to login and
authenticate.

Jeff

On Wed, Jan 19, 2011 at 4:00 PM, Ben Imp benlee...@gmail.com wrote:

 The correct thing to do, in my mind anyway (admittedly an odd place),
 is never trust a client and do your own validation of the data and
 operation requested.  This contrasts with my professional experience,
 which has been that pretty much everyone just trusts the client and
 mindlessly follows its directions.  I should mention that most of the
 applications I have dealt with are internal to an organization, so a
 rogue client isn't as big of a risk there.

 -Ben

 On Jan 19, 2:06 pm, Jeroen Wolff jeroen.wo...@gmail.com wrote:
  Hi, there has been a lot of discussion already in this group about
  validation and the frameworks that can help with it.
  Now i'm in a big project which need form/field validation onChange
  focus events and the same field validation
  need to be done on the server when the domain objects are being send
  via RPC to the server.
  Based on the concept: Always validate your input. The data coming in
  on the server is also input that we want to validate.
 
  Is this a right approach? If so, why can't i find this issue more
  spoken of...or does anybody thrust the rpc input?
 
  How do you slove this problem?
  If i make the presenter responsible for validating the widgets input,
  how does i know on the server which validator to use because on the
  server i have no presenter.
 
  Do you have patterns for this problem?
 
  Thanks,
 
  Jeroen Wolff

 --
 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.




-- 
*Jeff Schwartz*

-- 
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.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Is there a way to use i18n in a shared class that works on client and server too?

2010-12-09 Thread nacho
Any idea?

Noone did this before?

On 19 nov, 12:36, nacho vela.igna...@gmail.com wrote:
 I have some Validators classes. I use those classes in the client
 code, so I think to use Constants:

 For example, in some part of my AccountValidator I have this:

 errors.add(myConstants.accountTypeRequired());

 That works great for GWT compiled code. But what about if I need to
 use this same validator on the server and I want to send the errors on
 a Exception through the rpc service?

 How can I handlei18nin a class that I use in server classes and in
 client classes?

-- 
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: Is there a way to use i18n in a shared class that works on client and server too?

2010-12-09 Thread Shawn Brown
Hi,


 How can I handlei18nin a class that I use in server classes and in
 client classes?

Here is a recent thread on the topic.

http://www.mail-archive.com/google-web-toolkit@googlegroups.com/msg48015.html

I think you'll find GWT doesn't do this well.

Shawn

-- 
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.



Is there a way to use i18n in a shared class that works on client and server too?

2010-11-19 Thread nacho
I have some Validators classes. I use those classes in the client
code, so I think to use Constants:

For example, in some part of my AccountValidator I have this:

errors.add(myConstants.accountTypeRequired());

That works great for GWT compiled code. But what about if I need to
use this same validator on the server and I want to send the errors on
a Exception through the rpc service?

How can I handle i18n in a class that I use in server classes and in
client classes?

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-10 Thread Kashif
I know that, but more importantly how can I have a class that is
shared as common code where compiler will use gwt.Json.client
JSONObject on client code and server code will use
org.Json.JSONObject?



On Nov 9, 10:49 pm, Gal Dolber gal.dol...@gmail.com wrote:
 Sorry, under com.google.gwt.json.client





 On Tue, Nov 9, 2010 at 11:49 PM, Gal Dolber gal.dol...@gmail.com wrote:
  So you need to use:

 http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/index.html?o...

  On Tue, Nov 9, 2010 at 10:48 PM, Kashif kashifshaikh...@gmail.com wrote:

  No, I don't want to use Overlays - because that forces me to have a
  DTO class that has separate implementation on client and server.

  The whole point of using JSONObject is that I have a java API that I
  can use to marshall/unmarshall DTO objects regardless if I'm sending
  them from client to server or vice versa.

  On Nov 9, 9:29 pm, Gal Dolber gal.dol...@gmail.com wrote:
   The best you can use in the client to handle json are Overlays.
 http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...

   On Tue, Nov 9, 2010 at 7:17 PM, Kashif kashifshaikh...@gmail.com
  wrote:
Hi everyone,

I have a class that I want to share both with client and server code,
in my particular case it's the JSONObject.

It has different implementations on client
(com.google.gwt.json.client.JSONObject) and server
(org.json.JSONObject), but same interface.

So I have a DTO class like this shared between client and server, so I
can use JSON to pass objects around and wrap them in JSONObjects for
easy API access:

class Person {

   String firstName;
   String lastName;

   public JSONObject toJson()
   {
      // code to convert firstname + lastname to JSON
   }

   public fromJSON (JSONObject x)
   {
      // code to read from JSONObject and set firstName and lastName
   }
}

There is no way for me to tell GWT to use
com.google.gwt.json.client.JSONObject when compiling this class on
client, and likewise use org.json.JSONObject on server. I would have
to resort to Java String.

Now I could do the following, but I would have to re-write the toJson/
fromJson methods for each implementation -  not acceptable to me!

class PersonBase
{
 String firstname;
 String lastname;
}

class Person_Client extends PersonBase
{
   public fromJSON (om.google.gwt.json.client.JSONObject x)
   {
      // code to read from JSONObject and set firstName and lastName
   }

   public com.google.gwt.json.client.JSONObject toJson()
   {
      // code to convert firstname + lastname to JSON
   }
}

class Person_Server extends PersonBase
{
   public fromJSON (org.json.JSONObject x)
   {
      // code to read from JSONObject and set firstName and lastName
   }

   public org.json.JSONObject toJson()
   {
      // code to convert firstname + lastname to JSON
   }
}

There must be an easier way!

--
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.comgoogle-web-toolkit%2Bunsubs
  cr...@googlegroups.com
.
For more options, visit this group at
   http://groups.google.com/group/google-web-toolkit?hl=en.

   --
   Guit: Elegant, beautiful, modular and *production ready* gwt
  applications.

  http://code.google.com/p/guit/

  --
  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.

  --
  Guit: Elegant, beautiful, modular and *production ready* gwt applications.

 http://code.google.com/p/guit/

 --
 Guit: Elegant, beautiful, modular and *production ready* gwt applications.

 http://code.google.com/p/guit/

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-10 Thread Thomas Broyer

On 10 nov, 03:48, Kashif kashifshaikh...@gmail.com wrote:
 No, I don't want to use Overlays - because that forces me to have a
 DTO class that has separate implementation on client and server.

Overlay types can implement interfaces, so you could code against
interfaces to share some code between client and server, but yes it
still means having two implementations of the interface: on for the
client side (overlay type) and another for the server side (POJO).

 The whole point of using JSONObject is that I have a java API that I
 can use to marshall/unmarshall DTO objects regardless if I'm sending
 them from client to server or vice versa.

See http://code.google.com/p/google-web-toolkit/issues/detail?id=4959
and http://code.google.com/p/google-web-toolkit/issues/detail?id=2900

If com.google.gwt.json.client and org.json classes really have similar
APIs, then you could probably use super-source to provide an
emulation of org.json that'd use com.google.gwt.json.client
internally.
Or instead of using JSONObject directly, you could use some JSONReader
and JSONWriter (that'd still mean 2 distinct implementations for the
client side and the server side, but you've just moved the burden to 2
other classes, that moreover are shared by all your domain objects).

-- 
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 to use JSONObject with common code shared between client and server

2010-11-09 Thread Kashif
Hi everyone,

I have a class that I want to share both with client and server code,
in my particular case it's the JSONObject.

It has different implementations on client
(com.google.gwt.json.client.JSONObject) and server
(org.json.JSONObject), but same interface.

So I have a DTO class like this shared between client and server, so I
can use JSON to pass objects around and wrap them in JSONObjects for
easy API access:

class Person {

String firstName;
String lastName;

public JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}

public fromJSON (JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}
}

There is no way for me to tell GWT to use
com.google.gwt.json.client.JSONObject when compiling this class on
client, and likewise use org.json.JSONObject on server. I would have
to resort to Java String.

Now I could do the following, but I would have to re-write the toJson/
fromJson methods for each implementation -  not acceptable to me!

class PersonBase
{
  String firstname;
  String lastname;
}

class Person_Client extends PersonBase
{
public fromJSON (om.google.gwt.json.client.JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}

public com.google.gwt.json.client.JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}
}

class Person_Server extends PersonBase
{
public fromJSON (org.json.JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}

public org.json.JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}
}

There must be an easier way!

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-09 Thread Gal Dolber
The best you can use in the client to handle json are Overlays.
http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOverlay.html

On Tue, Nov 9, 2010 at 7:17 PM, Kashif kashifshaikh...@gmail.com wrote:

 Hi everyone,

 I have a class that I want to share both with client and server code,
 in my particular case it's the JSONObject.

 It has different implementations on client
 (com.google.gwt.json.client.JSONObject) and server
 (org.json.JSONObject), but same interface.

 So I have a DTO class like this shared between client and server, so I
 can use JSON to pass objects around and wrap them in JSONObjects for
 easy API access:

 class Person {

String firstName;
String lastName;

public JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}

public fromJSON (JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}
 }

 There is no way for me to tell GWT to use
 com.google.gwt.json.client.JSONObject when compiling this class on
 client, and likewise use org.json.JSONObject on server. I would have
 to resort to Java String.

 Now I could do the following, but I would have to re-write the toJson/
 fromJson methods for each implementation -  not acceptable to me!

 class PersonBase
 {
  String firstname;
  String lastname;
 }

 class Person_Client extends PersonBase
 {
public fromJSON (om.google.gwt.json.client.JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}

public com.google.gwt.json.client.JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}
 }

 class Person_Server extends PersonBase
 {
public fromJSON (org.json.JSONObject x)
{
   // code to read from JSONObject and set firstName and lastName
}

public org.json.JSONObject toJson()
{
   // code to convert firstname + lastname to JSON
}
 }

 There must be an easier way!

 --
 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.




-- 
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-09 Thread Kashif
No, I don't want to use Overlays - because that forces me to have a
DTO class that has separate implementation on client and server.

The whole point of using JSONObject is that I have a java API that I
can use to marshall/unmarshall DTO objects regardless if I'm sending
them from client to server or vice versa.



On Nov 9, 9:29 pm, Gal Dolber gal.dol...@gmail.com wrote:
 The best you can use in the client to handle json are 
 Overlays.http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...





 On Tue, Nov 9, 2010 at 7:17 PM, Kashif kashifshaikh...@gmail.com wrote:
  Hi everyone,

  I have a class that I want to share both with client and server code,
  in my particular case it's the JSONObject.

  It has different implementations on client
  (com.google.gwt.json.client.JSONObject) and server
  (org.json.JSONObject), but same interface.

  So I have a DTO class like this shared between client and server, so I
  can use JSON to pass objects around and wrap them in JSONObjects for
  easy API access:

  class Person {

     String firstName;
     String lastName;

     public JSONObject toJson()
     {
        // code to convert firstname + lastname to JSON
     }

     public fromJSON (JSONObject x)
     {
        // code to read from JSONObject and set firstName and lastName
     }
  }

  There is no way for me to tell GWT to use
  com.google.gwt.json.client.JSONObject when compiling this class on
  client, and likewise use org.json.JSONObject on server. I would have
  to resort to Java String.

  Now I could do the following, but I would have to re-write the toJson/
  fromJson methods for each implementation -  not acceptable to me!

  class PersonBase
  {
   String firstname;
   String lastname;
  }

  class Person_Client extends PersonBase
  {
     public fromJSON (om.google.gwt.json.client.JSONObject x)
     {
        // code to read from JSONObject and set firstName and lastName
     }

     public com.google.gwt.json.client.JSONObject toJson()
     {
        // code to convert firstname + lastname to JSON
     }
  }

  class Person_Server extends PersonBase
  {
     public fromJSON (org.json.JSONObject x)
     {
        // code to read from JSONObject and set firstName and lastName
     }

     public org.json.JSONObject toJson()
     {
        // code to convert firstname + lastname to JSON
     }
  }

  There must be an easier way!

  --
  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.

 --
 Guit: Elegant, beautiful, modular and *production ready* gwt applications.

 http://code.google.com/p/guit/

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-09 Thread Gal Dolber
So you need to use:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/index.html?overview-summary.html

On Tue, Nov 9, 2010 at 10:48 PM, Kashif kashifshaikh...@gmail.com wrote:

 No, I don't want to use Overlays - because that forces me to have a
 DTO class that has separate implementation on client and server.

 The whole point of using JSONObject is that I have a java API that I
 can use to marshall/unmarshall DTO objects regardless if I'm sending
 them from client to server or vice versa.



 On Nov 9, 9:29 pm, Gal Dolber gal.dol...@gmail.com wrote:
  The best you can use in the client to handle json are Overlays.
 http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...
 
 
 
 
 
  On Tue, Nov 9, 2010 at 7:17 PM, Kashif kashifshaikh...@gmail.com
 wrote:
   Hi everyone,
 
   I have a class that I want to share both with client and server code,
   in my particular case it's the JSONObject.
 
   It has different implementations on client
   (com.google.gwt.json.client.JSONObject) and server
   (org.json.JSONObject), but same interface.
 
   So I have a DTO class like this shared between client and server, so I
   can use JSON to pass objects around and wrap them in JSONObjects for
   easy API access:
 
   class Person {
 
  String firstName;
  String lastName;
 
  public JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
 
  public fromJSON (JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
   }
 
   There is no way for me to tell GWT to use
   com.google.gwt.json.client.JSONObject when compiling this class on
   client, and likewise use org.json.JSONObject on server. I would have
   to resort to Java String.
 
   Now I could do the following, but I would have to re-write the toJson/
   fromJson methods for each implementation -  not acceptable to me!
 
   class PersonBase
   {
String firstname;
String lastname;
   }
 
   class Person_Client extends PersonBase
   {
  public fromJSON (om.google.gwt.json.client.JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
 
  public com.google.gwt.json.client.JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
   }
 
   class Person_Server extends PersonBase
   {
  public fromJSON (org.json.JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
 
  public org.json.JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
   }
 
   There must be an easier way!
 
   --
   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.comgoogle-web-toolkit%2Bunsubs
 cr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/google-web-toolkit?hl=en.
 
  --
  Guit: Elegant, beautiful, modular and *production ready* gwt
 applications.
 
  http://code.google.com/p/guit/

 --
 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.




-- 
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

-- 
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: How to use JSONObject with common code shared between client and server

2010-11-09 Thread Gal Dolber
Sorry, under com.google.gwt.json.client
On Tue, Nov 9, 2010 at 11:49 PM, Gal Dolber gal.dol...@gmail.com wrote:

 So you need to use:

 http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/index.html?overview-summary.html


 On Tue, Nov 9, 2010 at 10:48 PM, Kashif kashifshaikh...@gmail.com wrote:

 No, I don't want to use Overlays - because that forces me to have a
 DTO class that has separate implementation on client and server.

 The whole point of using JSONObject is that I have a java API that I
 can use to marshall/unmarshall DTO objects regardless if I'm sending
 them from client to server or vice versa.



 On Nov 9, 9:29 pm, Gal Dolber gal.dol...@gmail.com wrote:
  The best you can use in the client to handle json are Overlays.
 http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...
 
 
 
 
 
  On Tue, Nov 9, 2010 at 7:17 PM, Kashif kashifshaikh...@gmail.com
 wrote:
   Hi everyone,
 
   I have a class that I want to share both with client and server code,
   in my particular case it's the JSONObject.
 
   It has different implementations on client
   (com.google.gwt.json.client.JSONObject) and server
   (org.json.JSONObject), but same interface.
 
   So I have a DTO class like this shared between client and server, so I
   can use JSON to pass objects around and wrap them in JSONObjects for
   easy API access:
 
   class Person {
 
  String firstName;
  String lastName;
 
  public JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
 
  public fromJSON (JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
   }
 
   There is no way for me to tell GWT to use
   com.google.gwt.json.client.JSONObject when compiling this class on
   client, and likewise use org.json.JSONObject on server. I would have
   to resort to Java String.
 
   Now I could do the following, but I would have to re-write the toJson/
   fromJson methods for each implementation -  not acceptable to me!
 
   class PersonBase
   {
String firstname;
String lastname;
   }
 
   class Person_Client extends PersonBase
   {
  public fromJSON (om.google.gwt.json.client.JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
 
  public com.google.gwt.json.client.JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
   }
 
   class Person_Server extends PersonBase
   {
  public fromJSON (org.json.JSONObject x)
  {
 // code to read from JSONObject and set firstName and lastName
  }
 
  public org.json.JSONObject toJson()
  {
 // code to convert firstname + lastname to JSON
  }
   }
 
   There must be an easier way!
 
   --
   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.comgoogle-web-toolkit%2Bunsubs
 cr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/google-web-toolkit?hl=en.
 
  --
  Guit: Elegant, beautiful, modular and *production ready* gwt
 applications.
 
  http://code.google.com/p/guit/

 --
 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.




 --
 Guit: Elegant, beautiful, modular and *production ready* gwt applications.

 http://code.google.com/p/guit/







-- 
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

-- 
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: Client Vs Server and Google app engine

2010-10-20 Thread Didier DURAND
Hi,

I would also advise you to give a try to Objectify: I abandonned jdo
for it. Very efficient and much simpler!

Concerning your issue, Objectify works great: its annotations go
through via GWT and you can use same class on client and server.

See http://code.google.com/p/objectify-appengine/wiki/ObjectifyWithGWT

didier

On Oct 19, 9:25 am, Michel Uncini uncini.mic...@gmail.com wrote:
 Hello everybody

 I'm developing a GWT project.
 I have two packets one .client and the other .server
 in my .gwt.xml I specified only the .client packet because in
 the .server I use google app engine.
 Let consider the class Company which has to be stored in the
 database I can't use it in the .client packet because it use
 com.google.appengine and is impossible to inherit right?
 So the only way if I want have a similar class in the .client packet
 is to create a new class similar to Company but without appengine
 fields??

 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.



Client Vs Server and Google app engine

2010-10-19 Thread Michel Uncini
Hello everybody

I'm developing a GWT project.
I have two packets one .client and the other .server
in my .gwt.xml I specified only the .client packet because in
the .server I use google app engine.
Let consider the class Company which has to be stored in the
database I can't use it in the .client packet because it use
com.google.appengine and is impossible to inherit right?
So the only way if I want have a similar class in the .client packet
is to create a new class similar to Company but without appengine
fields??

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: Client Vs Server and Google app engine

2010-10-19 Thread Fendy Tjin
Hi,

Well, I've made gwt app as well. What I do is creating two models, one in the 
server and another in the client package. 

You may want to look into spring roo framework. If you do not want to have 2 
models.

Best regards,
Fendy Tjin

On Oct 19, 2010, at 2:25 PM, Michel Uncini uncini.mic...@gmail.com wrote:

 Hello everybody
 
 I'm developing a GWT project.
 I have two packets one .client and the other .server
 in my .gwt.xml I specified only the .client packet because in
 the .server I use google app engine.
 Let consider the class Company which has to be stored in the
 database I can't use it in the .client packet because it use
 com.google.appengine and is impossible to inherit right?
 So the only way if I want have a similar class in the .client packet
 is to create a new class similar to Company but without appengine
 fields??
 
 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.
 

-- 
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.



Transferring data from client to server: Do extra methods add more information that is sent to the server?

2010-08-06 Thread spierce7
If I'm transferring an object that has some persistent data in it to
be saved on the server, from the client to the server (or vice versa),
does me having extra methods in the object, increase the amount of
data transferred between the server and the client? What about extra
variables that are not persisted?

-- 
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: Transferring data from client to server: Do extra methods add more information that is sent to the server?

2010-08-06 Thread Paul Robinson
Extra methods do not affect the serialized size. What matters is the
fields on your classes that are not transient, static or final.

spierce7 wrote:
 If I'm transferring an object that has some persistent data in it to
 be saved on the server, from the client to the server (or vice versa),
 does me having extra methods in the object, increase the amount of
 data transferred between the server and the client? What about extra
 variables that are not persisted?

   

-- 
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 we define the location of our server war to separate client from server deployment

2010-06-26 Thread hanna
I am using a simple GWT app with GWT-RPC. I want to be able to host
the server code
on a separate server from the simple client code. However, I don't see
a place in the client
code to define where is the location of the servlet, it asssumes they
are part of the same
war file on the same server. how would I be able to tell the client
code where the server
location is located ? 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: How to determine if running on client or server?

2010-05-06 Thread Stefan Bachert
Hi,

class X
{
  static public XYZ xyz;
}

put on server side X.xyz = new ServerXYZ()
put on client side X.xyz = new ClientXYZ()

When you prefer an accessor, just do it

Stefan Bachert
 http://gwtworld.de

On 5 Mai, 16:59, stingermn stinge...@gmail.com wrote:
 I have an interface, XYZ, which is implemented on the client side as
 class ClientXYZ and on the server side as class ServerXYZ.  I would
 like to have a common utility method, getXYZ(), which can be called
 from both client and server and will return either ClientXYZ or
 ServerXYZ depending on if the method is invoked on the client or
 server side.  Does anyone know if this is possible?  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 
 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: How to determine if running on client or server?

2010-05-05 Thread kozura
Make a factory, in the client code initialize to a client-
implementation creating factory, and on the server to a server
factory.

Note that to pass it through RPC you'll need to use/convert to the
client side class.

On May 5, 8:59 am, stingermn stinge...@gmail.com wrote:
 I have an interface, XYZ, which is implemented on the client side as
 class ClientXYZ and on the server side as class ServerXYZ.  I would
 like to have a common utility method, getXYZ(), which can be called
 from both client and server and will return either ClientXYZ or
 ServerXYZ depending on if the method is invoked on the client or
 server side.  Does anyone know if this is possible?  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: How to determine if running on client or server?

2010-05-05 Thread Sripathi Krishnan
Use if( GWT.isClient() ) in your code to decide if its client side or server
side.

See the class EscapeUtil for example -
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/rpc/client/impl/EscapeUtil.java#27

--Sri



On 5 May 2010 20:29, stingermn stinge...@gmail.com wrote:

 I have an interface, XYZ, which is implemented on the client side as
 class ClientXYZ and on the server side as class ServerXYZ.  I would
 like to have a common utility method, getXYZ(), which can be called
 from both client and server and will return either ClientXYZ or
 ServerXYZ depending on if the method is invoked on the client or
 server side.  Does anyone know if this is possible?  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: How to determine if running on client or server?

2010-05-05 Thread Thomas Broyer


On 5 mai, 21:25, Sripathi Krishnan sripathikrish...@gmail.com wrote:
 Use if( GWT.isClient() ) in your code to decide if its client side or server
 side.

 See the class EscapeUtil for example 
 -http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...

Note that this means your server-side implementation must be
translatable to JS. If it isn't, then super-source/ is your friend.

-- 
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: Sharing code between client and server

2009-11-04 Thread XqSun

You may try to:

1) Find a library which could be compiled/run for both client and
server sides

2) Use generic type (then wrap/extend it for client/server) such as:

public class XmlUtilsNode {
public String getTextNodeValue(Node node) {
Node txNode = getTextNode(node);
return (txNode==null)? : (txNode.getNodeValue());
}
}

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Sharing code between client and server

2009-11-03 Thread asw888

I have some XML helper functions that I would like to share between
client and server. For example:

public class XmlUtils {
public static String getTextNodeValue(Node node) {
Node txNode = getTextNode(node);
return (txNode==null)? : (txNode.getNodeValue());
}
}

The only difference between client and server versions is:

import com.google.gwt.xml.client.*;
vs.
import org.w3c.dom.*;

What would be the simplest way to share as much of the XmlUtils code
as possible?

Thanks,
Andy

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



ECLIPSE + GWT client + Python server

2009-10-30 Thread nl65

Need to configure a Web Application on Eclipse where Client is GWT
and  Server is Python (Pydev) .

Possible ?  How ?

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



RPC communication between client and server running different GWT versions

2009-10-22 Thread Gwencalon

Greetings!

I'm trying to develop my first web application that uses GWT.

I'm using GWT 1.7.1 to develop the client, since I'd like to use
SmartGWT and it requires at least GWT 1.5.3.
However, my server is running JRE 1.4.2. Therefore, I can only use GWT
1.4.x.

To achieve this, I'm generating the client-side stuff with java 6 and
GWT 1.7.1. Then, I create my servlet with java 1.4 and GWT 1.4.62.
Unfortunately, this does not seem to be working. It works fine when I
have the server using the same GWT/Java version... but when I switch
to an older version it's not communicating.

I tried to check the release notes to see if something changed in RPC
communication,  but apart from generics I couldn't find anything
relevant. Eitherway, I think I'll check version 1.5.3 for the client..
the closest version to the server's that fits my needs.

It may be some other issue, but if some one could tell me for sure
that it is/it is not possible to get/send data via RPC under such
conditions I'd be very grateful!

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-toolkit@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: Using class on both client and server sides

2009-08-24 Thread Ice13ill

And what if i want to use a package both on the client and server
side, but one of the classes has imports from app engine witch cannot
be used in GWT. Can i instruct the compiler (let's say in the .gwt.xml
file) to exclude a class from a package when compiling ?

On Jul 29, 6:18 pm, Nuno brun...@gmail.com wrote:
 Also, if you class is just a pojo you dont really need to create it in two
 places...
 the server code can access all of your client code.
 You just need to make the classes you want to transport from client to
 server or vice versa.

 In your example Contact may stay in the client package, and if you need to
 send a Contact object to the server, or make the server
 send it to you, just make this class Serializable.



 On Wed, Jul 29, 2009 at 12:10 PM, Paul Robinson ukcue...@gmail.com wrote:

  You want this in your gwt.xml file:
     source path=client/
     source path=shared/

  Note that if any source... element appears in your gwt.xml, then the
  implied client source path is not added for you - so you will need both
  of the above.

  Paul

  Ice13ill wrote:
   Hello,
   I'm trying to use a class (let's say Contact) on both client and
   server sides (packages: com.app.client and com.app.server). For that
   purpose I created a shared package (com.app.shared) in which to put
   the Contact class. But gwt (client side) only sees classes in
   com.app.client package. How can I use the Contact class on client side
   for the com.app.shared package? Do I have to add a inherits tag in
   my .gwt.xml file ?
   Thanks.

 --
 Quer aprender a programar? acompanhe:
 Wants to learn GWT? Follow this blog -

 http://tcninja.blogspot.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-toolkit@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: Using class on both client and server sides

2009-08-24 Thread Thomas Broyer



On 24 août, 12:28, Ice13ill andrei.fifi...@gmail.com wrote:
 And what if i want to use a package both on the client and server
 side, but one of the classes has imports from app engine witch cannot
 be used in GWT. Can i instruct the compiler (let's say in the .gwt.xml
 file) to exclude a class from a package when compiling ?

Yes, source/ supports ANT-like filter attributes:
http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuidePathFiltering

See also http://code.google.com/p/google-web-toolkit/wiki/ResourceOracle
for the gory details.

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Client or server?

2009-07-30 Thread alex.d

May be this thread will help you:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/1b66b3901ec37a7f#

On 29 Jul., 17:13, Nuno brun...@gmail.com wrote:
 a class in the client sive can also be used in the server side...just make
 it implements Serializable and send it back to the server with the RPC
 services.

 Also note that as the classes in the client package are going to become
 javascript, they don't implement all of the JRE.
 That may be also a factor to know if you should put this on the client
 package.

 On Wed, Jul 29, 2009 at 12:07 PM, maarten.de...@gmail.com 



 maarten.de...@gmail.com wrote:

  Hi,

  I'm experimenting with GWT for a couple of weeks now and ran into
  another question.

  The question relates where to put a certain class. Classes in the
  client package are translated into javascript. Classes in the server
  package are executed as java (I'm using App Engine too). Say I'm
  building an app with a little game. I can write the game class at
  client side so that that code can be run at the client, what seems to
  be correct here. At the end of the game, the game should be persisted
  into the datastore. So I make it persistence capable but than the
  class is needed at the server side.

  What should I do now? Put it at server side and use it at client side
  too? In that case, the class needs to be inherited in the .gwt.xml,
  no? Or should I build two seperate classes: just send the data of the
  game to the server and build the data store element from that data to
  store it?

  Some advice would be appreciated :)

  Maarten Decat

 --
 Quer aprender a programar? acompanhe:
 Wants to learn GWT? Follow this blog -

 http://tcninja.blogspot.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-Toolkit@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: Using class on both client and server sides

2009-07-30 Thread Dean S. Jones

this is the correct response, tho, I put all inter-client-server
classes in shared/rpc, or some such package.

On Jul 29, 11:10 am, Paul Robinson ukcue...@gmail.com wrote:
 You want this in your gwt.xml file:
     source path=client/
     source path=shared/

 Note that if any source... element appears in your gwt.xml, then the
 implied client source path is not added for you - so you will need both
 of the above.

 Paul



 Ice13ill wrote:
  Hello,
  I'm trying to use a class (let's say Contact) on both client and
  server sides (packages: com.app.client and com.app.server). For that
  purpose I created a shared package (com.app.shared) in which to put
  the Contact class. But gwt (client side) only sees classes in
  com.app.client package. How can I use the Contact class on client side
  for the com.app.shared package? Do I have to add a inherits tag in
  my .gwt.xml file ?
  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-Toolkit@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: Client or server?

2009-07-30 Thread Maarten Decat

Thanks! It helped a lot :)

On 30 jul, 08:46, alex.d alex.dukhov...@googlemail.com wrote:
 May be this thread will help 
 you:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

 On 29 Jul., 17:13, Nuno brun...@gmail.com wrote:

  a class in the client sive can also be used in the server side...just make
  it implements Serializable and send it back to the server with the RPC
  services.

  Also note that as the classes in the client package are going to become
  javascript, they don't implement all of the JRE.
  That may be also a factor to know if you should put this on the client
  package.

  On Wed, Jul 29, 2009 at 12:07 PM, maarten.de...@gmail.com 

  maarten.de...@gmail.com wrote:

   Hi,

   I'm experimenting with GWT for a couple of weeks now and ran into
   another question.

   The question relates where to put a certain class. Classes in the
   client package are translated into javascript. Classes in the server
   package are executed as java (I'm using App Engine too). Say I'm
   building an app with a little game. I can write the game class at
   client side so that that code can be run at the client, what seems to
   be correct here. At the end of the game, the game should be persisted
   into the datastore. So I make it persistence capable but than the
   class is needed at the server side.

   What should I do now? Put it at server side and use it at client side
   too? In that case, the class needs to be inherited in the .gwt.xml,
   no? Or should I build two seperate classes: just send the data of the
   game to the server and build the data store element from that data to
   store it?

   Some advice would be appreciated :)

   Maarten Decat

  --
  Quer aprender a programar? acompanhe:
  Wants to learn GWT? Follow this blog -

 http://tcninja.blogspot.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-Toolkit@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
-~--~~~~--~~--~--~---



Using class on both client and server sides

2009-07-29 Thread Ice13ill

Hello,
I'm trying to use a class (let's say Contact) on both client and
server sides (packages: com.app.client and com.app.server). For that
purpose I created a shared package (com.app.shared) in which to put
the Contact class. But gwt (client side) only sees classes in
com.app.client package. How can I use the Contact class on client side
for the com.app.shared package? Do I have to add a inherits tag in
my .gwt.xml file ?
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-Toolkit@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
-~--~~~~--~~--~--~---



  1   2   >