List of usage examples for org.springframework.web.servlet.view RedirectView RedirectView
public RedirectView(String url, boolean contextRelative, boolean http10Compatible)
From source file:com.fengduo.bee.commons.velocity.CustomVelocityLayoutViewResolver.java
/** * ?forward<br>//from w ww. j a va 2 s .com * springMVCforwardmodel?requestAttribute,<br> * velocity???attribute,??model * * @see org.springframework.web.servlet.view.UrlBasedViewResolver#createView(java.lang.String, java.util.Locale) */ protected View createView(String viewName, Locale locale) throws Exception { // If this resolver is not supposed to handle the given view, // return null to pass on to the next resolver in the chain. if (!canHandle(viewName, locale)) { return null; } // Check for special "redirect:" prefix. if (viewName.startsWith(REDIRECT_URL_PREFIX)) { String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length()); return new RedirectView(redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible()); } // Check for special "forward:" prefix. if (viewName.startsWith(FORWARD_URL_PREFIX)) { String forwardUrl = viewName.substring(FORWARD_URL_PREFIX.length()); return new ForwardView(forwardUrl); } // Else fall back to superclass implementation: calling loadView. return super.createView(viewName, locale); }
From source file:uk.co.postoffice.spike.esi.helloworld.ThymeleafMasterLayoutViewResolver.java
/** * Performs a Broadleaf AJAX redirect. This is used in conjunction with BLC.js to support * doing a browser page change as as result of an AJAX call. * * @param redirectUrl//from w w w. j a v a 2 s . c o m * @param locale * @return * @throws Exception */ protected View loadAjaxRedirectView(String redirectUrl, final Locale locale) throws Exception { if (isAjaxRequest()) { // TODO /* // utility/blcRedirect.html <div id="blc-redirect-url" class="hidden" th:text="${blc_redirect}" th:if="${!#strings.isEmpty(blc_redirect)}"></div> */ // String viewName = "utility/blcRedirect"; // addStaticVariable("blc_redirect", redirectUrl); // return super.loadView(viewName, locale); return new RedirectView(redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible()); } else { return new RedirectView(redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible()); } }