Java Code Examples for org.springframework.web.servlet.support.RequestContextUtils

The following examples show how to use org.springframework.web.servlet.support.RequestContextUtils. These examples are extracted from open source projects. 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
private ModelAndView getModelAndView(ModelAndViewContainer mavContainer,
		ModelFactory modelFactory, NativeWebRequest webRequest) throws Exception {

	modelFactory.updateModel(webRequest, mavContainer);
	if (mavContainer.isRequestHandled()) {
		return null;
	}
	ModelMap model = mavContainer.getModel();
	ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model);
	if (!mavContainer.isViewReference()) {
		mav.setView((View) mavContainer.getView());
	}
	if (model instanceof RedirectAttributes) {
		Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
		HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
		RequestContextUtils.getOutputFlashMap(request).putAll(flashAttributes);
	}
	return mav;
}
 
Example 2
Source Project: wallride   Source File: CategoryRestController.java    License: Apache License 2.0 6 votes vote down vote up
@RequestMapping(value="/{language}/categories/{id}", method=RequestMethod.POST)
public @ResponseBody DomainObjectUpdatedModel update(
		@Valid CategoryEditForm form,
		BindingResult result,
		@PathVariable long id,
		AuthorizedUser authorizedUser,
		HttpServletRequest request,
		HttpServletResponse response) throws BindException {
	form.setId(id);
	if (result.hasErrors()) {
		throw new BindException(result);
	}
	Category category = categoryService.updateCategory(form.buildCategoryUpdateRequest(), authorizedUser);
	FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
	flashMap.put("updatedCategory", category);
	RequestContextUtils.getFlashMapManager(request).saveOutputFlashMap(flashMap, request, response);
	return new DomainObjectUpdatedModel<>(category);
}
 
Example 3
Source Project: spring-analysis-note   Source File: HttpEntityMethodProcessor.java    License: MIT License 6 votes vote down vote up
private void saveFlashAttributes(ModelAndViewContainer mav, NativeWebRequest request, String location) {
	mav.setRedirectModelScenario(true);
	ModelMap model = mav.getModel();
	if (model instanceof RedirectAttributes) {
		Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
		if (!CollectionUtils.isEmpty(flashAttributes)) {
			HttpServletRequest req = request.getNativeRequest(HttpServletRequest.class);
			HttpServletResponse res = request.getNativeResponse(HttpServletResponse.class);
			if (req != null) {
				RequestContextUtils.getOutputFlashMap(req).putAll(flashAttributes);
				if (res != null) {
					RequestContextUtils.saveOutputFlashMap(location, req, res);
				}
			}
		}
	}
}
 
Example 4
Source Project: spring-analysis-note   Source File: PrintingResultHandler.java    License: MIT License 6 votes vote down vote up
/**
 * Print {@link MvcResult} details.
 */
@Override
public final void handle(MvcResult result) throws Exception {
	this.printer.printHeading("MockHttpServletRequest");
	printRequest(result.getRequest());

	this.printer.printHeading("Handler");
	printHandler(result.getHandler(), result.getInterceptors());

	this.printer.printHeading("Async");
	printAsyncResult(result);

	this.printer.printHeading("Resolved Exception");
	printResolvedException(result.getResolvedException());

	this.printer.printHeading("ModelAndView");
	printModelAndView(result.getModelAndView());

	this.printer.printHeading("FlashMap");
	printFlashMap(RequestContextUtils.getOutputFlashMap(result.getRequest()));

	this.printer.printHeading("MockHttpServletResponse");
	printResponse(result.getResponse());
}
 
Example 5
Source Project: Lottery   Source File: MessageResolver.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 获得国际化信息
 * 
 * @param request
 *            HttpServletRequest
 * @param code
 *            国际化代码
 * @param args
 *            替换参数
 * @return
 * @see org.springframework.context.MessageSource#getMessage(String,
 *      Object[], Locale)
 */
