All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hawt.springboot.HawtioEndpoint Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package io.hawt.springboot;

import org.springframework.boot.actuate.endpoint.mvc.AbstractNamedMvcEndpoint;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;

/**
 * Spring Boot endpoint to expose hawtio
 */
public class HawtioEndpoint extends AbstractNamedMvcEndpoint {

    public HawtioEndpoint() {
        super("hawtio", "/hawtio", true);
    }

    @Override
    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
        registry
            .addResourceHandler("/hawtio/plugins/**")
            .addResourceLocations(
                "/app/",
                "classpath:/hawtio-static/app/");
        registry
            .addResourceHandler("/hawtio/**")
            .addResourceLocations(
                "/",
                "/app/",
                "classpath:/hawtio-static/",
                "classpath:/hawtio-static/app/");
        registry
            .addResourceHandler("/img/**")
            .addResourceLocations(
                "classpath:/hawtio-static/img/");
    }

    @Override
    public void addViewControllers(final ViewControllerRegistry registry) {
        registry
            .addViewController("/hawtio/plugin")
            .setViewName("forward:/plugin");
        registry
            .addViewController("/hawtio/")
            .setViewName("redirect:/hawtio/index.html");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy