1 24 package org.riotfamily.website.generic; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 import org.springframework.web.servlet.ModelAndView; 30 import org.springframework.web.servlet.mvc.AbstractController; 31 import org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator; 32 33 52 public class GenericViewController extends AbstractController { 53 54 private String viewName; 55 56 private String contentType; 57 58 59 63 public void setViewName(String viewName) { 64 this.viewName = viewName; 65 } 66 67 71 public String getViewName() { 72 return this.viewName; 73 } 74 75 79 public String getContentType() { 80 return this.contentType; 81 } 82 83 87 public void setContentType(String contentType) { 88 this.contentType = contentType; 89 } 90 91 92 98 protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) 99 throws Exception { 100 101 if (contentType != null) { 102 response.setContentType(contentType); 103 } 104 105 return new ModelAndView(getViewName()); 106 } 107 108 109 110 } 111 | Popular Tags |