@Test void preHandle() { String uri = PluginController.PLUGIN_URI_PREFIX + "test"; PluginController molgenisPlugin = createMolgenisPluginController(uri); HandlerMethod handlerMethod = mock(HandlerMethod.class); when(handlerMethod.getBean()).thenReturn(molgenisPlugin); PluginInterceptor molgenisPluginInterceptor = new PluginInterceptor(menuReaderService, permissionService); MockHttpServletRequest request = new MockHttpServletRequest(); assertTrue(molgenisPluginInterceptor.preHandle(request, null, handlerMethod)); assertEquals(uri, request.getAttribute(KEY_CONTEXT_URL)); }
@Override public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) { PluginController molgenisPlugin = validateHandler(handler); String contextUrl = (String) request.getAttribute(PluginAttributes.KEY_CONTEXT_URL); if (contextUrl == null) { request.setAttribute(PluginAttributes.KEY_CONTEXT_URL, molgenisPlugin.getUri()); } return true; }
PluginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) { PluginController molgenisPlugin = validateHandler(handler); String contextUrl = (String) request.getAttribute(PluginAttributes.KEY_CONTEXT_URL); if (contextUrl == null) { request.setAttribute(PluginAttributes.KEY_CONTEXT_URL, molgenisPlugin.getUri()); } return true; } }
PluginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) { PluginController molgenisPlugin = validateHandler(handler); String contextUrl = (String) request.getAttribute(PluginAttributes.KEY_CONTEXT_URL); if (contextUrl == null) { request.setAttribute(PluginAttributes.KEY_CONTEXT_URL, molgenisPlugin.getUri()); } return true; } PluginInterceptor(
      MenuReaderService menuReaderService, UserPermissionEvaluator permissionService); }
PluginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) { PluginController molgenisPlugin = validateHandler(handler); String contextUrl = (String) request.getAttribute(PluginAttributes.KEY_CONTEXT_URL); if (contextUrl == null) { request.setAttribute(PluginAttributes.KEY_CONTEXT_URL, molgenisPlugin.getUri()); } return true; } PluginInterceptor(
      MenuReaderService menuReaderService, UserPermissionEvaluator permissionService); @Override boolean preHandle(
      HttpServletRequest request, HttpServletResponse response, Object handler); @Transactional(readOnly = true) @Override void postHandle(
      HttpServletRequest request,
      HttpServletResponse response,
      Object handler,
      ModelAndView modelAndView); PluginController validateHandler(Object handler); }
PluginInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler) { PluginController molgenisPlugin = validateHandler(handler); String contextUrl = (String) request.getAttribute(PluginAttributes.KEY_CONTEXT_URL); if (contextUrl == null) { request.setAttribute(PluginAttributes.KEY_CONTEXT_URL, molgenisPlugin.getUri()); } return true; } PluginInterceptor(
      MenuReaderService menuReaderService, UserPermissionEvaluator permissionService); @Override boolean preHandle(
      HttpServletRequest request, HttpServletResponse response, Object handler); @Transactional(readOnly = true) @Override void postHandle(
      HttpServletRequest request,
      HttpServletResponse response,
      Object handler,
      ModelAndView modelAndView); PluginController validateHandler(Object handler);  }