Package org.qi4j.library.rest.server.restlet

Examples of org.qi4j.library.rest.server.restlet.ConstraintViolationMessages


        }
        catch( ConstraintViolationException e )
        {
            try
            {
                ConstraintViolationMessages cvm = new ConstraintViolationMessages();

                // CVE are considered client faults
                String messages = "";
                Locale locale = ObjectSelection.type( Locale.class );
                for( ConstraintViolation constraintViolation : e.constraintViolations() )
                {
                    if( !messages.isEmpty() )
                    {
                        messages += "\n";
                    }
                    messages += cvm.getMessage( constraintViolation, locale );
                }

                response.setEntity( new StringRepresentation( messages ) );
                response.setStatus( Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY );
            }
View Full Code Here

TOP

Related Classes of org.qi4j.library.rest.server.restlet.ConstraintViolationMessages

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.