List of usage examples for org.springframework.web.servlet.mvc.method RequestMappingInfo RequestMappingInfo
public RequestMappingInfo(@Nullable PatternsRequestCondition patterns,
@Nullable RequestMethodsRequestCondition methods, @Nullable ParamsRequestCondition params,
@Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
@Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom)
From source file:org.mitre.openid.connect.client.keypublisher.ClientKeyPublisherMapping.java
/** * Map the "jwkKeyPublish" method to our jwkPublishUrl. *//*from w w w .j a v a2 s . com*/ @Override protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) { if (method.getName().equals("publishClientJwk") && getJwkPublishUrl() != null) { return new RequestMappingInfo(new PatternsRequestCondition(new String[] { getJwkPublishUrl() }, getUrlPathHelper(), getPathMatcher(), false, false), null, null, null, null, null, null); } else { return null; } }
From source file:de.codecentric.boot.admin.web.PrefixHandlerMapping.java
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()); }
From source file:com.coinblesk.server.utils.ApiVersionRequestMappingHandlerMapping.java
private RequestMappingInfo createApiVersionInfo(ApiVersion annotation, RequestCondition<?> customCondition) { String[] values = annotation.value(); return new RequestMappingInfo( new PatternsRequestCondition(values, getUrlPathHelper(), getPathMatcher(), useSuffixPatternMatch(), useTrailingSlashMatch(), getFileExtensions()), new RequestMethodsRequestCondition(), new ParamsRequestCondition(), new HeadersRequestCondition(), new ConsumesRequestCondition(), new ProducesRequestCondition(), customCondition); }
From source file:net.sf.cocmvc.ConventionalHandlerMapping.java
private RequestMappingInfo createConventionalActionMapping(Method method) { return new RequestMappingInfo(createPatternRequestCondition(buildConventionalActions(method)), null, null, null, null, null, getCustomMethodCondition(method)); }
From source file:net.sf.cocmvc.ConventionalHandlerMapping.java
private RequestMappingInfo createConventionalControllerMapping(Class handlerType) { return new RequestMappingInfo(createPatternRequestCondition(buildConventionalControllerPaths(handlerType)), null, null, null, null, null, getCustomTypeCondition(handlerType)); }
From source file:net.sf.cocmvc.ConventionalHandlerMapping.java
private RequestMappingInfo createRequestMapping(RequestMapping annotation, RequestCondition<?> customCondition) { return new RequestMappingInfo(createPatternRequestCondition(annotation.value()), new RequestMethodsRequestCondition(annotation.method()), new ParamsRequestCondition(annotation.params()), new HeadersRequestCondition(annotation.headers()), new ConsumesRequestCondition(annotation.consumes(), annotation.headers()), new ProducesRequestCondition(annotation.produces(), annotation.headers()), customCondition); }
From source file:org.makersoft.mvc.method.annotation.RESTfulMappingHandlerMapping.java
/** * Created a RequestMappingInfo from a RequestMapping annotation. *///from w w w .j a v a 2 s . c o m private RequestMappingInfo createRequestMappingInfo(Method method, RESTfull annotation, Class<?> controllerClass) { Mapping mapping = RESTfulHelper.matchMapping(method.getName()); if (mapping != null) { PackageBasedUrlPathBuilder builder = new PackageBasedUrlPathBuilder(packageLocators, controllerPackages, controllerSuffix, root); String[] namespaceString = builder.buildUrlPath(controllerClass, mapping.getMethodName(), mapping.getValues()); if (namespaceString != null) { return new RequestMappingInfo( new PatternsRequestCondition(namespaceString, getUrlPathHelper(), getPathMatcher(), this.useSuffixPatternMatch, this.useTrailingSlashMatch), new RequestMethodsRequestCondition(mapping.getRequestMethods()), new ParamsRequestCondition(mapping.getParams()), new HeadersRequestCondition(mapping.getHeaders()), new ConsumesRequestCondition(mapping.getConsumes(), mapping.getHeaders()), new ProducesRequestCondition(mapping.getProduces(), mapping.getHeaders()), getCustomMethodCondition(method)); } } return null; }
From source file:org.springbyexample.mvc.method.annotation.ServiceHandlerMapping.java
/** * Register handler./*from w w w . j a va 2s .co m*/ */ private void registerHandler(Class<?> marshallingServiceClass, Method method) { ApplicationContext ctx = getApplicationContext(); RestResource restResource = AnnotationUtils.findAnnotation(marshallingServiceClass, RestResource.class); Class<?> serviceClass = restResource.service(); RestRequestResource restRequestResource = AnnotationUtils.findAnnotation(method, RestRequestResource.class); boolean export = (restRequestResource != null ? restRequestResource.export() : true); boolean relative = (restRequestResource != null ? restRequestResource.relative() : true); if (export) { Class<?> handlerServiceClass = serviceClass; String methodName = method.getName(); Class<?>[] paramTypes = method.getParameterTypes(); if (restRequestResource != null) { // explicit service specified if (restRequestResource.service() != ServiceValueConstants.DEFAULT_SERVICE_CLASS) { handlerServiceClass = restRequestResource.service(); } // explicit method name specified if (StringUtils.hasText(restRequestResource.methodName())) { methodName = restRequestResource.methodName(); } } Object handler = ctx.getBean(handlerServiceClass); Method serviceMethod = ClassUtils.getMethod(handlerServiceClass, methodName, paramTypes); RequestMappingInfo mapping = getMappingForMethod(method, marshallingServiceClass); if (relative) { List<String> patterns = new ArrayList<String>(); for (String pattern : mapping.getPatternsCondition().getPatterns()) { // add REST resource path prefix to URI, // if relative path is just '/' add an empty string patterns.add(restResource.path() + (!"/".equals(pattern) ? pattern : "")); } // create a new mapping based on the patterns (patterns are unmodifiable in existing RequestMappingInfo) mapping = new RequestMappingInfo( new PatternsRequestCondition(patterns.toArray(ArrayUtils.EMPTY_STRING_ARRAY), getUrlPathHelper(), getPathMatcher(), useSuffixPatternMatch(), useTrailingSlashMatch()), mapping.getMethodsCondition(), mapping.getParamsCondition(), mapping.getHeadersCondition(), mapping.getConsumesCondition(), mapping.getProducesCondition(), mapping.getCustomCondition()); } // need to set param types to use in createHandlerMethod before calling registerHandlerMethod restBridgedMethod = BridgeMethodResolver.findBridgedMethod(method); // mapping is key, HandlerMethod is value registerHandlerMethod(handler, serviceMethod, mapping); processConverters(restRequestResource, mapping, serviceMethod); } }