path = URIUtil.decode( new Path(System.getProperty("user.dir"), fromPath).toUri().toString()); } else {
public static String decode(String queryString) { try { return org.apache.commons.httpclient.util.URIUtil.decode(queryString); } catch (URIException e) { throw new RuntimeException(e); } } }
public static String decode(String queryString) { try { return org.apache.commons.httpclient.util.URIUtil.decode(queryString); } catch (URIException e) { throw new RuntimeException(e); } } }
private static String getName(String uri) { String escapedName = URIUtil.getName( uri.endsWith("/") ? uri.substring(0, uri.length() - 1): uri); try { return URIUtil.decode(escapedName); } catch (URIException e) { return escapedName; } }
public static String decodePath(String path) { try { return URIUtil.decode(path, "UTF-8"); } catch (URIException ex) { throw new EsHadoopIllegalArgumentException("Cannot encode path" + path, ex); } }
public static String decode(String encoded) { try { return URIUtil.decode(encoded, CharEncoding.UTF_8); } catch (URIException e) { throw RaptureExceptionFactory.create(String.format("Error decoding step name %s:", encoded), e); } }
/** * Parse and decode the path component from the given request. * @param request Http request to parse * @param servletName the name of servlet that precedes the path * @return decoded path component, null if UTF-8 is not supported */ public static String getDecodedPath(final HttpServletRequest request, String servletName) { try { return URIUtil.decode(getRawPath(request, servletName), "UTF-8"); } catch (URIException e) { throw new AssertionError("JVM does not support UTF-8"); // should never happen! } }
protected String getURLPropertyIfExists(DavPropertySet properties, String alias) throws URIException { String result = getPropertyIfExists(properties, alias); if (result != null) { result = URIUtil.decode(result); } return result; }
/** * Parse and decode the path component from the given request. * @param request Http request to parse * @param servletName the name of servlet that precedes the path * @return decoded path component, null if UTF-8 is not supported */ public static String getDecodedPath(final HttpServletRequest request, String servletName) { try { return URIUtil.decode(getRawPath(request, servletName), "UTF-8"); } catch (URIException e) { throw new AssertionError("JVM does not support UTF-8"); // should never happen! } }
/** * Parse and decode the path component from the given request. * @param request Http request to parse * @param servletName the name of servlet that precedes the path * @return decoded path component, null if UTF-8 is not supported */ public static String getDecodedPath(final HttpServletRequest request, String servletName) { try { return URIUtil.decode(getRawPath(request, servletName), "UTF-8"); } catch (URIException e) { throw new AssertionError("JVM does not support UTF-8"); // should never happen! } }
public String getParent() { if(relPath!=null) return null; String escapedPath = httpUrl.getEscapedPath(); String parent = escapedPath.substring( 0, escapedPath.lastIndexOf('/', escapedPath.length() - 2) + 1); if (parent.length() <= 1) return null; try { return URIUtil.decode(parent); } catch (URIException e) { return parent; } }
public String getName() { if(relPath!=null) return relPath; String escapedPath = httpUrl.getEscapedPath(); String escapedName = URIUtil.getName(escapedPath.endsWith("/") ? escapedPath.substring(0, escapedPath.length() - 1) : escapedPath); try { return URIUtil.decode(escapedName); } catch (URIException e) { return escapedName; } }
private String getHref(Response response) { String href = response.getHref(); if (this.decodeResponseHrefs != null) { try { href = URIUtil.decode(href, this.decodeResponseHrefs); } catch (URIException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return href; }
@Override public Path getPath(final URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull("uri", uri); checkCondition("uri scheme not supported", uri.getScheme().equals(getScheme()) || uri.getScheme().equals("default")); try { return getDefaultFileSystem().getPath(URIUtil.decode(uri.getPath())); } catch (final URIException e) { return null; } }
/** * Utility function used to convert a given URI to a decoded string * representation sent to the backing store. URIs coming as input * to this class will be encoded by the URI class, and we want * the underlying storage to store keys in their original UTF-8 form. */ private static String convertUriToDecodedString(URI uri) { try { String result = URIUtil.decode(uri.toString()); return result; } catch (URIException e) { throw new AssertionError("Failed to decode URI: " + uri.toString()); } }
protected String getURIPropertyIfExists(DavPropertySet properties, String alias) throws URIException { DavProperty property = properties.get(Field.getPropertyName(alias)); if (property == null) { return null; } else { return URIUtil.decode((String) property.getValue()); } }
@Override public Path getPath( final URI uri ) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull( "uri", uri ); checkCondition( "uri scheme not supported", uri.getScheme().equals( getScheme() ) || uri.getScheme().equals( "default" ) ); checkURI( "uri", uri ); final JGitFileSystem fileSystem = fileSystems.get( extractRepoName( uri ) ); if ( fileSystem == null ) { throw new FileSystemNotFoundException(); } try { return JGitPathImpl.create( fileSystem, URIUtil.decode( extractPath( uri ) ), extractHost( uri ), false ); } catch ( final URIException e ) { return null; } }
@Override public Path getPath(final URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull("uri", uri); checkCondition("uri scheme not supported", uri.getScheme().equals(getScheme()) || uri.getScheme().equals("default")); checkURI("uri", uri); final JGitFileSystem fileSystem = fileSystems.get(extractRepoName(uri)); if (fileSystem == null) { throw new FileSystemNotFoundException(); } try { return JGitPathImpl.create(fileSystem, URIUtil.decode(extractPath(uri)), extractHost(uri), false); } catch (final URIException e) { return null; } }
/** * Build Event instance from response info. * * @param multiStatusResponse response * @throws URIException on error */ public Event(MultiStatusResponse multiStatusResponse) throws URIException { setHref(URIUtil.decode(multiStatusResponse.getHref())); DavPropertySet properties = multiStatusResponse.getProperties(HttpStatus.SC_OK); permanentUrl = getURLPropertyIfExists(properties, "permanenturl"); etag = getPropertyIfExists(properties, "etag"); displayName = getPropertyIfExists(properties, "displayname"); subject = getPropertyIfExists(properties, "subject"); instancetype = getPropertyIfExists(properties, "instancetype"); contentClass = getPropertyIfExists(properties, "contentclass"); }
@Test public void testSimpleBranchedGitRoot2Spaced() throws URIException { when(fs.getSeparator()).thenReturn("/"); final Path path = JGitPathImpl.create(fs, URIUtil.decode("/path/to/some/some%20place.txt"), "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isTrue(); assertThat(path.toString()).isEqualTo("/path/to/some/some place.txt"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/path/to/some/some%20place.txt"); assertThat(path.getNameCount()).isEqualTo(4); assertThat(path.getName(0).toString()).isNotNull().isEqualTo("path"); assertThat(path.getRoot().toString()).isNotNull().isEqualTo("/"); }