Example usage for org.springframework.web.servlet FlashMapManager saveOutputFlashMap

List of usage examples for org.springframework.web.servlet FlashMapManager saveOutputFlashMap

Introduction

In this page you can find the example usage for org.springframework.web.servlet FlashMapManager saveOutputFlashMap.

Prototype

void saveOutputFlashMap(FlashMap flashMap, HttpServletRequest request, HttpServletResponse response);

Source Link

Document

Save the given FlashMap, in some underlying storage and set the start of its expiration period.

Usage

From source file:org.sarons.spring4me.web.servlet.DispatcherServlet.java

private void prepareFlashMapForWidget(HttpServletRequest request, Object handler) {
    if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod = (HandlerMethod) handler;
        ////  w w w .  j  av  a  2  s.c  o  m
        Widget widget = AnnotationUtils.getAnnotation(handlerMethod.getBeanType(), Widget.class);
        if (widget != null) {
            //
            String widgetName = widget.value();
            if (!StringUtils.hasText(widgetName)) {
                String targetWidget = handlerMethod.getBeanType().getSimpleName();
                widgetName = StringUtils.uncapitalize(targetWidget);
            }
            //
            FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
            flashMap.setTargetRequestPath(widgetName);
            FlashMapManager flashMapManager = RequestContextUtils.getFlashMapManager(request);
            flashMapManager.saveOutputFlashMap(flashMap, request, null);
        }
    }
}