View Javadoc

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       * <p>
55       * 
56       * <pre>
57       *   "/downloads/*"          - servlet spec
58       *   "/api/*"                - servlet spec
59       *   "^/rest/.*$"            - regex spec
60       *   "/bookings/{guest-id}"  - uri-template spec
61       *   "/rewards/{vip-level}"  - uri-template spec
62       * </pre>
63       */
64      PREFIX_GLOB,
65      /**
66       * For path specs that have a wildcard glob with a hardcoded suffix
67       * 
68       * <pre>
69       *   "*.do"        - servlet spec
70       *   "*.css"       - servlet spec
71       *   "^.*\.zip$"   - regex spec
72       * </pre>
73       * 
74       * Note: there is no known uri-template spec variant of this kind of path spec
75       */
76      SUFFIX_GLOB,
77      /**
78       * The root spec for accessing the Root behavior.
79       * 
80       * <pre>
81       *   ""           - servlet spec       (Root Servlet)
82       *   null         - servlet spec       (Root Servlet)
83       * </pre>
84       * 
85       * Note: there is no known uri-template spec variant of this kind of path spec
86       */
87      ROOT,
88      /**
89       * The default spec for accessing the Default path behavior.
90       * 
91       * <pre>
92       *   "/"           - servlet spec      (Default Servlet)
93       *   "/"           - uri-template spec (Root Context)
94       *   "^/$"         - regex spec        (Root Context)
95       * </pre>
96       * 
97       * Per Servlet Spec, pathInfo is always null for these specs.
98       * If nothing above matches, then default will match.
99       */
100     DEFAULT,
101 }