Search in sources :

Example 1 with AbstractHttpHandler

use of com.creditease.agent.spi.AbstractHttpHandler in project uavstack by uavorg.

the class HBClientDefaultHandler method getServiceURLs.

/**
 * get the node's http service url
 *
 * @return
 */
@SuppressWarnings("rawtypes")
private Map<String, String> getServiceURLs() {
    Set<Object> components = this.getConfigManager().getComponents();
    Map<String, String> services = new LinkedHashMap<String, String>();
    for (Object comp : components) {
        if (!AbstractBaseHttpServComponent.class.isAssignableFrom(comp.getClass())) {
            continue;
        }
        AbstractBaseHttpServComponent asc = (AbstractBaseHttpServComponent) comp;
        String compid = asc.getFeature() + "-" + asc.getName();
        String httpRootURL = asc.getHttpRootURL();
        List handlers = asc.getHandlers();
        for (Object handler : handlers) {
            if (!AbstractHttpHandler.class.isAssignableFrom(handler.getClass())) {
                continue;
            }
            AbstractHttpHandler abshandler = (AbstractHttpHandler) handler;
            String serviceId = compid + "-" + abshandler.getContextPath();
            String serviceHttpURL = httpRootURL + abshandler.getContextPath();
            services.put(serviceId, serviceHttpURL);
        }
    }
    return services;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) AbstractBaseHttpServComponent(com.creditease.agent.spi.AbstractBaseHttpServComponent) AbstractHttpHandler(com.creditease.agent.spi.AbstractHttpHandler)

Aggregations

AbstractBaseHttpServComponent (com.creditease.agent.spi.AbstractBaseHttpServComponent)1 AbstractHttpHandler (com.creditease.agent.spi.AbstractHttpHandler)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1