Exemplo n.º 1
0
  public void init(Constants constants, ServletContext servletContext) {
    this.constants = constants;
    RenderFactory.servletContext = servletContext;

    // init Render
    Render.init(constants.getEncoding(), constants.getDevMode());
    initFreeMarkerRender(servletContext);
    initVelocityRender(servletContext);
    initFileRender(servletContext);

    // create mainRenderFactory
    if (mainRenderFactory == null) {
      ViewType defaultViewType = constants.getViewType();
      if (defaultViewType == ViewType.FREE_MARKER)
        mainRenderFactory = new FreeMarkerRenderFactory();
      else if (defaultViewType == ViewType.JSP) mainRenderFactory = new JspRenderFactory();
      else if (defaultViewType == ViewType.VELOCITY)
        mainRenderFactory = new VelocityRenderFactory();
      else throw new RuntimeException("View Type can not be null.");
    }
  }