@@ -0,0 +1,2453 @@
+package com.google.sps.servlets;%0A %0Aimport com.google.api.gax.longrunning.OperationFuture;%0Aimport com.google.cloud.vision.v1.*;%0A %0Aimport java.io.IOException;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.util.*;%0A %0Aimport com.google.appengine.api.users.UserService;%0Aimport com.google.appengine.api.users.UserServiceFactory;%0Aimport com.google.appengine.api.datastore.DatastoreService;%0Aimport com.google.appengine.api.datastore.DatastoreServiceFactory;%0A %0Aimport com.google.appengine.api.datastore.PreparedQuery;%0Aimport com.google.appengine.api.datastore.Query;%0Aimport com.google.appengine.api.datastore.Query.SortDirection;%0A %0Aimport com.google.appengine.api.datastore.Entity;%0A %0A %0A %0A@WebServlet(%22/product-catalog%22)%0Apublic class ProductCatalogServlet extends HttpServlet %7B%0A %0A  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException %7B%0A    String projectId = request.getParameter(%22project-id%22);%0A    String computeRegion = request.getParameter(%22compute-region%22);%0A    String productSetId = request.getParameter(%22product-set-id%22);%0A    String productSetDisplay = request.getParameter(%22product-set-display%22);%0A %0A    createProductSet(projectId, computeRegion, productSetId, productSetDisplay);%0A    %0A    response.sendRedirect(%22/create-product-set.html%22);%0A  %7D%0A %0A  public static void createProductSet(%0A  String projectId, String computeRegion, String productSetId, String productSetDisplayName)%0A  throws IOException %7B%0A    try (ProductSearchClient client = ProductSearchClient.create()) %7B%0A %0A      // A resource that represents Google Cloud Platform location.%0A      String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion);%0A %0A      // Create a product set with the product set specification in the region.%0A      ProductSet myProductSet =%0A        ProductSet.newBuilder().setDisplayName(productSetDisplayName).build();%0A      CreateProductSetRequest request =%0A        CreateProductSetRequest.newBuilder()%0A            .setParent(formattedParent)%0A            .setProductSet(myProductSet)%0A            .setProductSetId(productSetId)%0A            .build();%0A      ProductSet productSet = client.createProductSet(request);%0A      // Display the product set information%0A      System.out.println(String.format(%22Product set name: %25s%22, productSet.getName()));%0A    %7D%0A  %7D %0A%7D%0A

Add product catalog servlet