sf.setResourceProvider(BookStoreWithValidation.class,
new SingletonResourceProvider(new BookStoreWithValidation()));
sf.setProvider(new ValidationExceptionMapper());
sf.setAddress("http://localhost:" + PORT + "/");
BeanValidationInInterceptor in = new JAXRSBeanValidationInInterceptor();
in.setProvider(new BeanValidationProvider(new JAXRSParameterNameProvider()));
sf.setInInterceptors(Arrays.< Interceptor< ? extends Message > >asList(
in));
sf.setOutInterceptors(Arrays.< Interceptor< ? extends Message > >asList(
new JAXRSBeanValidationOutInterceptor()));