File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
jooby/src/main/java/io/jooby Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 4646 */
4747public interface Context extends Registry {
4848
49+ /** Select an application base on context path prefix matching a provided path. */
4950 interface Selector {
51+ /**
52+ * Select an application base on context path prefix matching a provided path.
53+ *
54+ * @param applications List of applications.
55+ * @param path Path to match.
56+ * @return Best match application.
57+ */
5058 Jooby select (List <Jooby > applications , String path );
5159
5260 static Selector create (List <Jooby > applications ) {
5361 return applications .size () == 1 ? single () : multiple ();
5462 }
5563
64+ /**
65+ * Select an application the best match a given path. If none matches it returns the application
66+ * that has no context path <code>/</code> or the first of the list.
67+ *
68+ * @return Best match application.
69+ */
5670 static Selector multiple () {
5771 return (applications , path ) -> {
5872 var defaultApp = applications .get (0 );
@@ -68,13 +82,8 @@ static Selector multiple() {
6882 };
6983 }
7084
71- static Selector single () {
72- return new Selector () {
73- @ Override
74- public Jooby select (List <Jooby > applications , String path ) {
75- return applications .get (0 );
76- }
77- };
85+ private static Selector single () {
86+ return (applications , path ) -> applications .get (0 );
7887 }
7988 }
8089
You can’t perform that action at this time.
0 commit comments