// before you are allowed to upload GEDCOM files
if(ServletFileUpload.isMultipartContent(request))
{
if("/upload".equals(gedcomFilePath))
{
SSOSubject authenticated = (SSOSubject)request.getAttribute(SSOSubject.SSOSUBJECT_KEY);
if(authenticated == null)
{
throw new ServletException("The request does not have an "+SSOSubject.SSOSUBJECT_KEY+" attribute, this is not allowed!!!");
}
LOG.finest("Uploading GEDCOM file...");
try
{
String filenames = parseRequest(request, authenticated);
// DONE: return the listing to the browser of the directory that contains the
// .ged file that the user just finished uploading
// do a forward here
//RequestDispatcher dispatch = request.getRequestDispatcher("/");
//dispatch.forward(request, response);
String tabIndex = request.getParameter("tabIndex");
LOG.finest("The tabIndex from the request is: "+tabIndex);
if(tabIndex == null)
{
tabIndex = "5";
//throw new ServletException("The tabIndex request parameter is null, this is not allowed!!!");
// TODO: return this error message to the end user in the browser as the json response
}
response.sendRedirect(response.encodeRedirectURL(request.getContextPath()+"/successfulUpload.html?tabIndex="+tabIndex+"&gcsPath=uploads"+URLEncoder.encode(File.separator+authenticated.getScreenName(), "UTF-8")+"&successfulUpload="+URLEncoder.encode(filenames, "UTF-8")));
}
catch(Exception ex)
{
ex.printStackTrace();
}