package com.google.sps.servlets;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import com.google.sps.tool.GoogleTranslationAPI;
import java.util.Map;
import java.util.HashMap;
import com.google.gson.Gson;


@WebServlet("/translation")
public class TranslationServlet extends HttpServlet {
  
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    UserService userService = UserServiceFactory.getUserService();

    if (userService.isUserLoggedIn()) {
      String rawText = request.getParameter("rawText");
      String toLang = request.getParameter("toLang");
      String fromLang = request.getParameter("fromLang");

      String textTranslated = GoogleTranslationAPI.translateText(rawText, toLang);

      // Aggregate information as a json 
      Map<String, String> jsonInfo = new HashMap<>();
      jsonInfo.put("translation", textTranslated);
      response.setContentType("application/json;");
      response.getWriter().println(new Gson().toJson(jsonInfo));
    }
  }
}
@@ -383,22 +383,17 @@
 Translat
-ionAPI
+e
 ;%0Aimport
@@ -986,14 +986,9 @@
 slat
-ionAPI
+e
 .tra
@@ -1021,50 +1021,8 @@
 );%0A%0A
-      // Aggregate information as a json %0A
     

Fix vertical space