1 Reply Latest reply on Aug 17, 2012 12:46 PM by Jonathan Fuerth

    Marshalling JSR-303 classes

    ddcracauer Newbie

      Greetings,

      I'm struggling a bit trying to figure out how to marshall JSR-303 classes (ConstraintViolation  etc) to the client.  I've created java beans implementations of all the classes, but ran into an issue immediately in ConstraintViolation.  It has Class<T> getRootBean() in its interface, which probably can't be marshalled.

       

      To work around this I tried two things

       

      1)  A custom marshaller for Class that returned an empty string on marshall and null on demarshall

      2) A MappingDefinition that didn't include mappings for that property

       

       

      In both cases, I get:  org.jboss.errai.codegen.exception.OutOfScopeException: javax_validation_Path not found.

       

      Anyone have any ideas?  Am I going down the wrong path?

        • 1. Re: Marshalling JSR-303 classes
          Jonathan Fuerth Master

          Hi David,

           

          Since Bean Validation is available on both the client and the server, you could make new instances of ConstraintViolation by sending the (potentially invalid) bean graph across the wire, and then running validation on the other side. Typically you'd want to do this anway, since client-side validation is nice and fast, but since we can never really trust that the client has not been tampered with, we need to validate again on the server side for safety.

           

          I know this isn't actually an answer to the question you asked, but maybe it's helpful.

           

          -Jonathan