Пример #1
0
  public Object call(
      String cfcPath,
      String id,
      String functionName,
      Struct arguments,
      boolean cfcPeristent,
      Object defaultValue)
      throws PageException {
    DevNullOutputStream os = DevNullOutputStream.DEV_NULL_OUTPUT_STREAM;
    String requestURI = toRequestURI(cfcPath);

    PageContext oldPC = ThreadLocalPageContext.get();
    PageContextImpl pc =
        ThreadUtil.createPageContext(
            config, os, "localhost", requestURI, "", null, null, null, null);
    pc.setRequestTimeout(999999999999999999L);
    try {
      ThreadLocalPageContext.register(pc);
      Component cfc = getCFC(pc, requestURI, cfcPath, id, cfcPeristent);
      if (cfc.containsKey(functionName)) {
        return cfc.callWithNamedValues(pc, functionName, arguments);
      }
    } finally {
      CFMLFactory factory = config.getFactory();
      factory.releasePageContext(pc);
      ThreadLocalPageContext.register(oldPC);
    }
    return defaultValue;
  }
Пример #2
0
  public Object getComponent(String cfcPath, String id) throws PageException {
    DevNullOutputStream os = DevNullOutputStream.DEV_NULL_OUTPUT_STREAM;
    String requestURI = toRequestURI(cfcPath);

    PageContext oldPC = ThreadLocalPageContext.get();
    PageContextImpl pc =
        ThreadUtil.createPageContext(
            config, os, "localhost", requestURI, "", null, null, null, null);
    pc.setRequestTimeout(999999999999999999L);

    try {
      ThreadLocalPageContext.register(pc);
      return getCFC(pc, requestURI, cfcPath, id, false);
    } finally {
      ThreadLocalPageContext.register(oldPC);
    }
  }
Пример #3
0
 public Caller(PageContext parent) {
   this.parent = parent;
   this.baos = new ByteArrayOutputStream();
   this.pc = ThreadUtil.clonePageContext(parent, baos, false, false, true);
 }