package com.netflox.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.netflox.model.DownloadHelper;
import com.netflox.model.FilmsManager;
import com.netflox.pdf.pdfCreator;
public class TelechargementController extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 3628839781153159886L;
private static final String IN_PATH = "/res/data";
private static final String OUT_PATH = "";
private String MOVIES_PDF = "movies_output.pdf";
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String inPath = this.getServletContext().getRealPath(IN_PATH);
String titre = request.getParameter("titre");
pdfCreator pdfc = new pdfCreator();
String outPath = this.getServletContext().getRealPath(OUT_PATH);
pdfc.createMoviePdfSummary(inPath, outPath, titre);
DownloadHelper dh = new DownloadHelper();
dh.downloadLink(request, response, outPath, MOVIES_PDF);
}
}