This document discusses request validation for Spring REST controllers. It explains that request validation is important to ensure client requests are well-formed. It demonstrates how to enable validation on request beans using the @Valid annotation and implement both simple and complex validation rules. Simple validations use annotations like @NotNull while complex validations require a custom validator class. The validator is registered globally so it can validate requests for all controllers. Exceptions are handled by a global exception handler to return standardized error responses.
25+ Reasons to use OmniFaces in JSF applicationsAnghel Leonard
OmniFaces is an utility library that can help you to improve your JSF development experience. This presentation reveals 25+ real cases in which OmniFaces can make JSF life easier.
What's even better than mocking? API Virtualization. This presentation will show you how.
With API Virtualization, quickly and easily create mocks to validate the APIs you depend on, then pump them up with some serious juice for more powerful application testing. In your own API sandbox, simulate API failure conditions to make sure your application can gracefully handle error responses.
Mastering OmniFaces - A Problem to Solution ApproachAnghel Leonard
OmniFaces is a utility library for JSF and a comprehensive compendium of programming techniques, design patterns and recipes for JSF developers. Mastering OmniFaces is targeted towards JSF page authors/developers that wish to use OmniFaces in their projects and JSF developers interested in going deep into the JSF API ʺbowelsʺ in order to become real JSF masters.
This presentation is a brief overview of the JSF custom validators provided by OmniFaces (e.g. cross-field validators). Some OmniFaces validators fixes a suite of gaps of the JSF standard validators, while others are totally new.
Selenium is a software testing framework for automating tests of Web applications. Join Frank Cohen for a Workshop to learn the basics of Selenium. A screencast for this presentation is on the PushToTest.com Web site.
25+ Reasons to use OmniFaces in JSF applicationsAnghel Leonard
OmniFaces is an utility library that can help you to improve your JSF development experience. This presentation reveals 25+ real cases in which OmniFaces can make JSF life easier.
What's even better than mocking? API Virtualization. This presentation will show you how.
With API Virtualization, quickly and easily create mocks to validate the APIs you depend on, then pump them up with some serious juice for more powerful application testing. In your own API sandbox, simulate API failure conditions to make sure your application can gracefully handle error responses.
Mastering OmniFaces - A Problem to Solution ApproachAnghel Leonard
OmniFaces is a utility library for JSF and a comprehensive compendium of programming techniques, design patterns and recipes for JSF developers. Mastering OmniFaces is targeted towards JSF page authors/developers that wish to use OmniFaces in their projects and JSF developers interested in going deep into the JSF API ʺbowelsʺ in order to become real JSF masters.
This presentation is a brief overview of the JSF custom validators provided by OmniFaces (e.g. cross-field validators). Some OmniFaces validators fixes a suite of gaps of the JSF standard validators, while others are totally new.
Selenium is a software testing framework for automating tests of Web applications. Join Frank Cohen for a Workshop to learn the basics of Selenium. A screencast for this presentation is on the PushToTest.com Web site.
These are training slides created by me to conduct training and knowledge sharing sessions for beginners in Cognizant Technology Solutions for Selenium Automation.
1/3 : introduction to CDI - Antoine Sabot-DurandSOAT
Allez plus Loin avec CDI
En moins de 5 ans d’existence, Contexts and Dependency Injection (CDI) est devenue l’une des principale spécification de Java EE. Néanmoins, CDI est bien souvent perçu comme une simple solution d’injection de dépendance enrichie alors que cette spécification est bien plus riche que ça. Lors de cette présentation, après un rapide rappel des fonctionnalités de base de CDI, nous montrerons comment son utilisation avancée permet Java EE en intégrant des technologies legacy ou plus récent de manière naturelle. Nous finirons avec le travail en cours sur CDI 2.0 qui a commencé début septembre.
Allez plus Loin avec CDI
En moins de 5 ans d’existence, Contexts and Dependency Injection (CDI) est devenue l’une des principale spécification de Java EE. Néanmoins, CDI est bien souvent perçu comme une simple solution d’injection de dépendance enrichie alors que cette spécification est bien plus riche que ça. Lors de cette présentation, après un rapide rappel des fonctionnalités de base de CDI, nous montrerons comment son utilisation avancée permet Java EE en intégrant des technologies legacy ou plus récent de manière naturelle. Nous finirons avec le travail en cours sur CDI 2.0 qui a commencé début septembre.
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
The presentation on Upgrading a mobile tester's weapons with advanced debugging was done during #ATAGTR2017, one of the largest global testing conference. All copyright belongs to the author.
Author and presenter : Abhijeet Vaikar
Some of the most often asked selenium interview questions and answers. These questions are coding based.
These questions are sample questions, which are going to be part of soon to be published "Selenium Interview Questions and Answers" book on Amazon.
Techcanvass is an IT certifications training organization and conducts Selenium training programs as listed below:
Java Selenium 3.0 Training
--------------------------------------
http://techcanvass.com/Courses/selenium-training-course.aspx
Python Selenium 3.0 Training
---------------------------------------------
http://techcanvass.com/Courses/selenium-training-with-python.aspx
Techcanvass is a software development and training organization. We provide IT certifications training for mid-level professionals.
We specialize in the following areas:
a) Selenium v3.0 training with Java and Python
b) IIBA Business Analysis certifications (all levels)
c) Certified Agile Business Analyst Training
d) Data Science Training ( R, Python and Big Data) and Tableau
Website: http://techcanvass.com
Facebook Page: https://www.facebbook.com/Techcanvass
Twitter Handle: @techcanvass
A complete boot camp for beginners who want to learn Spring Boot.
In this course, you'll learn how we can create web services and cover all the topics of Spring Boot, Spring Framework, and many others.
If you've some experience in Java and want to be a Software Engineer or Java Developer using Spring, you're on right way.
Just read and practice, in the end of this course you'll have a great knowledge of Spring boot, a backend knowledge.
Course outline:
JPA, Hibernate, Spring, Spring Framework, H2 Database, PostgreSQL, MySQL.
#SpringBoot
#SpringFramwork
#MySQL
#PostgreSQL
#MySQL
#H2
#JPA/Hibernate
#Webservices
These are training slides created by me to conduct training and knowledge sharing sessions for beginners in Cognizant Technology Solutions for Selenium Automation.
1/3 : introduction to CDI - Antoine Sabot-DurandSOAT
Allez plus Loin avec CDI
En moins de 5 ans d’existence, Contexts and Dependency Injection (CDI) est devenue l’une des principale spécification de Java EE. Néanmoins, CDI est bien souvent perçu comme une simple solution d’injection de dépendance enrichie alors que cette spécification est bien plus riche que ça. Lors de cette présentation, après un rapide rappel des fonctionnalités de base de CDI, nous montrerons comment son utilisation avancée permet Java EE en intégrant des technologies legacy ou plus récent de manière naturelle. Nous finirons avec le travail en cours sur CDI 2.0 qui a commencé début septembre.
Allez plus Loin avec CDI
En moins de 5 ans d’existence, Contexts and Dependency Injection (CDI) est devenue l’une des principale spécification de Java EE. Néanmoins, CDI est bien souvent perçu comme une simple solution d’injection de dépendance enrichie alors que cette spécification est bien plus riche que ça. Lors de cette présentation, après un rapide rappel des fonctionnalités de base de CDI, nous montrerons comment son utilisation avancée permet Java EE en intégrant des technologies legacy ou plus récent de manière naturelle. Nous finirons avec le travail en cours sur CDI 2.0 qui a commencé début septembre.
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
The presentation on Upgrading a mobile tester's weapons with advanced debugging was done during #ATAGTR2017, one of the largest global testing conference. All copyright belongs to the author.
Author and presenter : Abhijeet Vaikar
Some of the most often asked selenium interview questions and answers. These questions are coding based.
These questions are sample questions, which are going to be part of soon to be published "Selenium Interview Questions and Answers" book on Amazon.
Techcanvass is an IT certifications training organization and conducts Selenium training programs as listed below:
Java Selenium 3.0 Training
--------------------------------------
http://techcanvass.com/Courses/selenium-training-course.aspx
Python Selenium 3.0 Training
---------------------------------------------
http://techcanvass.com/Courses/selenium-training-with-python.aspx
Techcanvass is a software development and training organization. We provide IT certifications training for mid-level professionals.
We specialize in the following areas:
a) Selenium v3.0 training with Java and Python
b) IIBA Business Analysis certifications (all levels)
c) Certified Agile Business Analyst Training
d) Data Science Training ( R, Python and Big Data) and Tableau
Website: http://techcanvass.com
Facebook Page: https://www.facebbook.com/Techcanvass
Twitter Handle: @techcanvass
A complete boot camp for beginners who want to learn Spring Boot.
In this course, you'll learn how we can create web services and cover all the topics of Spring Boot, Spring Framework, and many others.
If you've some experience in Java and want to be a Software Engineer or Java Developer using Spring, you're on right way.
Just read and practice, in the end of this course you'll have a great knowledge of Spring boot, a backend knowledge.
Course outline:
JPA, Hibernate, Spring, Spring Framework, H2 Database, PostgreSQL, MySQL.
#SpringBoot
#SpringFramwork
#MySQL
#PostgreSQL
#MySQL
#H2
#JPA/Hibernate
#Webservices
With third party clients connecting to your service you may find that the assumptions or opinions of a typical rails application are not robust enough. We'll run through some key considerations when building an API that will be consumed by a mobile app.
Itb 2021 - Bulding Quick APIs by Gavin PickinGavin Pickin
In this session we will use ColdBox’s built in REST BaseHandler, and with CBSecurity and Quick ORM we will setup a secure API using fluent query language - and you’ll see how Quick Quick development can be!
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
2. Background
Spring REST is not a standardized JAX-RS implementation and there doesn’t seem
an attempt to move to that direction either
RESTeasy, Restlet, Jersey and ApacheCXF implement JAX-RS to different extents but
not Spring REST because of its background in Spring MVC
Spring REST is a tweaked version of Spring MVC
This presentation is about request bean validation at a @RestController
3. Why we need it?
For a REST End Point – Its not guaranteed that client will always send a well formed
request
Request Bean could be malformed in various ways like being empty string, null value
or not passable value to a particular type
REST Entry Point need not to proceed if request is invalid and data sent is improper
If request is invalid, REST Entry Point need to return an error response automatically
and service developers need not be tweaking service logic for data invalidity
Validation needs to be segregated system component for maintainable flow and
readable code
4. What is Bean Validation?
Bean validation is about validating a POJO’s fields for particular values
Details about bean validation can be found at - http://beanvalidation.org/
Its basically about specifying constraints on POJO fields
At home page, its written – “Constrain once, validate everywhere”
This validation might be needed in JavaSE or JavaEE
Above link is simply a specification, its implementation needs to be provided and
specification is JSR-303, later improved to JSR-349
One such implementation is provided by Apache, another by Hibernate and so on so
forth
http://bval.apache.org/ & http://hibernate.org/validator/
5. Getting Started : Coding…Dependency
First you need to include validation API implementations in your REST application. I have
not specified versions so it will get latest versions.
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
6. Coding…Enable Validation at Entry Point
After including dependencies in application, you need to enable validation for your request bean at your entry point
This can be achieved either by @Valid or @Validated annotation as shown below,
@RestController
@RequestMapping("/baseURL")
public class MyController {
@Autowired private Service service;
@RequestMapping(method = RequestMethod.POST, value = "/entryURL" , consumes=MediaType.APPLICATION_JSON_VALUE, produces
=MediaType.APPLICATION_JSON_VALUE )
public ResponseBean<...> getResponse( @Valid @RequestBody RequestBean request) {
/* Control comes here only if request satisfies all of your validations since @Valid is palced there */
/* service is a service instance that you would use to build a successful response */
}
}
@Valid is - import javax.validation.Valid;
7. Coding…Simple Validations
After previous step, bean validation is enabled for POJO – RequestBean if a hit is made to that entry
point
Now, you can go to RequestBean class and apply simple validations from either of the two dependencies
included in the project
Most commonly used annotations are - @NotEmpty, @NotNull, @Email
In these annotations ,you can specify custom messages for validator failures
You can find many such annotations in - org.hibernate.validator.constraints package ( for hibernate jar ) &
javax.validation.constraints package ( for javax jar )
Since you have applied , @Valid to @RequestBody at entry point, now your bean will automatically be
validated against these rules/annotations
Control will go inside of entry point method if validation passes
If validation fails, an exception be thrown–
org.springframework.web.bind.MethodArgumentNotValidException or
8. Coding…Exception Handler
Since, you have enabled validation so exception – MethodArgumentNotValidException might be thrown for invalid requests
System might have multiple services / End Points and developer shouldn’t be required to construct a response for each of these failure in
every service so you can have a Spring’s global application handler like below – Its just a sample , you can send a response as per your
need
@ControllerAdvice(value=“*.controller") -> this is basically controller package location
@Component
public class ApplicationExceptionHandler {
@ExceptionHandler
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseBean handle(MethodArgumentNotValidException exception){
StringBuilder messages = new StringBuilder();
ResponseBean response = new ResponseBean();
int count = 1;
for(ObjectError error:exception.getBindingResult().getAllErrors()){
messages.append(" "+count+"."+error.getDefaultMessage());
++count;
}
response.setResponse(“FAILURE”);
response.setErrorcode(400);
response.setMessage(messages.toString());
9. Coding…Complex Validations
Sometimes, a simple validation rule or rules for each of the bean fields might not be enough i.e.
validation for each of the fields might not be independent from each other. Like – if you need any of the
25 fields to be @NotNull etc.
For such situations, Spring gives you an option to write your own validator by implementing interface-
org.springframework.validation.Validator
public class MyValidator implements Validator {
@Override
public boolean supports(Class<?> clazz) {
return RequestBean.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {}
/* Write all your custom validations here */
/* For all validations, do specify messages to be passed on to user in errors
object*/
}
10. Coding…Complex Validations…Contd
Abstract class - org.springframework.validation.ValidationUtils can be used to write validations like ,
ValidationUtils.rejectIfEmptyOrWhitespace(errors, “FIELD-1", "field.required"," FIELD-1 field is missing in
request body");
etc
You can write complex validations using Java Reflection or By Using getters on RequestBean
Java Reflection is flexible and you will not be required to change validator for bean field addition and
removal
In validator, you might choose to log error messages on server side if errors.hasErrors() is true
11. Coding…Complex Validations…Contd
Plugin Your validator to System : You have defined a custom validator but Spring doesn’t know about it
You can write a global application initializer like below to tell framework about it i.e. register it ,
@ControllerAdvice(value=“*.controller") -> This is controller package
@Component
public class GlobalApplicationInitializer {
@InitBinder
public void globalInitBinder(WebDataBinder binder) {
binder.addValidators(new MyValidator());
}
}
Alternatively, you can define a validator @Bean in @Configuration and can use @Autowired instance in
addValidators method
Now your simple as well as custom validation both can be used on same bean.
12. @Valid Vs @Validated
There is another annotation @Validated provided by Spring -
org.springframework.validation.annotation.Validated that can be used other than -
javax.validation.Valid
@Validated supports validation groups and that is useful in multi step validations usually not useful for a
REST End Point but for a Web Form
So @Valid is standardized JEE annotation while @Validated is not.