Skip to content

Commit

Permalink
fix: 여러가지 RequestMethod에 대한 Handler 맵핑 처리 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
the9kim committed Sep 15, 2023
1 parent 7b607f3 commit 57f1a4c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ private void mapHandlerForAnnotatedController(Class<?> controller) {
private void mapHandlerForAnnotatedMethod(Method declaredMethod) {
if (declaredMethod.isAnnotationPresent(RequestMapping.class)) {
RequestMapping annotation = declaredMethod.getAnnotation(RequestMapping.class);
HandlerKey handlerKey = new HandlerKey(annotation.value(), annotation.method()[0]);
RequestMethod[] method = annotation.method();
mapHandlerForRequestMethods(declaredMethod, annotation, method);
}
}

private void mapHandlerForRequestMethods(Method declaredMethod, RequestMapping annotation, RequestMethod[] method) {
for (RequestMethod requestMethod : method) {
HandlerKey handlerKey = new HandlerKey(annotation.value(), requestMethod);
HandlerExecution handlerExecution = new HandlerExecution(declaredMethod);
handlerExecutions.put(handlerKey, handlerExecution);
}
Expand All @@ -54,7 +61,6 @@ private void mapHandlerForAnnotatedMethod(Method declaredMethod) {
public Object getHandler(final HttpServletRequest request) {
String requestURI = request.getRequestURI();
String method = request.getMethod();

return handlerExecutions.get(new HandlerKey(requestURI, RequestMethod.valueOf(method)));
}
}

0 comments on commit 57f1a4c

Please sign in to comment.