當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestContextUtils.getInputFlashMap方法代碼示例

本文整理匯總了Java中org.springframework.web.servlet.support.RequestContextUtils.getInputFlashMap方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestContextUtils.getInputFlashMap方法的具體用法?Java RequestContextUtils.getInputFlashMap怎麽用?Java RequestContextUtils.getInputFlashMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.servlet.support.RequestContextUtils的用法示例。


在下文中一共展示了RequestContextUtils.getInputFlashMap方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: index

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
@RequestMapping
public String index(HttpServletRequest httpServletRequest, Model uiModel, @RequestParam(value = "type", required = false) String type) {
	Authentication auth = SecurityContextHolder.getContext().getAuthentication();
	String eppn = auth.getName();
	
   	if(uiModel.containsAttribute("type")){
       	Map<String, ?> flashInputMap = RequestContextUtils.getInputFlashMap(httpServletRequest);
       	if(flashInputMap.containsKey("type")){
       		type = (String) flashInputMap.get("type");
       	}	
   	}
   	if(type==null){
   		type="";
   	}
	uiModel.addAttribute("selectedType", type);
	ObjectMapper mapper = new ObjectMapper();
	String jsonStats = "";
	String jsonStatsRm = "";
	List<String> prefsStats = new ArrayList<>();
	List<String> prefsStatsRm = new ArrayList<>();
	try {
		if(preferencesService.getPrefs(eppn, KEY)!=null){
			prefsStats = Arrays.asList(preferencesService.getPrefs(eppn, KEY).getValue().split("\\s*,\\s*"));
		}
		jsonStats = mapper.writeValueAsString(prefsStats);
		if(preferencesService.getPrefs(eppn, KEYRM)!=null){
			prefsStatsRm = Arrays.asList(preferencesService.getPrefs(eppn, KEYRM).getValue().split("\\s*,\\s*"));
		}
		jsonStatsRm = mapper.writeValueAsString(prefsStatsRm);
		
	} catch (Exception e) {
		e.printStackTrace();
	}
	uiModel.addAttribute("prefs",jsonStats);
	uiModel.addAttribute("prefsRm",jsonStatsRm);
	uiModel.addAttribute("prefsRmList",prefsStatsRm);
	return "manager/stats";
}
 
開發者ID:EsupPortail,項目名稱:esup-sgc,代碼行數:39,代碼來源:StatsController.java

示例2: isNotifyModalPending

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Test if a modal is going to be opened when back to the view (usually after a redirect)
 * @param request
 * @return true if a modal is going to be opened
 * @deprecated Use YadaNotify instead
 */
@Deprecated 
public boolean isNotifyModalPending(HttpServletRequest request) {
	Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(request);
	return flashMap!=null && (
		flashMap.containsKey(KEY_NOTIFICATION_TITLE)
		|| flashMap.containsKey(KEY_NOTIFICATION_BODY)
		|| flashMap.containsKey(KEY_NOTIFICATION_SEVERITY)
		);
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:16,代碼來源:YadaWebUtil.java

示例3: isNotificationPending

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Test if a modal is going to be opened when back to the view (usually after a redirect)
 * @param request
 * @return true if a modal is going to be opened
 */
public boolean isNotificationPending(HttpServletRequest request) {
	Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(request);
	return flashMap!=null && (
		flashMap.containsKey(KEY_NOTIFICATION_TITLE)
		|| flashMap.containsKey(KEY_NOTIFICATION_BODY)
		|| flashMap.containsKey(KEY_NOTIFICATION_SEVERITY)
		);
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:14,代碼來源:YadaNotify.java

示例4: isNotifyModalPending

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Test if a modal is going to be opened when back to the view (usually after a redirect)
 * @param request
 * @return true if a modal is going to be opened
 */
@Deprecated
public static boolean isNotifyModalPending(HttpServletRequest request) {
	Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(request);
	return flashMap!=null && (
		flashMap.containsKey(KEY_NOTIFICATION_TITLE)
		|| flashMap.containsKey(KEY_NOTIFICATION_BODY)
		|| flashMap.containsKey(KEY_NOTIFICATION_SEVERITY)
		);
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:15,代碼來源:YadaNotify.java

示例5: handleRequestInternal

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Retrieves the URL path to use for lookup and delegates to
 * {@link #getViewNameForRequest}. Also adds the content of
 * {@link RequestContextUtils#getInputFlashMap} to the model.
 */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
	String lookupPath = getUrlPathHelper().getLookupPathForRequest(request);
	String viewName = getViewNameForRequest(request);
	if (logger.isDebugEnabled()) {
		logger.debug("Returning view name '" + viewName + "' for lookup path [" + lookupPath + "]");
	}
	return new ModelAndView(viewName, RequestContextUtils.getInputFlashMap(request));
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:15,代碼來源:AbstractUrlViewController.java

示例6: processMultiValueReturn

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Handles the return from a multi-value lookup, processing any select line values and invoking the
 * configured view helper service to create the lines for those values in the model collection.
 *
 * <p>There are two supported strategies for returning the selected lines. One, if the lookup view
 * and the caller are within the same application container, Springs input flash map is used. If however,
 * the lookup view is outside the caller, then just a standard request parameter is used.</p>
 *
 * @param form form instance containing the model data
 * @param request http request object being handled
 */
protected void processMultiValueReturn(final UifFormBase form, HttpServletRequest request) {
    final String lookupCollectionId = request.getParameter(UifParameters.LOOKUP_COLLECTION_ID);

    final String lookupCollectionName = request.getParameter(UifParameters.LOOKUP_COLLECTION_NAME);
    if (StringUtils.isBlank(lookupCollectionName)) {
        throw new RuntimeException("Lookup collection name is required for processing multi-value lookup results");
    }

    final String multiValueReturnFields = request.getParameter(UifParameters.MULIT_VALUE_RETURN_FILEDS);
    String selectedLineValuesParam = request.getParameter(UifParameters.SELECTED_LINE_VALUES);

    String flashMapSelectedLineValues = "";
    if (RequestContextUtils.getInputFlashMap(request) != null) {
        flashMapSelectedLineValues = (String) RequestContextUtils.getInputFlashMap(request).get(
                UifParameters.SELECTED_LINE_VALUES);
    }

    if (!StringUtils.isBlank(flashMapSelectedLineValues)) {
        selectedLineValuesParam = flashMapSelectedLineValues;
    }

    final String selectedLineValues = selectedLineValuesParam;

    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            // invoked view helper to populate the collection from lookup results
            ViewLifecycle.getHelper().processMultipleValueLookupResults(form, lookupCollectionId,
                    lookupCollectionName, multiValueReturnFields, selectedLineValues);
        }
    };

    ViewLifecycle.encapsulateLifecycle(form.getView(), form, form.getViewPostMetadata(), null, request, runnable);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:46,代碼來源:RefreshControllerServiceImpl.java

示例7: getRequestMessages

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private List<RequestMessage> getRequestMessages(HttpServletRequest request) {
    Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(request);
    if (flashMap != null) {
        return (List<RequestMessage>) flashMap.get(REQUEST_MESSAGES_KEY);
    } else {
        return Lists.newArrayList();
    }
}
 
開發者ID:solita,項目名稱:kansalaisaloite,代碼行數:10,代碼來源:BaseController.java

示例8: getResultInfo

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
protected String getResultInfo(HttpServletRequest request) {
    Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(request);
    if (flashMap != null) {
        return (String) flashMap.get(RESULT_INFO_KEY);
    } else {
        return null;
    }
}
 
開發者ID:solita,項目名稱:kansalaisaloite,代碼行數:9,代碼來源:TestDataController.java

示例9: getFlashMap

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
public static Map<String, ?> getFlashMap() {
    return RequestContextUtils.getInputFlashMap(getRequest());
}
 
開發者ID:thunderbird,項目名稱:pungwecms,代碼行數:4,代碼來源:Utils.java

示例10: getFlashAttribute

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
public static Object getFlashAttribute(String key) {
    Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(getRequest());
    return flashMap != null ? flashMap.get(key) : null;
}
 
開發者ID:thunderbird,項目名稱:pungwecms,代碼行數:5,代碼來源:Utils.java

示例11: containsFlashAttribute

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
public static boolean containsFlashAttribute(String key) {
    Map<String, ?> flashMap = RequestContextUtils.getInputFlashMap(getRequest());
    return flashMap == null ? false : flashMap.containsKey(key);
}
 
開發者ID:thunderbird,項目名稱:pungwecms,代碼行數:5,代碼來源:Utils.java

示例12: handleRequestInternal

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
/**
 * Return a ModelAndView object with the specified view name.
 * The content of {@link RequestContextUtils#getInputFlashMap} is also added to the model.
 * @see #getViewName()
 */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
		throws Exception {
	return new ModelAndView(getViewName(), RequestContextUtils.getInputFlashMap(request));
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:11,代碼來源:ParameterizableViewController.java

示例13: previousRequestFlashMap

import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
private Map<String, ?> previousRequestFlashMap() {
    final Map<String, ?> inputFlashMap = RequestContextUtils.getInputFlashMap(this.request);
    return inputFlashMap == null ? new HashMap<String, Object>() : inputFlashMap;
}
 
開發者ID:jeslopalo,項目名稱:flash-messages,代碼行數:5,代碼來源:FlashScopeStoreAccessor.java


注:本文中的org.springframework.web.servlet.support.RequestContextUtils.getInputFlashMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。