public static String getMessage(HttpServletRequest request, String code,
		Object... args) {
	WebApplicationContext messageSource = RequestContextUtils
			.getWebApplicationContext(request);
	if (messageSource == null) {
		throw new IllegalStateException("WebApplicationContext not found!");
	}
	LocaleResolver localeResolver = RequestContextUtils
			.getLocaleResolver(request);
	Locale locale;
	if (localeResolver != null) {
		locale = localeResolver.resolveLocale(request);
	} else {
		locale = request.getLocale();
	}
	return messageSource.getMessage(code, args, locale);
}
 
Example 6
Source Project: springboot-learn   Source File: HelloController.java    License: MIT License 6 votes vote down vote up
@GetMapping(value = "/message")
@ResponseBody
public String message(HttpServletRequest request) {
    //获取当前的本地区域信息
    Locale locale = LocaleContextHolder.getLocale();
    //或者
    Locale locale1 = RequestContextUtils.getLocale(request);

    Locale aDefault = Locale.getDefault();

    //不能使用Locale.ENGLISH
    Locale english = Locale.US;
    //不能Locale.CHINESE
    Locale chinese = Locale.CHINA;

    //其中第二个参数为占位符数据
    String welcome = messageSource.getMessage("welcome", null, english);
    String hello = messageSource.getMessage("hello", new String[]{"i18n"}, english);

    String welcome1 = messagesUtil.getMessage("welcome", chinese);
    String hello1 = messagesUtil.getMessage("hello", new String[]{"i18n"}, chinese);
    System.out.println(hello1 + welcome1);

    return hello + welcome;
}
 
Example 7
Source Project: wallride   Source File: CategoryRestController.java    License: Apache License 2.0 6 votes vote down vote up
@RequestMapping(value="/{language}/categories", method=RequestMethod.POST)
public @ResponseBody DomainObjectSavedModel save(
		@Valid CategoryCreateForm form,
		BindingResult result,
		AuthorizedUser authorizedUser,
		HttpServletRequest request,
		HttpServletResponse response) throws BindException {
	if (result.hasErrors()) {
		throw new BindException(result);
	}
	Category category = categoryService.createCategory(form.buildCategoryCreateRequest(), authorizedUser);
	FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
	flashMap.put("savedCategory", category);
	RequestContextUtils.getFlashMapManager(request).saveOutputFlashMap(flashMap, request, response);
	return new DomainObjectSavedModel<>(category);
}
 
Example 8
Source Project: java-technology-stack   Source File: RedirectView.java    License: MIT License 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 9
Source Project: java-technology-stack   Source File: HttpEntityMethodProcessor.java    License: MIT License 6 votes vote down vote up
private void saveFlashAttributes(ModelAndViewContainer mav, NativeWebRequest request, String location) {
	mav.setRedirectModelScenario(true);
	ModelMap model = mav.getModel();
	if (model instanceof RedirectAttributes) {
		Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
		if (!CollectionUtils.isEmpty(flashAttributes)) {
			HttpServletRequest req = request.getNativeRequest(HttpServletRequest.class);
			HttpServletResponse res = request.getNativeResponse(HttpServletResponse.class);
			if (req != null) {
				RequestContextUtils.getOutputFlashMap(req).putAll(flashAttributes);
				if (res != null) {
					RequestContextUtils.saveOutputFlashMap(location, req, res);
				}
			}
		}
	}
}
 
Example 10
Source Project: spring4-understanding   Source File: RedirectView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 11
Source Project: java-technology-stack   Source File: PrintingResultHandler.java    License: MIT License 6 votes vote down vote up
/**
 * Print {@link MvcResult} details.
 */
@Override
public final void handle(MvcResult result) throws Exception {
	this.printer.printHeading("MockHttpServletRequest");
	printRequest(result.getRequest());

	this.printer.printHeading("Handler");
	printHandler(result.getHandler(), result.getInterceptors());

	this.printer.printHeading("Async");
	printAsyncResult(result);

	this.printer.printHeading("Resolved Exception");
	printResolvedException(result.getResolvedException());

	this.printer.printHeading("ModelAndView");
	printModelAndView(result.getModelAndView());

	this.printer.printHeading("FlashMap");
	printFlashMap(RequestContextUtils.getOutputFlashMap(result.getRequest()));

	this.printer.printHeading("MockHttpServletResponse");
	printResponse(result.getResponse());
}
 
