protected void _init(PageContext pc, Map<String, String> arguments) {
    this.pc = pc;

    // header
    HttpServletRequest req = pc.getHttpServletRequest();

    header = new StringBuffer();
    createHeader(header, "context-path", req.getContextPath());
    createHeader(header, "remote-user", req.getRemoteUser());
    createHeader(header, "remote-addr", req.getRemoteAddr());
    createHeader(header, "remote-host", req.getRemoteHost());
    createHeader(
        header,
        "script-name",
        StringUtil.emptyIfNull(req.getContextPath())
            + StringUtil.emptyIfNull(req.getServletPath()));
    createHeader(header, "server-name", req.getServerName());
    createHeader(header, "protocol", req.getProtocol());
    createHeader(header, "server-port", Caster.toString(req.getServerPort()));
    createHeader(
        header,
        "path-info",
        StringUtil.replace(
            StringUtil.emptyIfNull(req.getRequestURI()),
            StringUtil.emptyIfNull(req.getServletPath()),
            "",
            true));
    // createHeader(header,"path-translated",pc.getBasePageSource().getDisplayPath());
    createHeader(header, "query-string", req.getQueryString());
    createHeader(header, "unit", unitShortToString(unit));
    createHeader(header, "min-time-nano", min + "");

    content = new StringBuffer();

    // directory
    String strDirectory = arguments.get("directory");
    if (dir == null) {
      if (StringUtil.isEmpty(strDirectory)) {
        dir = getTemp(pc);
      } else {
        try {
          dir = ResourceUtil.toResourceNotExisting(pc, strDirectory, false);
          if (!dir.exists()) {
            dir.createDirectory(true);
          } else if (dir.isFile()) {
            err(
                pc,
                "can not create directory [" + dir + "], there is already a file with same name.");
          }
        } catch (Throwable t) {
          err(pc, t);
          dir = getTemp(pc);
        }
      }
    }
    file = dir.getRealResource((pc.getId()) + "-" + CreateUUID.call(pc) + ".exl");
    file.createNewFile();
    start = System.currentTimeMillis();
  }
Beispiel #2
0
  @Override
  protected Object invokeMethod(MessageContext mc, Method method, Object trg, Object[] args)
      throws Exception {
    PageContext pc = (PageContext) mc.getProperty(Constants.PAGE_CONTEXT);
    Component c = (Component) mc.getProperty(Constants.COMPONENT);

    RPCServer server = RPCServer.getInstance(pc.getId(), pc.getServletContext());
    TypeMapping tm = server.getEngine().getTypeMappingRegistry().getDefaultTypeMapping();

    return AxisCaster.toAxisType(tm, c.call(pc, method.getName(), toRailoType(pc, args)), null);
  }