|
24 | 24 | importjava.util.Objects; |
25 | 25 | importjavax.inject.Inject; |
26 | 26 |
|
| 27 | +importcom.indoqa.boot.ApplicationInitializationException; |
27 | 28 | importcom.indoqa.boot.html.builder.HtmlBuilder; |
28 | 29 | importcom.indoqa.boot.html.react.AbstractCreateReactAppResourceBase.ResponseEnhancements.ResponseEnhancementsBuilder; |
29 | 30 | importcom.indoqa.boot.html.resources.AbstractHtmlResourcesBase; |
@@ -121,10 +122,13 @@ protected void html(String classPathLocation, String fileSystemLocation, |
121 | 122 |
|
122 | 123 | protectedvoidhtml(ReactApplicationsreactApplications) { |
123 | 124 | Objects.requireNonNull(reactApplications,"ReactApplications must not be null."); |
| 125 | +if (reactApplications.isEmpty()) { |
| 126 | +thrownewApplicationInitializationException("At least one ReactApplication has to be provided."); |
| 127 | + } |
124 | 128 | Spark.after((request,response) -> { |
125 | 129 | ReactApplicationreactApplication =reactApplications.lookup(request,response); |
126 | 130 | if (reactApplication ==null) { |
127 | | -Spark.notFound("NoReactapplication available."); |
| 131 | +Spark.notFound("Any of the registeredReactapplications can answer this request."); |
128 | 132 | return; |
129 | 133 | } |
130 | 134 |
|
@@ -207,6 +211,10 @@ public void add(String classPathLocation, String fileSystemLocation, ResponseEnh |
207 | 211 | this.apps.add(newReactApplication(staticHandler,indexHtmlBuilder,responseEnhancementsProvider,testReactApplication)); |
208 | 212 | } |
209 | 213 |
|
| 214 | +privatebooleanisEmpty() { |
| 215 | +returnthis.apps.isEmpty(); |
| 216 | + } |
| 217 | + |
210 | 218 | ReactApplicationlookup(Requestreq,Responseres) { |
211 | 219 | for (ReactApplicationapp :this.apps) { |
212 | 220 | if (app.testReactApplication.invoke(req,res)) { |
|