Example 12
Source Project: spring4-understanding   Source File: RedirectView.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Convert model to request parameters and redirect to the given URL.
 * @see #appendQueryProperties
 * @see #sendRedirect
 */
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws IOException {

	String targetUrl = createTargetUrl(model, request);
	targetUrl = updateTargetUrl(targetUrl, model, request, response);

	FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
	if (!CollectionUtils.isEmpty(flashMap)) {
		UriComponents uriComponents = UriComponentsBuilder.fromUriString(targetUrl).build();
		flashMap.setTargetRequestPath(uriComponents.getPath());
		flashMap.addTargetRequestParams(uriComponents.getQueryParams());
		FlashMapManager flashMapManager = RequestContextUtils.getFlashMapManager(request);
		if (flashMapManager == null) {
			throw new IllegalStateException("FlashMapManager not found despite output FlashMap having been set");
		}
		flashMapManager.saveOutputFlashMap(flashMap, request, response);
	}

	sendRedirect(request, response, targetUrl, this.http10Compatible);
}
 
Example 13
Source Project: lams   Source File: RedirectView.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Find the registered {@link RequestDataValueProcessor}, if any, and allow
 * it to update the redirect target URL.
 * @param targetUrl the given redirect URL
 * @return the updated URL or the same as URL as the one passed in
 */
protected String updateTargetUrl(String targetUrl, Map<String, Object> model,
		HttpServletRequest request, HttpServletResponse response) {

	WebApplicationContext wac = getWebApplicationContext();
	if (wac == null) {
		wac = RequestContextUtils.findWebApplicationContext(request, getServletContext());
	}

	if (wac != null && wac.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) {
		RequestDataValueProcessor processor = wac.getBean(
				RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class);
		return processor.processUrl(request, targetUrl);
	}

	return targetUrl;
}
 
Example 14
private ModelAndView getModelAndView(ModelAndViewContainer mavContainer,
		ModelFactory modelFactory, NativeWebRequest webRequest) throws Exception {

	modelFactory.updateModel(webRequest, mavContainer);
	if (mavContainer.isRequestHandled()) {
		return null;
	}
	ModelMap model = mavContainer.getModel();
	ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model, mavContainer.getStatus());
	if (!mavContainer.isViewReference()) {
		mav.setView((View) mavContainer.getView());
	}
	if (model instanceof RedirectAttributes) {
		Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
		HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
		RequestContextUtils.getOutputFlashMap(request).putAll(flashAttributes);
	}
	return mav;
}
 
Example 15
@GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
    Map<String, Object> map = new HashMap<>();

    List<TransferStatus> streamStatuses = statusService.getAllStreamStatuses();
    List<TransferStatus> downloadStatuses = statusService.getAllDownloadStatuses();
    List<TransferStatus> uploadStatuses = statusService.getAllUploadStatuses();

    Locale locale = RequestContextUtils.getLocale(request);
    List<TransferStatusHolder> transferStatuses = new ArrayList<>();

    for (int i = 0; i < streamStatuses.size(); i++) {
        long minutesAgo = streamStatuses.get(i).getMillisSinceLastUpdate() / 1000L / 60L;
        if (minutesAgo < 60L) {
            transferStatuses.add(new TransferStatusHolder(streamStatuses.get(i), true, false, false, i, locale));
        }
    }
    for (int i = 0; i < downloadStatuses.size(); i++) {
        transferStatuses.add(new TransferStatusHolder(downloadStatuses.get(i), false, true, false, i, locale));
    }
    for (int i = 0; i < uploadStatuses.size(); i++) {
        transferStatuses.add(new TransferStatusHolder(uploadStatuses.get(i), false, false, true, i, locale));
    }

    map.put("transferStatuses", transferStatuses);
    map.put("chartWidth", StatusChartController.IMAGE_WIDTH);
    map.put("chartHeight", StatusChartController.IMAGE_HEIGHT);

    return new ModelAndView("status","model",map);
}
 
Example 16
Source Project: spring-analysis-note   Source File: TilesView.java    License: MIT License 5 votes vote down vote up
/**
 * Create a Tiles {@link Request}.
 * <p>This implementation creates a {@link ServletRequest}.
 * @param request the current request
 * @param response the current response
 * @return the Tiles request
 */
