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

io.quarkus.resteasy.reactive.server.runtime.observability.ObservabilityCustomizer Maven / Gradle / Ivy

Go to download

A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.

The newest version!
package io.quarkus.resteasy.reactive.server.runtime.observability;

import java.util.Collections;
import java.util.List;

import org.jboss.resteasy.reactive.common.model.ResourceClass;
import org.jboss.resteasy.reactive.server.model.HandlerChainCustomizer;
import org.jboss.resteasy.reactive.server.model.ServerResourceMethod;
import org.jboss.resteasy.reactive.server.spi.ServerRestHandler;

public class ObservabilityCustomizer implements HandlerChainCustomizer {
    @Override
    public List handlers(Phase phase, ResourceClass resourceClass,
            ServerResourceMethod serverResourceMethod) {
        if (phase.equals(Phase.AFTER_MATCH)) {
            String basePath = resourceClass.getPath();
            boolean isSubResource = basePath == null;
            ObservabilityHandler observabilityHandler = new ObservabilityHandler();
            if (isSubResource) {
                observabilityHandler.setTemplatePath(serverResourceMethod.getPath());
                observabilityHandler.setSubResource(true);
            } else {
                observabilityHandler.setTemplatePath(basePath + serverResourceMethod.getPath());
                observabilityHandler.setSubResource(false);
            }

            return Collections.singletonList(observabilityHandler);
        }
        return Collections.emptyList();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy