Esempio n. 1
0
  public Render createRender() {
    if (renderType == RenderType.FREE_MARKER_RENDER) return new FreeMarkerRender(view);
    else if (renderType == RenderType.JSP_RENDER) return new JspRender(view);
    else if (renderType == RenderType.VELOCITY_RENDER) return new VelocityRender(view);
    else if (renderType == RenderType.XML_RENDER) return new XmlRender(view);
    else if (renderType == RenderType.JSON_RENDER) {
      JsonRender jr;
      if (otherPara.get("jsonText") != null)
        jr = new JsonRender((String) otherPara.get("jsonText"));
      else if (otherPara.get("attrs") != null)
        jr = new JsonRender((String[]) otherPara.get("attrs"));
      else jr = new JsonRender();

      if (Boolean.TRUE.equals(otherPara.get("forIE"))) jr.forIE();

      return jr;
    }
    throw new IllegalArgumentException(
        "CacheInterceptor can not support the renderType of the value : " + renderType);
  }
Esempio n. 2
0
  public RenderInfo(Render render) {
    if (render == null) throw new IllegalArgumentException("Render can not be null.");

    view = render.getView();
    if (render instanceof FreeMarkerRender) renderType = RenderType.FREE_MARKER_RENDER;
    else if (render instanceof JspRender) renderType = RenderType.JSP_RENDER;
    else if (render instanceof VelocityRender) renderType = RenderType.VELOCITY_RENDER;
    else if (render instanceof XmlRender) renderType = RenderType.XML_RENDER;
    else if (render instanceof JsonRender) {
      JsonRender jr = (JsonRender) render;
      renderType = RenderType.JSON_RENDER;
      otherPara = new HashMap<String, Object>();
      otherPara.put("jsonText", jr.getJsonText());
      otherPara.put("attrs", jr.getAttrs());
      otherPara.put("forIE", jr.getForIE());
    } else
      throw new IllegalArgumentException(
          "CacheInterceptor can not support the render of the type : "
              + render.getClass().getName());
  }