List of usage examples for org.apache.wicket.util.encoding UrlEncoder PATH_INSTANCE
UrlEncoder PATH_INSTANCE
To view the source code for org.apache.wicket.util.encoding UrlEncoder PATH_INSTANCE.
Click Source Link
From source file:com.gitblit.wicket.pages.ImageDiffHandler.java
License:Apache License
/** * Encode a URL component of a {@link RawServlet} URL in the special way that the servlet expects it. Note that * the %-encoding used does not encode '&' or '<'. Slashes are not encoded in the result. * * @param component/*from ww w. j a va2s. co m*/ * to encode using %-encoding * @return the encoded component */ protected String urlencode(final String component) { // RawServlet handles slashes itself. Note that only the PATH_INSTANCE fits the bill here: it encodes // spaces as %20, and we just have to correct for encoded slashes. Java's standard URLEncoder would // encode spaces as '+', and I don't know what effects that would have on other parts of GitBlit. It // would also be wrong for path components (but fine for a query part), so we'd have to correct it, too. // // Actually, this should be done in RawServlet.asLink(). As it is now, this may be incorrect if that // operation ever uses query parameters instead of paths, or if it is fixed to urlencode its path // components. But I don't want to touch that static method in RawServlet. return UrlEncoder.PATH_INSTANCE.encode(component, Constants.ENCODING).replaceAll("%2[fF]", "/"); }
From source file:org.hippoecm.frontend.plugins.richtext.RichTextUtil.java
License:Apache License
public static final String encode(String path) { String[] elements = StringUtils.split(path, '/'); for (int i = 0; i < elements.length; i++) { elements[i] = UrlEncoder.PATH_INSTANCE.encode(elements[i], "UTF-8"); }/*from www . j a v a2 s. co m*/ return StringUtils.join(elements, '/'); }