Issue #4329 - Cleaning up SessionDump

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-11-27 05:51:39 -06:00
parent 09641c9581
commit 15c9f0bfc2
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 7 additions and 10 deletions

View File

@ -41,7 +41,7 @@ public class SessionDump extends HttpServlet
/** /**
* Simple object attribute to test serialization * Simple object attribute to test serialization
*/ */
public class ObjectAttributeValue implements java.io.Serializable public static class ObjectAttributeValue implements java.io.Serializable
{ {
long l; long l;
@ -58,8 +58,6 @@ public class SessionDump extends HttpServlet
int redirectCount = 0; int redirectCount = 0;
String pageType;
@Override @Override
public void init(ServletConfig config) public void init(ServletConfig config)
throws ServletException throws ServletException
@ -67,8 +65,7 @@ public class SessionDump extends HttpServlet
super.init(config); super.init(config);
} }
protected void handleForm(HttpServletRequest request, protected void handleForm(HttpServletRequest request)
HttpServletResponse response)
{ {
HttpSession session = request.getSession(false); HttpSession session = request.getSession(false);
String action = request.getParameter("Action"); String action = request.getParameter("Action");
@ -99,9 +96,9 @@ public class SessionDump extends HttpServlet
@Override @Override
public void doPost(HttpServletRequest request, public void doPost(HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException throws IOException
{ {
handleForm(request, response); handleForm(request);
String nextUrl = getURI(request) + "?R=" + redirectCount++; String nextUrl = getURI(request) + "?R=" + redirectCount++;
String encodedUrl = response.encodeRedirectURL(nextUrl); String encodedUrl = response.encodeRedirectURL(nextUrl);
response.sendRedirect(encodedUrl); response.sendRedirect(encodedUrl);
@ -110,9 +107,9 @@ public class SessionDump extends HttpServlet
@Override @Override
public void doGet(HttpServletRequest request, public void doGet(HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws ServletException, IOException throws IOException
{ {
handleForm(request, response); handleForm(request);
response.setContentType("text/html"); response.setContentType("text/html");
@ -124,7 +121,7 @@ public class SessionDump extends HttpServlet
} }
catch (IllegalStateException e) catch (IllegalStateException e)
{ {
e.printStackTrace(System.err); log("Session already invalidated", e);
session = null; session = null;
} }