@Test public void testSave() { String srid = SavedRequestManager.saveRequest(this.request); Assert.assertNotNull(srid); Assert.assertFalse("".equals(srid)); }
@SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, SavedRequest> savedRequests = (Map<String, SavedRequest>) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { savedRequests = new HashMap<String, SavedRequest>(); session.setAttribute(getSavedRequestKey(), savedRequests); } SavedRequest savedRequest = new SavedRequest(request); String key; do { key = RandomStringUtils.randomAlphanumeric(8); } while (savedRequests.containsKey(key)); savedRequests.put(key, savedRequest); return key; }
SavedRequestManager { @SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, SavedRequest> savedRequests = (Map<String, SavedRequest>) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { savedRequests = new HashMap<String, SavedRequest>(); session.setAttribute(getSavedRequestKey(), savedRequests); } SavedRequest savedRequest = new SavedRequest(request); String key; do { key = RandomStringUtils.randomAlphanumeric(8); } while (savedRequests.containsKey(key)); savedRequests.put(key, savedRequest); return key; } }
SavedRequestManager { @SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, SavedRequest> savedRequests = (Map<String, SavedRequest>) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { savedRequests = new HashMap<String, SavedRequest>(); session.setAttribute(getSavedRequestKey(), savedRequests); } SavedRequest savedRequest = new SavedRequest(request); String key; do { key = RandomStringUtils.randomAlphanumeric(8); } while (savedRequests.containsKey(key)); savedRequests.put(key, savedRequest); return key; } private  SavedRequestManager(); }
SavedRequestManager { @SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, SavedRequest> savedRequests = (Map<String, SavedRequest>) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { savedRequests = new HashMap<String, SavedRequest>(); session.setAttribute(getSavedRequestKey(), savedRequests); } SavedRequest savedRequest = new SavedRequest(request); String key; do { key = RandomStringUtils.randomAlphanumeric(8); } while (savedRequests.containsKey(key)); savedRequests.put(key, savedRequest); return key; } private  SavedRequestManager(); static String getSavedRequestIdentifier(); static String getSavedRequestKey(); @SuppressWarnings("unchecked") static String saveRequest(HttpServletRequest request); @SuppressWarnings("unchecked") static String getOriginalUrl(HttpServletRequest request); }
SavedRequestManager { @SuppressWarnings("unchecked") public static String saveRequest(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, SavedRequest> savedRequests = (Map<String, SavedRequest>) session.getAttribute(getSavedRequestKey()); if (savedRequests == null) { savedRequests = new HashMap<String, SavedRequest>(); session.setAttribute(getSavedRequestKey(), savedRequests); } SavedRequest savedRequest = new SavedRequest(request); String key; do { key = RandomStringUtils.randomAlphanumeric(8); } while (savedRequests.containsKey(key)); savedRequests.put(key, savedRequest); return key; } private  SavedRequestManager(); static String getSavedRequestIdentifier(); static String getSavedRequestKey(); @SuppressWarnings("unchecked") static String saveRequest(HttpServletRequest request); @SuppressWarnings("unchecked") static String getOriginalUrl(HttpServletRequest request);  }