Hi all,

I would like to throw an exception at the serverside with a user
message. However, I can't access i18n strings at serverside, as these
are at the client side. The main goal is to validate user-input at
server and client side with the same code. How should I do this? I
have something like this:

.client
class RPC {
    void doSomething() throws ExceptionUserReadable;
}

.shared
class Validator {
    calledServerAndClientSide(ClientInput input, I18nConstants ... )
throws ExceptionUserReadable;
}
class ExceptionUserReadable {
...
}

The validator in the shared package is called just before sending it
to the server -which works-, but I would like to use the validator
again at the server side. But there I can't let guice inject the
I18nContacts or do a Gwt.create() on the constants class, because it
is in the server package.

For me it is quite common to check two times: one time at the
clientside to relief the server from doing trivial checks and to speed
up the user handling at the same time, and do it again at serverside
in case someone tries to hack his way into the system. Sharing the
same validator would be nice, although I will be adding some extra
checks on the serverside anyway as well, but not having to duplicate
code sounds great, doesn't it?

Thanks!
Baloe

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

Reply via email to