Example usage for org.springframework.web.util UriUtils decode

List of usage examples for org.springframework.web.util UriUtils decode

Introduction

In this page you can find the example usage for org.springframework.web.util UriUtils decode.

Prototype

public static String decode(String source, Charset charset) 

Source Link

Document

Decode the given encoded URI component.

Usage

From source file:org.cloudfoundry.identity.uaa.util.UaaUrlUtilsTest.java

@Test
public void testDecodeScopes() throws Exception {
    String xWWWFormEncodedscopes = "scim.userids+password.write+openid+cloud_controller.write+cloud_controller.read";
    System.out.println(URLDecoder.decode(xWWWFormEncodedscopes));
    System.out.println(URIUtil.decode(xWWWFormEncodedscopes, "UTF-8"));
    System.out.println(UriUtils.decode(xWWWFormEncodedscopes, "UTF-8"));

    //Assert.assertEquals(URLDecoder.decode(xWWWFormEncodedscopes), UriUtils.decode(xWWWFormEncodedscopes, "UTF-8"));
}

From source file:org.lockss.util.UrlUtil.java

/**
 * decode a url using the java URLDecoder
 * @param url the url to encode// w  w w.j  a va  2s  . c o m
 * @param enc the encoding to use
 * @return  the unencoded string
 */
public static String decodeUri(String url, String enc) {
    try {
        return UriUtils.decode(url, enc);
    } catch (UnsupportedEncodingException e) {
        // The system should always have the platform default
        throw new RuntimeException("Encoding (" + enc + ") unsupported", e);
    }
}

From source file:org.springframework.web.util.UrlPathHelper.java

@SuppressWarnings("deprecation")
private String decodeInternal(HttpServletRequest request, String source) {
    String enc = determineEncoding(request);
    try {/*w  w  w .ja v a  2s.com*/
        return UriUtils.decode(source, enc);
    } catch (UnsupportedEncodingException ex) {
        if (logger.isWarnEnabled()) {
            logger.warn("Could not decode request string [" + source + "] with encoding '" + enc
                    + "': falling back to platform default encoding; exception message: " + ex.getMessage());
        }
        return URLDecoder.decode(source);
    }
}