类 AbstractTemplateView

java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
所有已实现的接口:
cn.taketoday.beans.factory.Aware, cn.taketoday.beans.factory.BeanNameAware, cn.taketoday.beans.factory.InitializingBean, cn.taketoday.context.ApplicationContextAware, View
直接已知子类:
FreeMarkerView, GroovyMarkupView

public abstract class AbstractTemplateView extends AbstractUrlBasedView
Adapter base class for template-based view technologies such as FreeMarker, with the ability to use request and session attributes in their model and the option to expose helper objects for Framework's FreeMarker macro library.

JSP/JSTL and other view technologies automatically have access to the HttpServletRequest object and thereby the request/session attributes for the current user. Furthermore, they are able to create and cache helper objects as request attributes themselves.

作者:
Juergen Hoeller, Darren Davison
另请参阅:
  • 字段详细资料

    • exposeRequestAttributes

      private boolean exposeRequestAttributes
    • allowRequestOverride

      private boolean allowRequestOverride
    • exposeSessionAttributes

      private boolean exposeSessionAttributes
    • allowSessionOverride

      private boolean allowSessionOverride
  • 构造器详细资料

    • AbstractTemplateView

      public AbstractTemplateView()
  • 方法详细资料

    • setExposeRequestAttributes

      public void setExposeRequestAttributes(boolean exposeRequestAttributes)
      Set whether all request attributes should be added to the model prior to merging with the template. Default is "false".

      Note that some templates may make request attributes visible on their own, e.g. FreeMarker, without exposure in the MVC model.

    • setAllowRequestOverride

      public void setAllowRequestOverride(boolean allowRequestOverride)
      Set whether Request attributes are allowed to override (hide) controller generated model attributes of the same name. Default is "false" which causes an exception to be thrown if request attributes of the same name as model attributes are found.
    • setExposeSessionAttributes

      public void setExposeSessionAttributes(boolean exposeSessionAttributes)
      Set whether all HttpSession attributes should be added to the model prior to merging with the template. Default is "false".
    • setAllowSessionOverride

      public void setAllowSessionOverride(boolean allowSessionOverride)
      Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. Default is "false", which causes an exception to be thrown if session attributes of the same name as model attributes are found.
    • renderMergedOutputModel

      protected final void renderMergedOutputModel(Map<String,Object> model, RequestContext request) throws Exception
      从类复制的说明: AbstractView
      Subclasses must implement this method to actually render the view.

      The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.

      指定者:
      renderMergedOutputModel 在类中 AbstractView
      参数:
      model - combined output Map (never null), with dynamic values taking precedence over static attributes
      request - current HTTP request context
      抛出:
      Exception - if rendering failed
    • exposeSessionAttributes

      private void exposeSessionAttributes(Map<String,Object> model, RequestContext context)
    • applyContentType

      protected void applyContentType(RequestContext response)
      Apply this view's content type as specified in the "contentType" bean property to the given response.

      Only applies the view's contentType if no content type has been set on the response before. This allows handlers to override the default content type beforehand.

      参数:
      response - current HTTP response
      另请参阅:
    • renderMergedTemplateModel

      protected abstract void renderMergedTemplateModel(Map<String,Object> model, RequestContext context) throws Exception
      Subclasses must implement this method to actually render the view.
      参数:
      model - combined output Map, with request attributes and session attributes merged into it if required
      context - current HTTP request
      抛出:
      Exception - if rendering failed