Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.github.edgarespina.mwa.view;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.util.List;
 import java.util.Map;
 
A org.springframework.web.servlet.handler.HandlerInterceptorAdapter that enabled model contributions.

Author(s):
edgar.espina
Since:
0.1.2
The logging system.
  private final Logger logger = LoggerFactory.getLogger(getClass());

  
The list of model contributions.
Creates a new ModelContributionInterceptor.

Parameters:
contributions The list of model contributions.
      final List<ModelContributioncontributions) {
    this. =
        checkNotNull(contributions"The contribution list is required.");
  }

  
  public void postHandle(final HttpServletRequest request,
      final HttpServletResponse responsefinal Object handler,
      final ModelAndView modelAndViewthrows Exception {
    if (modelAndView != null) {
      String viewName = modelAndView.getViewName();
      Map<StringObjectmodel = modelAndView.getModel();
      model.put(.request.getContextPath());
      model.put(.viewName);
      for (ModelContribution contribution : ) {
        .debug(
            "Adding contribution: {} to: {}, view: {}",
            new Object[] {contribution.getClass().getSimpleName(),
                request.getRequestURI(), viewName });
        contribution.contribute(requestresponsemodelAndView);
      }
    }
  }
New to GrepCode? Check out our FAQ X