/** * Constructor for use as a bean. */ public RedirectView() { setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * <p>The given URL will be considered as relative to the web server, * not as relative to the current ServletContext. * @param url the URL to redirect to * @see #RedirectView(String, boolean) */ public RedirectView(String url) { super(url); setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext */ public RedirectView(String url, boolean contextRelative) { super(url); this.contextRelative = contextRelative; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients * @param exposeModelAttributes whether or not model attributes should be * exposed as query parameters */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible, boolean exposeModelAttributes) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; this.exposeModelAttributes = exposeModelAttributes; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext */ public RedirectView(String url, boolean contextRelative) { super(url); this.contextRelative = contextRelative; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * <p>The given URL will be considered as relative to the web server, * not as relative to the current ServletContext. * @param url the URL to redirect to * @see #RedirectView(String, boolean) */ public RedirectView(String url) { super(url); setExposePathVariables(false); }
/** * Constructor for use as a bean. */ public RedirectView() { setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients * @param exposeModelAttributes whether or not model attributes should be * exposed as query parameters */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible, boolean exposeModelAttributes) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; this.exposeModelAttributes = exposeModelAttributes; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * <p>The given URL will be considered as relative to the web server, * not as relative to the current ServletContext. * @param url the URL to redirect to * @see #RedirectView(String, boolean) */ public RedirectView(String url) { super(url); setExposePathVariables(false); }
/** * Constructor for use as a bean. */ public RedirectView() { setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext */ public RedirectView(String url, boolean contextRelative) { super(url); this.contextRelative = contextRelative; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; setExposePathVariables(false); }
/** * Create a new RedirectView with the given URL. * @param url the URL to redirect to * @param contextRelative whether to interpret the given URL as * relative to the current ServletContext * @param http10Compatible whether to stay compatible with HTTP 1.0 clients * @param exposeModelAttributes whether or not model attributes should be * exposed as query parameters */ public RedirectView(String url, boolean contextRelative, boolean http10Compatible, boolean exposeModelAttributes) { super(url); this.contextRelative = contextRelative; this.http10Compatible = http10Compatible; this.exposeModelAttributes = exposeModelAttributes; setExposePathVariables(false); }
public ModelAndView redirectToSomewhere() { RedirectView redirectView = new RedirectView("/my/form/newpage.html?pid=".concat(myform.getId().toString()); redirectView.setExposeModelAttributes(false); // these redirectView.setExposePathVariables(false); //two depend on the way you set your variables return new ModelAndView(redirectView); }
@Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) { if (modelAndView != null && StringUtils.isNotBlank(request.getQueryString()) && request.getQueryString().contains(CasProtocolConstants.PARAMETER_TICKET)) { val v = new RedirectView(request.getRequestURL().toString()); v.setExposeModelAttributes(false); v.setExposePathVariables(false); modelAndView.setView(v); } } }
@Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) { if (!StringUtils.isEmpty(request.getQueryString()) && request.getQueryString().contains(CasProtocolConstants.PARAMETER_TICKET)) { val view = new RedirectView(request.getRequestURL().toString()); view.setExposeModelAttributes(false); view.setExposePathVariables(false); modelAndView.setView(view); } }
private Object resolveZone(HttpServletRequest request, String decodedRawZone, Function<ZoneInfo, ModelAndView> onZoneInfo) { // note that decodedRawZone already do http url decode, and PathVariable already trim() // space of value return Zone.tryFallback(decodedRawZone).map(zone -> { if (!zone.value().equals(decodedRawZone)) { String orgUrl = request.getRequestURL().toString(); // replace pattern is combine of fallback pattern and valid pattern // TODO refactor replace rule to Zone String location = orgUrl.replaceFirst("/z/[a-zA-Z0-9_\\-]+", "/z/" + zone); //check if fallback success, this prevent infinite redirect loop if (!location.equals(orgUrl)) { RedirectView redirectView = new RedirectView(location); redirectView.setPropagateQueryParams(true); redirectView.setExpandUriTemplateVariables(false); redirectView.setExposeModelAttributes(false); redirectView.setExposeContextBeansAsAttributes(false); redirectView.setExposePathVariables(false); redirectView.setContextRelative(true); redirectView.setStatusCode(HttpStatus.PERMANENT_REDIRECT); return redirectView; } } return onZoneInfo.apply(zoneService.loadZone(zone)); }).orElseThrow(() -> new EmptyResultDataAccessException("no such zone: " + decodedRawZone, 1)); }
@GetMapping("/{appName}/**") @Nullable public ModelAndView serveApp( @PathVariable String appName, Model model, HttpServletRequest request, HttpServletResponse response) throws IOException { PluginIdentity pluginIdentity = new PluginIdentity(APP_PREFIX + appName); if (!userPermissionEvaluator.hasPermission(pluginIdentity, VIEW_PLUGIN)) { throw new PluginPermissionDeniedException(appName, VIEW_PLUGIN); } String wildCardPath = extractWildcardPath(request, appName); if (wildCardPath.isEmpty()) { RedirectView redirectView = new RedirectView(findAppMenuURL(appName)); redirectView.setExposePathVariables(false); return new ModelAndView(redirectView); } AppResponse appResponse = appManagerService.getAppByName(appName); if (!appResponse.getIsActive()) { throw new AppIsInactiveException(appName); } else if (isResourceRequest(wildCardPath)) { // Copies resource to response and returns null to short circuit the template filter serveAppResource(response, wildCardPath, appResponse); return null; } else { return serveAppTemplate(appName, model, appResponse); } }