/** * Guess if the given file name is an URL with host or not. * <p> * VFS treats such URLs differently. * <p> * A file name is URL-based if the base is a {@code URLFileName} or there are only 2 slashes after the scheme. e.g: * {@code http://host/path}, {@code file:/path/to/file}, {@code file:///path/to/file}. * * @param base The filename is relative to this base. * @param filename The filename. * @return true if filename contains two slashes or base was URLFileName. */ protected boolean isUrlBased(final FileName base, final String filename) { if (base instanceof URLFileName) { return true; } return countSlashes(filename) == 2; }
UrlFileNameParser parser = new UrlFileNameParser(); FileName fileName = parser.parseUri( null, null, noVariablesURL ); String root = fileName.getRootURI(); String path = fullyQualifiedIncomingURL.substring( root.length() - 1 );
public UrlFileProvider() { super(); setFileNameParser(new UrlFileNameParser()); }
/** * Parse a URI. * * @param context The component context. * @param base The base FileName. * @param uri The target file name. * @return The FileName. * @throws FileSystemException if an error occurs */ @Override public FileName parseUri(final VfsComponentContext context, final FileName base, final String uri) throws FileSystemException { if (isUrlBased(base, uri)) { return url.parseUri(context, base, uri); } return generic.parseUri(context, base, uri); }
UrlFileNameParser parser = new UrlFileNameParser(); FileName fileName = parser.parseUri( null, null, noVariablesURL ); String root = fileName.getRootURI(); String path = fullyQualifiedIncomingURL.substring( root.length() - 1 );
public UrlFileProvider() { super(); setFileNameParser(new UrlFileNameParser()); }
/** * Parse a URI. * * @param context The component context. * @param base The base FileName. * @param uri The target file name. * @return The FileName. * @throws FileSystemException if an error occurs */ @Override public FileName parseUri(final VfsComponentContext context, final FileName base, final String uri) throws FileSystemException { if (isUrlBased(base, uri)) { return url.parseUri(context, base, uri); } return generic.parseUri(context, base, uri); }
public UrlFileProvider() { super(); setFileNameParser(new UrlFileNameParser()); }
/** * Guess if the given file name is an URL with host or not. * <p> * VFS treats such URLs differently. * <p> * A file name is URL-based if the base is a {@code URLFileName} or there are only 2 slashes after the scheme. e.g: * {@code http://host/path}, {@code file:/path/to/file}, {@code file:///path/to/file}. * * @param base The filename is relative to this base. * @param filename The filename. * @return true if filename contains two slashes or base was URLFileName. */ protected boolean isUrlBased(final FileName base, final String filename) { if (base instanceof URLFileName) { return true; } return countSlashes(filename) == 2; }
/** * Parse a URI. * * @param context The component context. * @param base The base FileName. * @param uri The target file name. * @return The FileName. * @throws FileSystemException if an error occurs */ @Override public FileName parseUri(final VfsComponentContext context, final FileName base, final String uri) throws FileSystemException { if (isUrlBased(base, uri)) { return url.parseUri(context, base, uri); } return generic.parseUri(context, base, uri); }
/** * Guess if the given file name is an URL with host or not. * <p> * VFS treats such URLs differently. * <p> * A file name is URL-based if the base is a {@code URLFileName} or there are only 2 slashes after the scheme. e.g: * {@code http://host/path}, {@code file:/path/to/file}, {@code file:///path/to/file}. * * @param base The filename is relative to this base. * @param filename The filename. * @return true if filename contains two slashes or base was URLFileName. */ protected boolean isUrlBased(final FileName base, final String filename) { if (base instanceof URLFileName) { return true; } return countSlashes(filename) == 2; }