1 //
2 // ========================================================================
3 // Copyright (c) 1995-2015 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.websocket.server.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: {@link PathSpecGroup#ordinal()} [increasin], {@link PathSpec#specLength} [decreasing], {@link PathSpec#pathSpec} [natural sort order]
27 */
28 public enum PathSpecGroup
29 {
30 // NOTE: Order of enums determines order of Groups.
31
32 /**
33 * For exactly defined path specs, no glob.
34 */
35 EXACT,
36 /**
37 * For path specs that have a hardcoded prefix and suffix with wildcard glob in the middle.
38 *
39 * <pre>
40 * "^/downloads/[^/]*.zip$" - regex spec
41 * "/a/{var}/c" - websocket spec
42 * </pre>
43 *
44 * Note: there is no known servlet spec variant of this kind of path spec
45 */
46 MIDDLE_GLOB,
47 /**
48 * For path specs that have a hardcoded prefix and a trailing wildcard glob.
49 * <p>
50 *
51 * <pre>
52 * "/downloads/*" - servlet spec
53 * "/api/*" - servlet spec
54 * "^/rest/.*$" - regex spec
55 * "/bookings/{guest-id}" - websocket spec
56 * "/rewards/{vip-level}" - websocket spec
57 * </pre>
58 */
59 PREFIX_GLOB,
60 /**
61 * For path specs that have a wildcard glob with a hardcoded suffix
62 *
63 * <pre>
64 * "*.do" - servlet spec
65 * "*.css" - servlet spec
66 * "^.*\.zip$" - regex spec
67 * </pre>
68 *
69 * Note: there is no known websocket spec variant of this kind of path spec
70 */
71 SUFFIX_GLOB,
72 /**
73 * The default spec for accessing the Root and/or Default behavior.
74 *
75 * <pre>
76 * "/" - servlet spec (Default Servlet)
77 * "/" - websocket spec (Root Context)
78 * "^/$" - regex spec (Root Context)
79 * </pre>
80 */
81 DEFAULT;
82 }