@@ -0,0 +1,1421 @@
+package com.mooo.aimmac23.hub.servlet;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.apache.commons.exec.StreamPumper;%0Aimport org.apache.http.HttpStatus;%0Aimport org.openqa.grid.internal.ExternalSessionKey;%0A%0Aimport com.mooo.aimmac23.hub.HubVideoRegistry;%0A%0Apublic class HubVideoDownloadServlet extends HttpServlet %7B%0A%09%0A%09private static final long serialVersionUID = 1L;%0A%09%0A%09@Override%0A%09protected void doGet(HttpServletRequest req, HttpServletResponse resp)%0A%09%09%09throws ServletException, IOException %7B%0A%09%09String sessionId = req.getParameter(%22sessionId%22);%0A%09%09%0A%09%09if(sessionId == null) %7B%0A%09%09%09resp.setStatus(HttpStatus.SC_BAD_REQUEST);%0A%09%09%09resp.getWriter().write(%22Missing parameter: 'sessionId'%22);%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09File video = HubVideoRegistry.getVideoForSession(new ExternalSessionKey(sessionId));%0A%09%09%0A%09%09if(video == null %7C%7C !video.exists()) %7B%0A%09%09%09resp.setStatus(HttpStatus.SC_NO_CONTENT);%0A%09%09%09resp.getWriter().write(%22Video content not found for sessionId: %22 + sessionId);%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09FileInputStream fileStream = new FileInputStream(video);%0A%09%09try %7B%0A%09%09%09resp.setContentType(%22video/mp4%22);%0A%09%09%09new StreamPumper(fileStream, resp.getOutputStream()).run();%0A%09%09%09return;%0A%09%09%7D%0A%09%09finally %7B%0A%09%09%09fileStream.close();%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add a servlet with which users can download a video, given a sessionId