I want use the Validation API, http://gwt-code-reviews.appspot.com/1040802/show but I don't where add the user/javax and user/org/hibernate files
On 25 mai, 17:00, Adolfo Panizo Touzon <[email protected]> wrote: > http://code.google.com/webtoolkit/doc/trunk/DevGuideServerCommunicati... > > 2011/5/25 Adolfo Panizo Touzon <[email protected]> > > > I don´t understand. ¿What´s the problem? > > > Maybe you can declarate HashMap in the client side and can´t transport by > > rpc. > > > I´m not sure, but, what´s the problem? > > > 2011/5/25 MaximeMularz <[email protected]> > > >> The implementation (http://code.google.com/p/google-web-toolkit/source/ > >> browse/trunk/samples/validation/src/com/google/gwt/sample/validation<http://code.google.com/p/google-web-toolkit/source/browse/trunk/sampl...> > >> ): > > >> public class GreetingServiceImpl extends RpcServlet implements > >> GreetingService { > > >> private final Validator validator = > >> Validation.buildDefaultValidatorFactory().getValidator(); > > >> public SafeHtml greetServer(Person person) throws > >> IllegalArgumentException, > >> ConstraintViolationException { > >> // Verify that the input is valid. > >> Set<ConstraintViolation<Person>> violations = > >> validator.validate(person, > >> Default.class, ServerGroup.class); > >> if (!violations.isEmpty()) { > >> Set<ConstraintViolation<?>> temp = new > >> HashSet<ConstraintViolation<?>>( > >> violations); > >> throw new ConstraintViolationException(temp); > >> } > > >> String serverInfo = getServletContext().getServerInfo(); > >> String userAgent = getThreadLocalRequest().getHeader("User- > >> Agent"); > > >> // Escape data from the client to avoid cross-site script > >> vulnerabilities. > >> SafeHtmlBuilder builder = new SafeHtmlBuilder(); > > >> SafeHtml safeHtml = builder// > >> .appendEscapedLines("Hello, " + person.getName() + "!")// > >> .appendHtmlConstant("<br>")// > >> .appendEscaped("I am running " + serverInfo + ".")// > >> .appendHtmlConstant("<br><br>")// > >> .appendEscaped("It looks like you are using: ")// > >> .appendEscaped(userAgent)// > >> .toSafeHtml(); > >> return safeHtml; > >> } > > >> On 25 mai, 11:30, Adolfo Panizo Touzon <[email protected]> > >> wrote: > >> > You can save the errors strings in an arrayList<String> and transpor by > >> rpc > >> > to the client side. > > >> > 2011/5/25 MaximeMularz <[email protected]> > > >> > > Hi, > > >> > > Client Side no probem it works, but ServerSide I can't catch the > >> > > excepetion becasue HashSet is not supported by RPCService : > > >> > > [ERROR] javax.servlet.ServletContext log: Exception while dispatching > >> > > incoming RPC call > >> > > com.google.gwt.user.client.rpc.SerializationException: Type > >> > > 'java.util.HashSet' was not included in the set of types which can be > >> > > serialized by this SerializationPolicy or its Class object could not > >> > > be loaded. For security purposes, this type will not be serialized.: > >> > > instance = > > >> [ConstraintViolationImpl{interpolatedMessage='{custom.name.size.message}', > >> > > propertyPath=name, rootBeanClass=class myvalidator.shared.Person, > >> > > messageTemplate='{custom.name.size.message}'}] > >> > > at > > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java: > >> > > 619) > >> > > at > > >> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java: > >> > > 126) > >> > > at > > >> javax.validation.ConstraintViolationException_CustomFieldSerializer.serialize(ConstraintViolationException_CustomFieldSerializer.java: > >> > > 49) > >> > > at > > >> javax.validation.ConstraintViolationException_CustomFieldSerializer.serializeInstance(ConstraintViolationException_CustomFieldSerializer.java: > >> > > 72) > >> > > at > > >> javax.validation.ConstraintViolationException_CustomFieldSerializer.serializeInstance(ConstraintViolationException_CustomFieldSerializer.java: > >> > > 28) > >> > > at > > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java: > >> > > 740) > >> > > at > > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java: > >> > > 621) > >> > > at > > >> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java: > >> > > 126) > >> > > at > >> > > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter > >> > > $ValueWriter$8.write(ServerSerializationStreamWriter.java:153) > >> > > at > > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java: > >> > > 539) > >> > > at > >> com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:616) > >> > > at > >> > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java: > >> > > 390) > >> > > at > >> > > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java: > >> > > 588) > >> > > at > > >> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java: > >> > > 208) > >> > > at > > >> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java: > >> > > 248) > >> > > at > > >> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java: > >> > > 62) > >> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) > >> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > >> > > at > >> > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java: > >> > > 511) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1166) > >> > > at > > >> com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java: > >> > > 35) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1157) > >> > > at > > >> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java: > >> > > 58) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1157) > >> > > at > > >> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java: > >> > > 43) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1157) > >> > > at > > >> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java: > >> > > 122) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1157) > >> > > at > > >> com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java: > >> > > 94) > >> > > at org.mortbay.jetty.servlet.ServletHandler > >> > > $CachedChain.doFilter(ServletHandler.java:1157) > >> > > at > >> > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java: > >> > > 388) > >> > > at > > >> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java: > >> > > 216) > >> > > at > >> > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java: > >> > > 182) > >> > > at > >> > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java: > >> > > 765) > >> > > at > >> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java: > >> > > 418) > >> > > at > > >> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java: > >> > > 70) > >> > > at > >> > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java: > >> > > 152) > >> > > at com.google.appengine.tools.development.JettyContainerService > >> > > $ApiProxyHandler.handle(JettyContainerService.java:351) > >> > > at > >> > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java: > >> > > 152) > >> > > at org.mortbay.jetty.Server.handle(Server.java:326) > >> > > at > >> > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java: > >> > > 542) > >> > > at org.mortbay.jetty.HttpConnection > >> > > $RequestHandler.content(HttpConnection.java:938) > >> > > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755) > >> > > at > >> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) > >> > > at > >> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) > >> > > at > > >> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java: > >> > > 409) > >> > > at org.mortbay.thread.QueuedThreadPool > >> > > $PoolThread.run(QueuedThreadPool.java:582) > > >> > > Thanks for your help > > >> > > Maxime > > >> > > On 23 mai, 18:34, Nick Chalko <[email protected]> wrote: > >> > > > Glad you got it working. > > >> > > > On Mon, May 23, 2011 at 9:31 AM, Adolfo Panizo Touzon < > > >> > > > [email protected]> wrote: > >> > > > > Hi Maxim!!! > > >> > > > > It works!!! > > >> > > > > I have made a very simple example based on Google (because if you > >> have > >> > > a > >> > > > > problemthat I do not solve, sure there are people that if you > >> could > >> > > lend a > >> > > > > hand.) > >> > > > > The steps you follow are the following: > > >> > > > > -Add the project (which I attached) to your workspace. > >> > > > > -Select your gwt sdk 0.0.0.0 > >> > > > > -Add the libraries to your classpath you in the picture attached. > >> > > > > -Run it. > > >> > > > > If you have any questions or comment on it is a problem here that > >> I > >> > > miss > >> > > > > you a hand with any thing. > > >> > > > > Greetings! > > >> > > > > Now I work as an example to finally understand itself completely. > > >> > > > > Adolfo Panizo. > > >> > > > > 2011/5/23 Adolfo Panizo Touzon <[email protected]> > > ... > > plus de détails » -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
