@Test public void encodePath() { assertEquals("Invalid encoded result", "/foo/bar", UriUtils.encodePath("/foo/bar", CHARSET)); assertEquals("Invalid encoded result", "/foo%20bar", UriUtils.encodePath("/foo bar", CHARSET)); assertEquals("Invalid encoded result", "/Z%C3%BCrich", UriUtils.encodePath("/Z\u00fcrich", CHARSET)); }
try { uri = StringUtils.replace(uri, template, (value != null ? UriUtils.encodePath(value, encoding) : ""));
String encoding = this.pageContext.getResponse().getCharacterEncoding(); try { requestUri = UriUtils.encodePath(requestUri, encoding);
try { uri = StringUtils.replace(uri, template, (value != null ? UriUtils.encodePath(value, encoding) : ""));
String encoding = this.pageContext.getResponse().getCharacterEncoding(); try { requestUri = UriUtils.encodePath(requestUri, encoding);
usedParams.add(param.getName()); try { uri = uri.replace(template, UriUtils.encodePath(param.getValue(), encoding));
/** * Encodes the given path value. * * @param source must not be {@literal null}. * @return */ public static String encodePath(Object source) { Assert.notNull(source, "Path value must not be null!"); try { return UriUtils.encodePath(source.toString(), ENCODING); } catch (Throwable e) { throw new IllegalStateException(e); } }
public static String encode(String path) { try { path = UriUtils.encodePath(path, ISO_8859_1); } catch (UnsupportedEncodingException e) { log.error("Could not encode:" + path, e); } return path; }
public static String encode(String path) { try { return UriUtils.encodePath(path, ISO_8859_1); } catch (UnsupportedEncodingException e) { log.error("Could not encode:" + path, e); } return path; }
public static String encode(String path) { try { path = UriUtils.encodePath(path, ISO_8859_1); } catch (UnsupportedEncodingException e) { log.error("Could not encode:" + path, e); } return path; }
@SneakyThrows(UnsupportedEncodingException.class) private String _prependFullUrlIfNeeded(String path, String baseUrl) { if (path.contains(baseUrl)) { return path; } return UriUtils.encodePath(baseUrl + path, "UTF-8"); } }
/** * Encodes the given path value. * * @param source must not be {@literal null}. * @return */ public static String encodePath(Object source) { Assert.notNull(source, "Path value must not be null!"); try { return UriUtils.encodePath(source.toString(), ENCODING); } catch (Throwable o_O) { throw new IllegalStateException(o_O); } }
/** * {@inheritDoc} */ @Override @SneakyThrows(UnsupportedEncodingException.class) public Localization getLocalization(String url) throws LocalizationResolverException { LOG.trace("getLocalization: {}", url); // truncating on first % because of TSI-1281 String path = UriUtils.encodePath(url, "UTF-8").split("%")[0]; PublicationMappingData data = getPublicationMappingData(path); if (data == null) { throw new LocalizationResolverException("Publication mapping is not resolved!"); } if (!localizations.containsKey(data.id)) { localizations.put(data.id, createLocalization(data.id, data.path)); } return localizations.get(data.id); }
String escProviderId = UriUtils.encodePath(providerId, "UTF-8"); builder.append(escProviderId); } catch (UnsupportedEncodingException e) { /* Default to UTF-8...should be fine.*/ }
public String buildZuulRequestURI(HttpServletRequest request) { RequestContext context = RequestContext.getCurrentContext(); String uri = request.getRequestURI(); String contextURI = (String) context.get(REQUEST_URI_KEY); if (contextURI != null) { try { uri = contextURI; if (this.urlDecoded) { uri = UriUtils.encodePath(contextURI, characterEncoding(request)); } } catch (Exception e) { log.debug( "unable to encode uri path from context, falling back to uri from request", e); } } return uri; }
sb.append(encodePath(path, encoding));
String encoding = ServletUtils.getResponse().getCharacterEncoding(); try { requestUri = UriUtils.encodePath(requestUri, encoding);
String encoding = this.pageContext.getResponse().getCharacterEncoding(); try { requestUri = UriUtils.encodePath(requestUri, encoding);