Guest User

Untitled

a guest
May 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static Object getControllerForAction(String actionURL) {
  2. ApplicationContext context = getApplicationContext();
  3. AnnotationHandlerMapping mapping = (AnnotationHandlerMapping) context.getBean("annotationMapper");
  4. PathMatcher pathMatcher = mapping.getPathMatcher();
  5. for (Object key: mapping.getHandlerMap().keySet()) {
  6. if (pathMatcher.match((String) key, actionURL)){
  7. return mapping.getHandlerMap().get(key);
  8. }
  9. }
  10. return null;
  11. }
  12.  
  13. ApplicationContext context = getApplicationContext();
  14. AnnotationHandlerMapping mapping = (AnnotationHandlerMapping) context.getBean("annotationMapper");
  15. Object controller = mapping.getHandler().getHandler();
Add Comment
Please, Sign In to add comment