code: private void getUploadUrl(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
      LOGGER.debug("Get blobstore upload url");
  
      String callback = req.getParameter(CALLBACK_PARAM);
      if (null == callback) {
        callback = req.getRequestURI();
      }
  
      String keepQueryParam = req.getParameter(KEEP_QUERY_PARAM);
      // Forward any existing query parameters, e.g. access_token
      if (null != keepQueryParam) {
        final String queryString = req.getQueryString();
        callback = String.format("%s?%s", callback, null != queryString ? queryString : "");
      }
  
      Map<String, String> response = ImmutableMap.of("uploadUrl", blobstoreService.createUploadUrl(callback));
  
      PrintWriter out = resp.getWriter();
      resp.setContentType(JsonCharacterEncodingResponseFilter.APPLICATION_JSON_UTF8);
  
      ObjectMapper mapper = new ObjectMapper();
      mapper.writeValue(out, response);
  
      out.close();
    }
docs: Get an upload URL
  @param req
  @param resp
  @throws ServletException
  @throws IOException