protected Request createTilesRequest(final HttpServletRequest request, HttpServletResponse response) {
	return new ServletRequest(this.applicationContext, request, response) {
		@Override
		public Locale getRequestLocale() {
			return RequestContextUtils.getLocale(request);
		}
	};
}
 
Example 17
Source Project: spring-analysis-note   Source File: SpringLocaleResolver.java    License: MIT License 5 votes vote down vote up
@Override
public Locale resolveLocale(Request request) {
	try {
		HttpServletRequest servletRequest = ServletUtil.getServletRequest(request).getRequest();
		if (servletRequest != null) {
			return RequestContextUtils.getLocale(servletRequest);
		}
	}
	catch (NotAServletEnvironmentException ex) {
		// ignore
	}
	return super.resolveLocale(request);
}
 
Example 18
Source Project: spring-analysis-note   Source File: RedirectView.java    License: MIT License 5 votes vote down vote up
/**
 * Convert model to request parameters and redirect to the given URL.
 * @see #appendQueryProperties
 * @see #sendRedirect
 */
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws IOException {

	String targetUrl = createTargetUrl(model, request);
	targetUrl = updateTargetUrl(targetUrl, model, request, response);

	// Save flash attributes
	RequestContextUtils.saveOutputFlashMap(targetUrl, request, response);

	// Redirect
	sendRedirect(request, response, targetUrl, this.http10Compatible);
}
 
Example 19
/**
 * Return a ModelAndView object with the specified view name.
 * <p>The content of the {@link RequestContextUtils#getInputFlashMap
 * "input" FlashMap} is also added to the model.
 * @see #getViewName()
 */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
		throws Exception {

	String viewName = getViewName();

	if (getStatusCode() != null) {
		if (getStatusCode().is3xxRedirection()) {
			request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, getStatusCode());
		}
		else {
			response.setStatus(getStatusCode().value());
			if (getStatusCode().equals(HttpStatus.NO_CONTENT) && viewName == null) {
				return null;
			}
		}
	}

	if (isStatusOnly()) {
		return null;
	}

	ModelAndView modelAndView = new ModelAndView();
	modelAndView.addAllObjects(RequestContextUtils.getInputFlashMap(request));
	if (viewName != null) {
		modelAndView.setViewName(viewName);
	}
	else {
		modelAndView.setView(getView());
	}
	return modelAndView;
}
 
Example 20
Source Project: sinavi-jfw   Source File: JseErrorsTagTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void エラーメッセージがフラッシュスコープにセットされ出力される() throws Exception {

    MessageContext context = new MessageContext(request);
    context.saveErrorMessageToFlash("E-JX_ERRORS_TAG_TEST#0001");
    FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
    request.setAttribute(MessageContext.ERROR_MESSAGE_KEY_TO_FLASH, flashMap.get(MessageContext.ERROR_MESSAGE_KEY_TO_FLASH));
    JseErrorsTag tag = new JseErrorsTag();
    tag.setJspContext(page);
    tag.doTag();

    assertThat(response.getContentAsString(), is("<div class=\"jfw_messages\">"
        + "<p class=\"jfw_err_msg_style\">E-JX_ERRORS_TAG_TEST#0001</p></div>"));
}
 
Example 21
/**
 * FlashMapに値を書き出します。
 * 
 * @param request
 * @param response
 * @param attr
 * @param value
 */
protected void outputFlashMap(HttpServletRequest request, HttpServletResponse response, String attr, String value) {
    val flashMap = RequestContextUtils.getOutputFlashMap(request);
    flashMap.put(attr, value);

    // flashMapを書き込む
    val flashManager = RequestContextUtils.getFlashMapManager(request);
    flashManager.saveOutputFlashMap(flashMap, request, response);
}
 
Example 22
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws ServletException {

	String newTheme = request.getParameter(this.paramName);
	if (newTheme != null) {
		ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(request);
		if (themeResolver == null) {
			throw new IllegalStateException("No ThemeResolver found: not in a DispatcherServlet request?");
		}
		themeResolver.setThemeName(request, response, newTheme);
	}
	// Proceed in any case.
	return true;
}
 
