-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log a warning if Webapps or REST are enabled but not supported on the…
… current server runtime.
- Loading branch information
1 parent
368a4ac
commit c943293
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
.../src/main/java/info/novatec/micronaut/camunda/bpm/feature/webapp/JettyRuntimeMissing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2020-2021 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package info.novatec.micronaut.camunda.bpm.feature.webapp; | ||
|
||
import info.novatec.micronaut.camunda.bpm.feature.Configuration; | ||
import io.micronaut.context.annotation.Requires; | ||
import io.micronaut.context.event.ApplicationEventListener; | ||
import io.micronaut.runtime.server.event.ServerStartupEvent; | ||
import io.micronaut.servlet.jetty.JettyServer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.inject.Singleton; | ||
|
||
/** | ||
* Log a warning if Webapps or REST are enabled but not supported on the current server runtime. | ||
* | ||
* Currently, the Webapps and REST are only supported on Jetty. | ||
* | ||
* @author Tobias Schäfer | ||
*/ | ||
@Singleton | ||
@Requires(missing = JettyServer.class) | ||
public class JettyRuntimeMissing implements ApplicationEventListener<ServerStartupEvent> { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(JettyRuntimeMissing.class); | ||
|
||
protected final Configuration configuration; | ||
|
||
public JettyRuntimeMissing(Configuration configuration) { | ||
this.configuration = configuration; | ||
} | ||
|
||
@Override | ||
public void onApplicationEvent(ServerStartupEvent event) { | ||
if (configuration.getWebapps().isEnabled()) { | ||
log.warn("Webapps are enabled via 'camunda.webapps.enabled' but they are not supported on the current server runtime. Please switch to Jetty, see https://github.com/NovatecConsulting/micronaut-camunda-bpm#camunda-rest-api-and-webapps"); | ||
} | ||
if (configuration.getRest().isEnabled()) { | ||
log.warn("REST are enabled via 'camunda.rest.enabled' but it is not supported on the current server runtime. Please switch to Jetty, see https://github.com/NovatecConsulting/micronaut-camunda-bpm#camunda-rest-api-and-webapps"); | ||
} | ||
} | ||
} |