@Test public void testGetRelativeUri__queryParam() throws Exception { final String result = LinkUtils.getRelativeUri(BASE_URL + "/contests?test=1&test2=2"); assertEquals("Query params not handled correctly", "/contests?test=1&test2=2", result); }
public static String getRelativeUri(String uri) { if (uri == null) { return null; } final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(uri); uriBuilder.scheme(null); uriBuilder.host(null); uriBuilder.port(-1); final String newUri = uriBuilder.toUriString(); return StringUtils.isEmpty(newUri) ? "/" : newUri; }
LinkUtils { public static String getRelativeUri(String uri) { if (uri == null) { return null; } final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(uri); uriBuilder.scheme(null); uriBuilder.host(null); uriBuilder.port(-1); final String newUri = uriBuilder.toUriString(); return StringUtils.isEmpty(newUri) ? "/" : newUri; } }
LinkUtils { public static String getRelativeUri(String uri) { if (uri == null) { return null; } final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(uri); uriBuilder.scheme(null); uriBuilder.host(null); uriBuilder.port(-1); final String newUri = uriBuilder.toUriString(); return StringUtils.isEmpty(newUri) ? "/" : newUri; } private  LinkUtils(); }
LinkUtils { public static String getRelativeUri(String uri) { if (uri == null) { return null; } final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(uri); uriBuilder.scheme(null); uriBuilder.host(null); uriBuilder.port(-1); final String newUri = uriBuilder.toUriString(); return StringUtils.isEmpty(newUri) ? "/" : newUri; } private  LinkUtils(); static String getBaseUri(HttpServletRequest request); static String getNonBlankStringOrDefault(String string, String defaultString); static String getAbsoluteUrl(String relativeUri); static String getRelativeUri(String uri); static String getLocalUrl(String url); static String getLocalUrl(String url, String defaultRedirect); static boolean isLocalUrl(String url); static boolean isRelativeUrl(String url); static boolean isLoginPageLink(String url); static String getSafeRedirectUri(String uri); static String getSafeRedirectUri(String uri, String defaultUri); }
LinkUtils { public static String getRelativeUri(String uri) { if (uri == null) { return null; } final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(uri); uriBuilder.scheme(null); uriBuilder.host(null); uriBuilder.port(-1); final String newUri = uriBuilder.toUriString(); return StringUtils.isEmpty(newUri) ? "/" : newUri; } private  LinkUtils(); static String getBaseUri(HttpServletRequest request); static String getNonBlankStringOrDefault(String string, String defaultString); static String getAbsoluteUrl(String relativeUri); static String getRelativeUri(String uri); static String getLocalUrl(String url); static String getLocalUrl(String url, String defaultRedirect); static boolean isLocalUrl(String url); static boolean isRelativeUrl(String url); static boolean isLoginPageLink(String url); static String getSafeRedirectUri(String uri); static String getSafeRedirectUri(String uri, String defaultUri); static final String COLAB_URL; }