1 24 package org.riotfamily.website.misc; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 import org.springframework.util.StringUtils; 30 import org.springframework.web.servlet.ModelAndView; 31 import org.springframework.web.servlet.mvc.Controller; 32 import org.springframework.web.servlet.view.RedirectView; 33 34 44 public class QuickjumpController implements Controller { 45 46 private String urlParameter = "url"; 47 48 public void setUrlParameter(String urlParameter) { 49 this.urlParameter = urlParameter; 50 } 51 52 public ModelAndView handleRequest(HttpServletRequest request, 53 HttpServletResponse response) throws Exception { 54 55 String url = request.getParameter(urlParameter); 56 if (StringUtils.hasLength(url) && !url.startsWith("#")) { 57 return new ModelAndView(new RedirectView(url)); 58 } 59 else { 60 response.sendError(HttpServletResponse.SC_NO_CONTENT); 61 return null; 62 } 63 } 64 } 65 | Popular Tags |