1 16 17 package org.springframework.web.servlet.view; 18 19 33 public class AbstractTemplateViewResolver extends UrlBasedViewResolver { 34 35 private boolean exposeRequestAttributes = false; 36 37 private boolean exposeSessionAttributes = false; 38 39 private boolean exposeSpringMacroHelpers = false; 40 41 private boolean allowRequestOverride = false; 42 43 private boolean allowSessionOverride = false; 44 45 46 protected Class requiredViewClass() { 47 return AbstractTemplateView.class; 48 } 49 50 55 public void setExposeRequestAttributes(boolean exposeRequestAttributes) { 56 this.exposeRequestAttributes = exposeRequestAttributes; 57 } 58 59 64 public void setExposeSessionAttributes(boolean exposeSessionAttributes) { 65 this.exposeSessionAttributes = exposeSessionAttributes; 66 } 67 68 73 public void setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers) { 74 this.exposeSpringMacroHelpers = exposeSpringMacroHelpers; 75 } 76 77 84 public void setAllowRequestOverride(boolean allowRequestOverride) { 85 this.allowRequestOverride = allowRequestOverride; 86 } 87 88 95 public void setAllowSessionOverride(boolean allowSessionOverride) { 96 this.allowSessionOverride = allowSessionOverride; 97 } 98 99 100 protected AbstractUrlBasedView buildView(String viewName) throws Exception { 101 AbstractTemplateView view = (AbstractTemplateView) super.buildView(viewName); 102 view.setExposeRequestAttributes(this.exposeRequestAttributes); 103 view.setExposeSessionAttributes(this.exposeSessionAttributes); 104 view.setExposeSpringMacroHelpers(this.exposeSpringMacroHelpers); 105 view.setAllowRequestOverride(this.allowRequestOverride); 106 view.setAllowSessionOverride(this.allowSessionOverride); 107 return view; 108 } 109 110 } 111 | Popular Tags |