From the course: Cloud Native Projects: GCP Serverless

Unlock this course with a free trial

Join today to access over 25,400 courses taught by industry experts.

Solution: Java

Solution: Java

(upbeat music) - [Instructor] So now it's time for my solution to this challenge. I created a new Java project using all of the details from the PaLM that we had used before. Nothing changed there whatsoever from what we had done in the example, except for, of course, the name of the class. Now, I did create a response class that I would use in order to send my results out. It has three private values, and then getters and setters on those. I also created two utility methods in this class to increment heads or increment tails, respective of which one comes in. So now let's take a look at the code itself. Again, on line 14, I created a logger and then an instance of JSON, something we've seen before. I then override the method. And I start putting in some error handling. I think that it's very important, as we saw in our last example, to have good error handling whenever you're writing these functions. So if the…

Contents