Ejemplo n.º 1
0
    public boolean accept(Resource res) {

      if (res.isDirectory()) return allowDir;

      // load content
      String str = null;
      try {
        str = IOUtil.toString(res, "UTF-8");
      } catch (IOException e) {
        return false;
      }

      int index = str.indexOf(':');
      if (index != -1) {
        long expires = Caster.toLongValue(str.substring(0, index), -1L);
        // check is for backward compatibility, old files have no expires date inside. they do ot
        // expire
        if (expires != -1) {
          if (expires < System.currentTimeMillis()) {
            return true;
          }
          str = str.substring(index + 1);
          return false;
        }
      }
      // old files not having a timestamp inside
      else if (res.lastModified() <= time) {
        return true;
      }
      return false;
    }
Ejemplo n.º 2
0
 /**
  * set the value requesttimeout Customizes the requestTimeOut for the task operation. Can be used
  * to extend the default timeout for operations that require more time to execute.
  *
  * @param requesttimeout value to set
  */
 public void setRequesttimeout(Object oRequesttimeout) throws PageException {
   if (StringUtil.isEmpty(oRequesttimeout)) return;
   this.requesttimeout = Caster.toLongValue(oRequesttimeout) * 1000L;
 }
Ejemplo n.º 3
0
 long calllong(PageContext pc, Component cfc, String methodName, Object[] args)
     throws PageException {
   return Caster.toLongValue(call(pc, cfc, methodName, args));
 }