1 //
2 // ========================================================================
3 // Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.http.pathmap;
20
21 /**
22 * Types of path spec groups.
23 * <p>
24 * This is used to facilitate proper pathspec search order.
25 * <p>
26 * Search Order:
27 * <ol>
28 * <li>{@link PathSpecGroup#ordinal()} [increasing]</li>
29 * <li>{@link PathSpec#specLength} [decreasing]</li>
30 * <li>{@link PathSpec#pathSpec} [natural sort order]</li>
31 * </ol>
32 */
33 public enum PathSpecGroup
34 {
35 // NOTE: Order of enums determines order of Groups.
36
37 /**
38 * For exactly defined path specs, no glob.
39 */
40 EXACT,
41 /**
42 * For path specs that have a hardcoded prefix and suffix with wildcard glob in the middle.
43 *
44 * <pre>
45 * "^/downloads/[^/]*.zip$" - regex spec
46 * "/a/{var}/c" - uri-template spec
47 * </pre>
48 *
49 * Note: there is no known servlet spec variant of this kind of path spec
50 */
51 MIDDLE_GLOB,
52 /**
53 * For path specs that have a hardcoded prefix and a trailing wildcard glob.
54 *
55 * <pre>
56 * "/downloads/*" - servlet spec
57 * "/api/*" - servlet spec
58 * "^/rest/.*$" - regex spec
59 * "/bookings/{guest-id}" - uri-template spec
60 * "/rewards/{vip-level}" - uri-template spec
61 * </pre>
62 */
63 PREFIX_GLOB,
64 /**
65 * For path specs that have a wildcard glob with a hardcoded suffix
66 *
67 * <pre>
68 * "*.do" - servlet spec
69 * "*.css" - servlet spec
70 * "^.*\.zip$" - regex spec
71 * </pre>
72 *
73 * Note: there is no known uri-template spec variant of this kind of path spec
74 */
75 SUFFIX_GLOB,
76 /**
77 * The root spec for accessing the Root behavior.
78 *
79 * <pre>
80 * "" - servlet spec (Root Servlet)
81 * null - servlet spec (Root Servlet)
82 * </pre>
83 *
84 * Note: there is no known uri-template spec variant of this kind of path spec
85 */
86 ROOT,
87 /**
88 * The default spec for accessing the Default path behavior.
89 *
90 * <pre>
91 * "/" - servlet spec (Default Servlet)
92 * "/" - uri-template spec (Root Context)
93 * "^/$" - regex spec (Root Context)
94 * </pre>
95 *
96 * Per Servlet Spec, pathInfo is always null for these specs.
97 * If nothing above matches, then default will match.
98 */
99 DEFAULT,
100 }