![JAR search and dependency download from the Maven repository](/logo.png)
de.otto.edison.status.controller.StatusController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edison-status Show documentation
Show all versions of edison-status Show documentation
Status library of the edison-microservice project.
package de.otto.edison.status.controller;
import de.otto.edison.status.indicator.ApplicationStatusAggregator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import static de.otto.edison.status.controller.StatusRepresentation.statusRepresentationOf;
import static java.time.ZonedDateTime.now;
import static java.time.format.DateTimeFormatter.ofLocalizedDateTime;
import static java.time.format.FormatStyle.LONG;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@ConfigurationProperties(value = "endpoints.status", ignoreUnknownFields = false)
@RestController
public class StatusController {
private static final String SYSTEM_START_TIME = now().format(ofLocalizedDateTime(LONG));
@Autowired
private ApplicationStatusAggregator aggregator;
public StatusController() {
}
public StatusController(final ApplicationStatusAggregator aggregator) {
this.aggregator = aggregator;
}
@RequestMapping(
value = "/internal/status",
produces = {"application/vnd.otto.monitoring.status+json", "application/json"},
method = GET
)
public StatusRepresentation getStatusAsJson() {
return statusRepresentationOf(aggregator.aggregatedStatus());
}
@RequestMapping(
value = "/internal/status",
produces = "text/html",
method = GET
)
public ModelAndView getStatusAsHtml() {
return new ModelAndView("status", "status", aggregator.aggregatedStatus());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy