本文整理匯總了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";
}
示例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)
);
}
示例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)
);
}
示例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)
);
}
示例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));
}
示例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);
}
示例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();
}
}
示例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;
}
}
示例9: getFlashMap
import org.springframework.web.servlet.support.RequestContextUtils; //導入方法依賴的package包/類
public static Map<String, ?> getFlashMap() {
return RequestContextUtils.getInputFlashMap(getRequest());
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}