/** * Create a {@link RequestMappingInfo} from the supplied * {@link RequestMapping @RequestMapping} annotation, which is either * a directly declared annotation, a meta-annotation, or the synthesized * result of merging annotation attributes within an annotation hierarchy. */ protected RequestMappingInfo createRequestMappingInfo( RequestMapping requestMapping, @Nullable RequestCondition<?> customCondition) { RequestMappingInfo.Builder builder = RequestMappingInfo .paths(resolveEmbeddedValuesInPatterns(requestMapping.path())) .methods(requestMapping.method()) .params(requestMapping.params()) .headers(requestMapping.headers()) .consumes(requestMapping.consumes()) .produces(requestMapping.produces()) .mappingName(requestMapping.name()); if (customCondition != null) { builder.customCondition(customCondition); } return builder.options(this.config).build(); }
/** * Create a {@link RequestMappingInfo} from the supplied * {@link RequestMapping @RequestMapping} annotation, which is either * a directly declared annotation, a meta-annotation, or the synthesized * result of merging annotation attributes within an annotation hierarchy. */ protected RequestMappingInfo createRequestMappingInfo( RequestMapping requestMapping, @Nullable RequestCondition<?> customCondition) { RequestMappingInfo.Builder builder = RequestMappingInfo .paths(resolveEmbeddedValuesInPatterns(requestMapping.path())) .methods(requestMapping.method()) .params(requestMapping.params()) .headers(requestMapping.headers()) .consumes(requestMapping.consumes()) .produces(requestMapping.produces()) .mappingName(requestMapping.name()); if (customCondition != null) { builder.customCondition(customCondition); } return builder.options(this.config).build(); }
@PostConstruct public void config() throws Exception, SecurityException { RequestMappingInfo info = RequestMappingInfo.paths("/test/hh/name").mappingName("mine").build(); mapping.registerMapping(info, new TestMvc(), TestMvc.class.getDeclaredMethod("testA", String.class)); System.out.println("===========xxxxxxxxxxxxxxxxxxxxxxxxxxx=============="); } //
.consumes(requestMapping.consumes()) .produces(requestMapping.produces()) .mappingName(requestMapping.name()) .customCondition(customCondition) .options(this.config)
private RequestMappingInfo createRequestMappingInfo(String codelessName, String action) { RequestMappingInfo.Builder builder = RequestMappingInfo .paths(resolveEmbeddedValuesInPatterns(new String[] {"/" + codelessName + "/" + action})); if ("add".equals(action)) { builder.methods(RequestMethod.POST); } if ("modify".equals(action)) { builder.methods(RequestMethod.PUT); } if ("delete".equals(action)) { builder.methods(RequestMethod.DELETE); } if ("get".equals(action) || Pattern.matches("list.*", action)) { builder.methods(RequestMethod.GET); } builder.mappingName("[" + codelessEntityMetadataMap.get(codelessName).getEntityClass().getSimpleName() + "] " + action + " mapping"); return builder.options(this.config).build(); }