1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider;
18
19 import org.apache.commons.vfs2.FileName;
20 import org.apache.commons.vfs2.FileSystemException;
21 import org.apache.commons.vfs2.FileType;
22
23
24
25
26
27
28
29
30 @Deprecated
31 public class URLFileNameParser extends HostFileNameParser {
32 public URLFileNameParser(final int defaultPort) {
33 super(defaultPort);
34 }
35
36 @Override
37 public boolean encodeCharacter(final char ch) {
38 return super.encodeCharacter(ch) || ch == '?';
39 }
40
41 @Override
42 public FileName parseUri(FileNameal VfsComponentContext context, final FileName base, final String fileName)
43 throws FileSystemException {
44
45 final StringBuilder name = new StringBuilder();
46
47
48 final Authority auth = extractToPath(context, fileName, name);
49
50
51 final String queryString = UriParser.extractQueryString(name);
52
53
54 UriParser.canonicalizePath(name, 0, name.length(), this);
55 UriParser.fixSeparators(name);
56 final FileType fileType = UriParser.normalisePath(name);
57 final String path = name.toString();
58
59 return new URLFileName(auth.getScheme(), auth.getHostName(), auth.getPort(), getDefaultPort(),
60 auth.getUserName(), auth.getPassword(), path, fileType, queryString);
61 }
62 }