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
33
34
35
36
37
38 public URLFileNameParser(final int defaultPort) {
39 super(defaultPort);
40 }
41
42 @Override
43 public boolean encodeCharacter(final char ch) {
44 return super.encodeCharacter(ch) || ch == '?';
45 }
46
47 @Override
48 public FileName parseUri(final VfsComponentContext context, final FileName base, final String fileName)
49 throws FileSystemException {
50
51 final StringBuilder name = new StringBuilder();
52
53
54 final Authority auth = extractToPath(context, fileName, name);
55
56
57 final String queryString = UriParser.extractQueryString(name);
58
59
60 UriParser.canonicalizePath(name, 0, name.length(), this);
61 UriParser.fixSeparators(name);
62 final FileType fileType = UriParser.normalisePath(name);
63 final String path = name.toString();
64
65 return new URLFileName(auth.getScheme(), auth.getHostName(), auth.getPort(), getDefaultPort(),
66 auth.getUserName(), auth.getPassword(), path, fileType, queryString);
67 }
68 }