Examples of ResteasyViolationException


Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

      }
      catch (Exception e)
      {
         ViolationsContainer<Object> violationsContainer = getViolationsContainer(request, object);
         violationsContainer.setException(e);
         throw new ResteasyViolationException(violationsContainer);
      }
      ViolationsContainer<Object> violationsContainer = getViolationsContainer(request, object);
      violationsContainer.addViolations(rcvs);
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

      Object target = violationsContainer.getTarget();
      if (target != null && !isWeldProxy(target.getClass()))
      {
         if (violationsContainer != null && violationsContainer.size() > 0)
         {
            throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
         }
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

     
      @SuppressWarnings("unchecked")
      ViolationsContainer<Object> violationsContainer = ViolationsContainer.class.cast(request.getAttribute(ViolationsContainer.class.getName()));
      if (violationsContainer != null && violationsContainer.size() > 0)
      {
         throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

         }
      }
      catch (Exception e)
      {
         violationsContainer.setException(e);
         throw new ResteasyViolationException(violationsContainer);
      }
      violationsContainer.addViolations(rcvs);
      if (!isWeldProxy(object.getClass()) && violationsContainer.size() > 0)
      {
         throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

         }
      }
      catch (Exception e)
      {
         violationsContainer.setException(e);
         throw new ResteasyViolationException(violationsContainer);
      }
      violationsContainer.addViolations(rcvs);
      if (violationsContainer.size() > 0)
      {
         throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

         }
         catch (Exception e1)
         {
            ViolationsContainer<Object> violationsContainer = getViolationsContainer(request, null);
            violationsContainer.setException(e);
            throw new ResteasyViolationException(violationsContainer);
         }
         if (rcvs.size() > 0)
         {
            ViolationsContainer<Object> violationsContainer = getViolationsContainer(request, null);
            violationsContainer.addViolations(rcvs);
            throw new ResteasyViolationException(violationsContainer);
         }
      }
     
      Throwable t = e.getCause();
      while (t != null && !(t instanceof ResteasyViolationException))
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

         response = request1.get();
         log.info("status: " + response.getStatus());
         String answer = response.getEntity(String.class);
         log.info("entity: " + answer);
         assertEquals(400, response.getStatus());
         ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
         System.out.println(e.toString());
         countViolations(e, 4, 1, 1, 1, 1, 0);
         ResteasyConstraintViolation cv = e.getFieldViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 3"));
         cv = e.getPropertyViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 5"));
         cv = e.getClassViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().indexOf("org.jboss.resteasy.resteasy1058.SumConstraint") > 0);
         cv = e.getParameterViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
         response.close();
        
         response = request2.get();
         log.info("status: " + response.getStatus());
         answer = response.getEntity(String.class);
         log.info("entity: " + answer);
         assertEquals(400, response.getStatus());
         e = new ResteasyViolationException(String.class.cast(answer));
         System.out.println(e.toString());
         countViolations(e, 4, 1, 1, 1, 1, 0);
         cv = e.getFieldViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 3"));
         cv = e.getPropertyViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 5"));
         cv = e.getClassViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().indexOf("org.jboss.resteasy.resteasy1058.SumConstraint") > 0);
         cv = e.getParameterViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
         response.close();
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

         response = request1.get();  
         String answer = response.getEntity(String.class);
         log.info("status: " + response.getStatus());
         log.info("entity: " + answer);
         assertEquals(500, response.getStatus());
         ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
         System.out.println(e.toString());
         countViolations(e, 1, 0, 0, 0, 0, 1);
         ResteasyConstraintViolation cv = e.getReturnValueViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be less than or equal to 0"));
         response.close();
        
         response = request2.get();  
         answer = response.getEntity(String.class);
         log.info("status: " + response.getStatus());
         log.info("entity: " + answer);
         assertEquals(500, response.getStatus());
         e = new ResteasyViolationException(String.class.cast(answer));
         System.out.println(e.toString());
         countViolations(e, 1, 0, 0, 0, 0, 1);
         cv = e.getReturnValueViolations().iterator().next();
         Assert.assertTrue(cv.getMessage().equals("must be less than or equal to 0"));
         response.close();
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

      Object target = violationsContainer.getTarget();
      if (target != null && !isWeldProxy(target.getClass()))
      {
         if (violationsContainer != null && violationsContainer.size() > 0)
         {
            throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
         }
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException

     
      @SuppressWarnings("unchecked")
      ViolationsContainer<Object> violationsContainer = ViolationsContainer.class.cast(request.getAttribute(ViolationsContainer.class.getName()));
      if (violationsContainer != null && violationsContainer.size() > 0)
      {
         throw new ResteasyViolationException(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.