Java Code Examples for org.springframework.web.servlet.FlashMap#get()

The following examples show how to use org.springframework.web.servlet.FlashMap#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageContext.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
private void clearForFlash(String key, String code, MessageType type) {
    FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
    Messages messages = (Messages) flashMap.get(key);
    if (messages == null) return;
    
    if (Strings.isEmpty(code)) {
        flashMap.remove(key);
    } else {
        messages.remove(code);
        flashMap.put(key, messages);
    }
}
 
Example 2
Source File: MessageContextTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
private List<String> getMessageFromFlash(String key) {
    FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
    Messages messages = (Messages) flashMap.get(key);
    if (messages != null && !messages.isEmpty())
        return messages.getMessageList();

    return null;
}
 
Example 3
Source File: JseMessagesTag.java    From sinavi-jfw with Apache License 2.0 2 votes vote down vote up
/**
 * フラッシュスコープに格納されているメッセージを取得します。
 * @param messageKey キー({@link MessageContext#messageKeys})
 * @return メッセージ
 * @throws IOException 予期しないIO例外
 * @throws JspException 予期しないIO例外
 */
protected Messages extractMessagesAsListByFlash(String messageKey) throws IOException, JspException {
    FlashMap flash = (FlashMap) getJspContext().getAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, PageContext.REQUEST_SCOPE);
    Messages messages = (Messages) flash.get(messageKey);
    return messages;
}