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

io.leopard.web.mvc.RequestMappingInfoBuilderImpl Maven / Gradle / Ivy

There is a newer version: 0.9.12
Show newest version
package io.leopard.web.mvc;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.web.bind.annotation.RequestMapping;

import io.leopard.web.mvc.condition.ExtensiveDomain;

public class RequestMappingInfoBuilderImpl implements RequestMappingInfoBuilder {

	private List builders;

	public RequestMappingInfoBuilderImpl(ApplicationContext context) {
		Map matchingBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors(context, RequestMappingInfoBuilder.class, true, false);
		// System.err.println("matchingBeans:" + context.getBeansOfType(RequestMappingInfoBuilder.class));
		if (!matchingBeans.isEmpty()) {
			this.builders = new ArrayList(matchingBeans.values());
			AnnotationAwareOrderComparator.sort(this.builders);
		}
	}

	@Override
	public void getHeaders(RequestMapping annotation, Method method, ExtensiveDomain extensiveDomain, Map headers) {
		if (builders == null) {
			return;
		}
		for (RequestMappingInfoBuilder builder : builders) {
			// System.err.println("builder:" + builder);
			builder.getHeaders(annotation, method, extensiveDomain, headers);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy