Cloud_Computing_Practical4
Cloud_Computing_Practical4
Develop application to consume Google’s search / Google’s Map RESTful Web service.
To create a simple application that searches for a place using the Google Places API and
retrieves the details from the Google Maps Geocoding API. Steps are as follows:
● Gmail: Before Starting this Practical, your personal Gmail account must be logged in
the web browser.
● Google Cloud SDK: For managing Google APIs. Free Trial and Free Tier Services
and Products | Google Cloud
Downloads Required:
● JDK: Java Downloads | Oracle India (x64 MSI Installer)
● Apache Tomcat: Apache Tomcat Downloads. (x64 bit Windows zip)
After Downloading JDK, Set the Path in Environment Variables in User Variables > Path >
New and Provide the Variable name and values to set the Path for JDK as shown below:
Demonstration:
Now check the versions that shows path is set for Java JDK
Step 1: Download and Extract apache-tomcat-9.0.98 zip file into folder, and open apache-
tomcat-9.0.98 folder till bin and select the directory path, cut (press backspace) and type
cmd.
Demonstration:
Directory Path (Your directory path depends where you place your apache-tomcat
folder)
Select directory path
Type cmd and command prompt will open to the same directory path
Note:
This Tomcat Server must be kept running in the background by minimizing this
window. Otherwise, the we won’t get the output.
Step 2: After completing Step 1, Now open apache-tomcat-9.0.98 folder, open a folder name
webapps which is already created in apache-tomcat-9.0.98 folder
Open webapps folder, create a new folder and name it as: myjsp
Step 3: Open myjsp folder and open it with VS Code
Click on Console
● First, you need to obtain an API key from Google Cloud Console to use the Google
Maps JavaScript API. Follow these steps:
o Go to Google Cloud Console.
o Create a new project (or select an existing one).
o Enable the Maps JavaScript API. (Instead of Places API and Geocoding
API)
o Under Credentials, create an API Key and copy it.
Demonstration: Here we have existing projects, now click on NEW PROJECT
Project Name: GoogleMapsAPI and click CREATE
Now we can see our new project GoogleMapsAPI and Notifications of new project
We got the API Key Created, Copy the API Key and paste it in myindex.jsp file.
Now, open myjsp folder and open with VS Code and paste the API_KEY in myindex.jsp
script tag:
Shown below:
Before:<!-- Google Maps JavaScript API -->
<script src="https://maps.googleapis.com/maps/api/js?
key=YOUR_API_KEY&callback=initMap" async defer></script>
After: :<!-- Google Maps JavaScript API --><script
src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyAiofE1T6K975oNisc37nvURK7c87XR7e4 &callback=initMap" async
defer></script>
Step 5: Now to check the output, open a web browser Google Chrome or Microsoft Edge
Ctrl + Click to follow the Link, URL: http://localhost:8080/myjsp/myinput.jsp
Demonstration:
-----------------