Wed, 06 Jan 2021 16:41:09 +0100
single-use constant field can be inlined
179
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | /* |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | * Copyright 2021 Mike Becker. All rights reserved. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | * Redistribution and use in source and binary forms, with or without |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | * modification, are permitted provided that the following conditions are met: |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | * 1. Redistributions of source code must retain the above copyright |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | * notice, this list of conditions and the following disclaimer. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | * 2. Redistributions in binary form must reproduce the above copyright |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | * notice, this list of conditions and the following disclaimer in the |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | * documentation and/or other materials provided with the distribution. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | package de.uapcore.lightpit |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | import kotlin.math.min |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
29 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
30 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
31 | * Maps requests to methods. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
32 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
33 | * This annotation is used to annotate methods within classes which |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
34 | * override [AbstractServlet]. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
35 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
36 | @MustBeDocumented |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
37 | @Retention(AnnotationRetention.RUNTIME) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
38 | @Target(AnnotationTarget.FUNCTION) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
39 | annotation class RequestMapping( |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
40 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
41 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
42 | * Specifies the HTTP method. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
43 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
44 | * @return the HTTP method handled by the annotated Java method |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
45 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
46 | val method: HttpMethod, |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
47 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
48 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
49 | * Specifies the request path relative to the module path. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
50 | * The trailing slash is important. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
51 | * A node may start with a dollar ($) sign. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
52 | * This part of the path is then treated as an path parameter. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
53 | * Path parameters can be obtained by including the [PathParameters] type in the signature. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
54 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
55 | * @return the request path the annotated method should handle |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
56 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
57 | val requestPath: String = "/" |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
58 | ) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
59 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
60 | class PathParameters : HashMap<String, String>() |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
61 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
62 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
63 | * A path pattern optionally containing placeholders. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
64 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
65 | * The special directories . and .. are disallowed in the pattern. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
66 | * Placeholders start with a $ sign. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
67 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
68 | * @param pattern the pattern |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
69 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
70 | class PathPattern(pattern: String) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
71 | private val nodePatterns: List<String> |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
72 | private val collection: Boolean |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
73 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
74 | private fun parse(pattern: String): List<String> { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
75 | val nodes = pattern.split("/").filter { it.isNotBlank() }.toList() |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
76 | require(nodes.none { it == "." || it == ".." }) { "Path must not contain '.' or '..' nodes." } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
77 | return nodes |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
78 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
79 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
80 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
81 | * Matches a path against this pattern. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
82 | * The path must be canonical in the sense that no . or .. parts occur. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
83 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
84 | * @param path the path to match |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
85 | * @return true if the path matches the pattern, false otherwise |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
86 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
87 | fun matches(path: String): Boolean { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
88 | if (collection xor path.endsWith("/")) return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
89 | val nodes = parse(path) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
90 | if (nodePatterns.size != nodes.size) return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
91 | for (i in nodePatterns.indices) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
92 | val pattern = nodePatterns[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
93 | val node = nodes[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
94 | if (pattern.startsWith("$")) continue |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
95 | if (pattern != node) return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
96 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
97 | return true |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
98 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
99 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
100 | /** |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
101 | * Returns the path parameters found in the specified path using this pattern. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
102 | * The return value of this method is undefined, if the patter does not match. |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
103 | * |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
104 | * @param path the path |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
105 | * @return the path parameters, if any, or an empty map |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
106 | * @see .matches |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
107 | */ |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
108 | fun obtainPathParameters(path: String): PathParameters { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
109 | val params = PathParameters() |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
110 | val nodes = parse(path) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
111 | for (i in 0 until min(nodes.size, nodePatterns.size)) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
112 | val pattern = nodePatterns[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
113 | val node = nodes[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
114 | if (pattern.startsWith("$")) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
115 | params[pattern.substring(1)] = node |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
116 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
117 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
118 | return params |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
119 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
120 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
121 | override fun hashCode(): Int { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
122 | val str = StringBuilder() |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
123 | for (node in nodePatterns) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
124 | if (node.startsWith("$")) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
125 | str.append("/$") |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
126 | } else { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
127 | str.append('/') |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
128 | str.append(node) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
129 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
130 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
131 | if (collection) str.append('/') |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
132 | return str.toString().hashCode() |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
133 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
134 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
135 | override fun equals(other: Any?): Boolean { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
136 | if (other is PathPattern) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
137 | if (collection xor other.collection || nodePatterns.size != other.nodePatterns.size) return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
138 | for (i in nodePatterns.indices) { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
139 | val left = nodePatterns[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
140 | val right = other.nodePatterns[i] |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
141 | if (left.startsWith("$") && right.startsWith("$")) continue |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
142 | if (left != right) return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
143 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
144 | return true |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
145 | } else { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
146 | return false |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
147 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
148 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
149 | |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
150 | init { |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
151 | nodePatterns = parse(pattern) |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
152 | collection = pattern.endsWith("/") |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
153 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
154 | } |
623c340058f3
migrates the utility classes for the AbstractServlet
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
155 |