-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClearDownloadSessionServlet.java
More file actions
29 lines (23 loc) · 1.06 KB
/
Copy pathClearDownloadSessionServlet.java
File metadata and controls
29 lines (23 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.securefileshare.servlets;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
public class ClearDownloadSessionServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session != null) {
session.removeAttribute("downloadedHash");
session.removeAttribute("expectedHash");
session.removeAttribute("encryptedHash");
session.removeAttribute("fileName");
session.removeAttribute("fileSize");
System.out.println("Cleared download session data for session: " + session.getId());
}
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("application/json");
response.getWriter().write("{\"success\":true}");
}
}