@Test void getCurrentUri() { String uri = "/menu/test"; String queryString = "a=b&c=d"; MockHttpServletRequest request = new MockHttpServletRequest(); request.setAttribute("javax.servlet.forward.request_uri", uri); request.setQueryString(queryString); RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); String currentUri = MolgenisUiUtils.getCurrentUri(); assertNotNull(currentUri); assertEquals(uri + "?" + queryString, currentUri); request.setQueryString(null); RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); currentUri = MolgenisUiUtils.getCurrentUri(); assertNotNull(currentUri); assertEquals(uri, currentUri); }
public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBlank(request.getQueryString())) { uri.append("?").append(request.getQueryString()); } return uri.toString(); }
MolgenisUiUtils { public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBlank(request.getQueryString())) { uri.append("?").append(request.getQueryString()); } return uri.toString(); } }
MolgenisUiUtils { public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBlank(request.getQueryString())) { uri.append("?").append(request.getQueryString()); } return uri.toString(); } private  MolgenisUiUtils(); }
MolgenisUiUtils { public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBlank(request.getQueryString())) { uri.append("?").append(request.getQueryString()); } return uri.toString(); } private  MolgenisUiUtils(); static String getCurrentUri(); }
MolgenisUiUtils { public static String getCurrentUri() { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); StringBuilder uri = new StringBuilder(); uri.append(request.getAttribute("javax.servlet.forward.request_uri")); if (StringUtils.isNotBlank(request.getQueryString())) { uri.append("?").append(request.getQueryString()); } return uri.toString(); } private  MolgenisUiUtils(); static String getCurrentUri();  }