Example 23
Source Project: spring-analysis-note   Source File: LocaleChangeInterceptor.java    License: MIT License 5 votes vote down vote up
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws ServletException {

	String newLocale = request.getParameter(getParamName());
	if (newLocale != null) {
		if (checkHttpMethod(request.getMethod())) {
			LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
			if (localeResolver == null) {
				throw new IllegalStateException(
						"No LocaleResolver found: not in a DispatcherServlet request?");
			}
			try {
				localeResolver.setLocale(request, response, parseLocaleValue(newLocale));
			}
			catch (IllegalArgumentException ex) {
				if (isIgnoreInvalidLocale()) {
					if (logger.isDebugEnabled()) {
						logger.debug("Ignoring invalid locale value [" + newLocale + "]: " + ex.getMessage());
					}
				}
				else {
					throw ex;
				}
			}
		}
	}
	// Proceed in any case.
	return true;
}
 
Example 24
Source Project: sinavi-jfw   Source File: MessageContext.java    License: 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 25
Source Project: Milkomeda   Source File: I18nMessages.java    License: MIT License 5 votes vote down vote up
/**
 * 设置固定的Locale
 * @param locale    Locale
 */
public void setFixedLocale(Locale locale) {
    LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(WebContext.getRequest());
    if (localeResolver == null) {
        throw new IllegalStateException(
                "No LocaleResolver found: not in a DispatcherServlet request?");
    }
    localeResolver.setLocale(WebContext.getRequest(), WebContext.getRequestAttributes().getResponse(), locale);
}
 
Example 26
private StrutsPopups initializePopups(ModelMap model, HttpServletRequest request) {
    StrutsPopups popups = StrutsPopups.get(model);

    if (popups == null) {
        popups = new StrutsPopups();

        StrutsPopups.put(model, popups);
    }
    StrutsPopups.put(RequestContextUtils.getOutputFlashMap(request), popups);

    return popups;
}
 
Example 27
@Override
public Locale resolveLocale(TilesRequestContext context) {
	if (context instanceof JspTilesRequestContext) {
		PageContext pc = ((JspTilesRequestContext) context).getPageContext();
		return RequestContextUtils.getLocale((HttpServletRequest) pc.getRequest());
	}
	else if (context instanceof ServletTilesRequestContext) {
		HttpServletRequest request = ((ServletTilesRequestContext) context).getRequest();
		if (request != null) {
			return RequestContextUtils.getLocale(request);
		}
	}
	return super.resolveLocale(context);
}
 
Example 28
Source Project: java-technology-stack   Source File: TilesView.java    License: MIT License 5 votes vote down vote up
/**
 * Create a Tiles {@link Request}.
 * <p>This implementation creates a {@link ServletRequest}.
 * @param request the current request
 * @param response the current response
 * @return the Tiles request
 */
protected Request createTilesRequest(final HttpServletRequest request, HttpServletResponse response) {
	return new ServletRequest(this.applicationContext, request, response) {
		@Override
		public Locale getRequestLocale() {
			return RequestContextUtils.getLocale(request);
		}
	};
}
 
Example 29
Source Project: sinavi-jfw   Source File: JseErrorsTagTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void インフォメーションメッセージがフラッシュスコープにセットされ出力されない() throws Exception {

    MessageContext context = new MessageContext(request);
    context.saveInformationMessageToFlash("I-JX_INFORMATIONS_TAG_TEST#0001");
    FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request);
    request.setAttribute(MessageContext.INFORMATION_MESSAGE_KEY_TO_FLASH, flashMap.get(MessageContext.INFORMATION_MESSAGE_KEY_TO_FLASH));
    JseErrorsTag tag = new JseErrorsTag();
    tag.setJspContext(page);
    tag.doTag();

    assertThat(response.getContentAsString(), is(""));
}
 
Example 30
Source Project: java-technology-stack   Source File: AbstractUrlViewController.java    License: MIT License 5 votes vote down vote up
/**
 * 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 viewName = getViewNameForRequest(request);
	if (logger.isTraceEnabled()) {
		logger.trace("Returning view name '" + viewName + "'");
	}
	return new ModelAndView(viewName, RequestContextUtils.getInputFlashMap(request));
}