@Override protected Map getInParameters(HttpServletRequest request, Object handler, Method method) { String accessUri = URIUtil.getAccessUri(request); String methodUri = getMethodUri(handler, accessUri); String methodUriAndPar = method.getAnnotation(RequestMapping.class).value(); Map<String, String[]> parametersForRest = URIUtil.getParametersForRest(methodUri, methodUriAndPar); Map<String, String[]> parameters = request.getParameterMap(); parametersForRest.putAll(parameters); return parametersForRest; }
public static void main(String[] args) { String a="/as/gs/gsd"; String b="/as/gs"; System.out.println(URIUtil.sub(a, b)); String d="/aa/bb/cc/11"; String c="/aa/bb/cc/{dd}"; System.out.println(URIUtil.isMatchForRest(d, c)); System.out.println(URIUtil.getParametersForRest(d, c)); }
protected Method getMethod(Object handler, HttpServletRequest request) { String accessUri = URIUtil.getAccessUri(request); String methodUri = getMethodUri(handler, accessUri); Method[] methods = handler.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { String methodUriAndPar = methods[i].getAnnotation(RequestMapping.class).value(); if (URIUtil.isMatchForRest(methodUri, methodUriAndPar)) { return methods[i]; } } log.warn("The Controller of " + accessUri + "does not hava method of " + methodUri); return null; }