Java Code Examples for org.springframework.web.servlet.mvc.method.RequestMappingInfo#getMethodsCondition()

The following examples show how to use org.springframework.web.servlet.mvc.method.RequestMappingInfo#getMethodsCondition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdminControllerHandlerMapping.java    From Moss with Apache License 2.0 5 votes vote down vote up
private RequestMappingInfo withPrefix(RequestMappingInfo mapping) {
    if (!StringUtils.hasText(adminContextPath)) {
        return mapping;
    }
    PatternsRequestCondition patternsCondition = new PatternsRequestCondition(
        withNewPatterns(mapping.getPatternsCondition().getPatterns()));
    return new RequestMappingInfo(patternsCondition, mapping.getMethodsCondition(), mapping.getParamsCondition(),
        mapping.getHeadersCondition(), mapping.getConsumesCondition(), mapping.getProducesCondition(),
        mapping.getCustomCondition());
}
 
Example 2
Source File: OptionalPrefixControllerAutoConfiguration.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
private RequestMappingInfo withPrefix(RequestMappingInfo mapping) {
	List<String> newPatterns = getPatterns(mapping);

	PatternsRequestCondition patterns = new PatternsRequestCondition(newPatterns.toArray(new String[newPatterns.size()]));
	return new RequestMappingInfo(patterns, mapping.getMethodsCondition(), mapping.getParamsCondition(),
			mapping.getHeadersCondition(), mapping.getConsumesCondition(), mapping.getProducesCondition(),
			mapping.getCustomCondition());
}
 
Example 3
Source File: StoreAwareHandlerMapping.java    From spring-content with Apache License 2.0 5 votes vote down vote up
@Override
	protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {

		RequestMappingInfo info = super.getMappingForMethod(method, handlerType);

		if (info == null) {
			return null;
		}

		PatternsRequestCondition patternsCondition = customize(info.getPatternsCondition(), prefix);
//		ProducesRequestCondition producesCondition = customize(info.getProducesCondition());

		return new RequestMappingInfo(patternsCondition, info.getMethodsCondition(), info.getParamsCondition(),
				info.getHeadersCondition(), info.getConsumesCondition(), info.getProducesCondition(), info.getCustomCondition());
	}
 
Example 4
Source File: ExtRequestMappingHandlerMapping.java    From onetwo with Apache License 2.0 5 votes vote down vote up
static RequestMappingInfo createRequestMappingInfo(String path, Method method, Class<?> handlerType, RequestMappingInfo info) {
	return new RequestMappingInfo(
			new PatternsRequestCondition(path),
			info.getMethodsCondition(),
			info.getParamsCondition(),
			info.getHeadersCondition(),
			info.getConsumesCondition(), 
			info.getProducesCondition(),
			info.getCustomCondition());
}
 
Example 5
Source File: VaadinConnectControllerConfiguration.java    From flow with Apache License 2.0 5 votes vote down vote up
/**
 * Prepends the Connect prefix URL from the Vaadin Connect properties to
 * the {@code pattern} of a {@link RequestMappingInfo} object, and returns
 * the updated mapping as a new object (not modifying the given
 * {@param mapping} parameter).
 *
 * @return a new mapping with the Connect prefix URL prepended to the
 *         mapping pattern
 */
private RequestMappingInfo prependConnectPrefixUrl(
        RequestMappingInfo mapping) {
    PatternsRequestCondition connectEndpointPattern =
            new PatternsRequestCondition(
            vaadinEndpointProperties.getVaadinEndpointPrefix())
                    .combine(mapping.getPatternsCondition());

    return new RequestMappingInfo(mapping.getName(), connectEndpointPattern,
            mapping.getMethodsCondition(), mapping.getParamsCondition(),
            mapping.getHeadersCondition(), mapping.getConsumesCondition(),
            mapping.getProducesCondition(), mapping.getCustomCondition());
}
 
Example 6
Source File: AdminControllerHandlerMapping.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
private RequestMappingInfo withPrefix(RequestMappingInfo mapping) {
	if (!StringUtils.hasText(adminContextPath)) {
		return mapping;
	}
	PatternsRequestCondition patternsCondition = new PatternsRequestCondition(
			withNewPatterns(mapping.getPatternsCondition().getPatterns()));
	return new RequestMappingInfo(patternsCondition, mapping.getMethodsCondition(), mapping.getParamsCondition(),
			mapping.getHeadersCondition(), mapping.getConsumesCondition(), mapping.getProducesCondition(),
			mapping.getCustomCondition());
}