Chapter 4. Using predicates to send different responses

 

This chapter covers

  • Using predicates to send different responses for different requests
  • Simplifying predicates on JSON request bodies
  • Using XPath to simplify predicates on XML request bodies

During his younger years, Frank William Abagnale Jr. forged a pilot’s license and traveled the world by deadheading.[1] Despite not being able to fly, his successful impersonation of a pilot meant that his food and lodging were fully paid for by the airline. When that well dried up, he impersonated a physician in New Orleans for nearly a year without any medical background, supervising resident interns. When he didn’t know how to respond after a nurse said a baby had “gone blue,” he realized the life and death implications of that false identity and decided to make yet another change. After forging a law transcript from Harvard University, he kept taking the Louisiana bar exam until he passed it, then he posed as an attorney with the attorney general’s office. His story was memorialized in the 2002 movie, Catch Me If You Can.

1The term refers to a pilot riding as a passenger on a flight to get to work. For example, a pilot who took up an assignment to fly from New York to London would need to first ride as a passenger to New York if he lived in Denver.

Frank Abagnale was one of the most successful imposters of all time.

4.1. The basics of predicates

4.2. Parameterizing predicates

4.3. Using predicates on JSON values

4.4. Selecting XML values

Summary