@@ -0,0 +1,2343 @@
+package com.google.sps.servlets;%0A%0Aimport com.google.firebase.FirebaseApp;%0Aimport com.google.firebase.database.DataSnapshot;%0Aimport com.google.firebase.database.DatabaseError;%0Aimport com.google.firebase.database.DatabaseReference;%0Aimport com.google.firebase.database.FirebaseDatabase;%0Aimport com.google.firebase.database.ValueEventListener;%0Aimport com.google.sps.firebase.FirebaseAppManager;%0Aimport java.io.IOException;%0Aimport java.util.concurrent.CompletableFuture;%0Aimport java.util.concurrent.ExecutionException;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0A@WebServlet(%22/retrieveFile%22)%0Apublic class FileRetriever extends HttpServlet %7B%0A%0A  public FileRetriever() throws IOException %7B%7D%0A%0A  @Override%0A  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException %7B%0A    FirebaseApp app = FirebaseAppManager.getApp();%0A    FirebaseDatabase db = FirebaseDatabase.getInstance(app);%0A    db.goOnline();%0A    String refPath = RequestUtils.getParameter(req, %22path%22, %22%22);%0A%0A    DatabaseReference ref = db.getReference(refPath);%0A%0A    ref.child(%22t%22).setValueAsync(%22t%22);%0A%0A    CompletableFuture%3CString%3E future = new CompletableFuture%3C%3E();%0A    ref.addListenerForSingleValueEvent(%0A        new ValueEventListener() %7B%0A%0A          @Override%0A          public void onDataChange(DataSnapshot snapshot) %7B%0A            ref.removeEventListener(this);%0A%0A            // WorkspaceFile file = new WorkspaceFile(snapshot);%0A            future.complete(Thread.currentThread().getName());%0A%0A            // try %7B%0A            // future.complete(file.getContents().get());%0A            // %7D catch (InterruptedException %7C ExecutionException e) %7B%0A            // future.completeExceptionally(e);%0A            // %7D%0A          %7D%0A%0A          @Override%0A          public void onCancelled(DatabaseError error) %7B%0A            // TODO Auto-generated method stub%0A            future.completeExceptionally(error.toException());%0A          %7D%0A        %7D);%0A%0A    try %7B%0A      resp.getWriter().println(future.get());%0A      resp.getWriter().println(Thread.currentThread().getName());%0A    %7D catch (InterruptedException %7C ExecutionException e) %7B%0A      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getStackTrace().toString());%0A    %7D%0A  %7D%0A%7D%0A

Add FileRetriever servlet for testing.