facelets
  1. facelets
  2. FACELETS-276

facelets.REFRESH_PERIOD -1 value is misinterpreted

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: Facelets 1.2_03
    • Fix Version/s: 1.1.15
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      276

      Description

      Facelets view caching specifies that when facelets.REFRESH_PERIOD is -1, the
      view cache should be disabled.

      The opposite is true. This value causes Facelets to ignore stale view detection
      and to ONLY render cached views.

      The problem is in com.sun.facelets.impl.DefaultFaceletFactory (as of latest HEAD
      revision):

      /**

      • Template method for determining if the Facelet needs to be refreshed.
      • @param facelet
      • Facelet that could have expired
      • @return true if it needs to be refreshed
        */
        protected boolean needsToBeRefreshed(DefaultFacelet facelet) {
        if (this.refreshPeriod != -1) {
        long ttl = facelet.getCreateTime() + this.refreshPeriod;
        if (System.currentTimeMillis() > ttl)
        Unknown macro: { try { long atl = facelet.getSource().openConnection() .getLastModified(); return atl == 0 || atl > ttl; } catch (Exception e) { throw new FaceletException( "Error Checking Last Modified for " + facelet.getAlias(), e); } }

        }
        return false;
        }

      This method should return true, not false, when the refreshPeriod value is -1.

      See also: https://facelets.dev.java.net/issues/show_bug.cgi?id=40

        Issue Links

          Activity

          Hide
          youngm added a comment -

          assigning

          Show
          youngm added a comment - assigning
          Hide
          jhook added a comment -

          Read:

          https://facelets.dev.java.net/nonav/docs/dev/docbook.html#config-webapp-init

          "When a page is requested, what interval in seconds should the compiler check
          for changes. If you don't want the compiler to check for changes once the page
          is compiled, then use a value of -1. Setting a low refresh period helps during
          development to be able to edit pages in a running application."

          Show
          jhook added a comment - Read: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#config-webapp-init "When a page is requested, what interval in seconds should the compiler check for changes. If you don't want the compiler to check for changes once the page is compiled, then use a value of -1. Setting a low refresh period helps during development to be able to edit pages in a running application."
          Hide
          Ian Hlavats added a comment -

          My mistake - it was my misunderstanding of the -1 value.

          I've submitted an enhancement request instead:

          https://facelets.dev.java.net/issues/show_bug.cgi?id=277

          Thanks for your time.

          Show
          Ian Hlavats added a comment - My mistake - it was my misunderstanding of the -1 value. I've submitted an enhancement request instead: https://facelets.dev.java.net/issues/show_bug.cgi?id=277 Thanks for your time.
          Hide
          jhook added a comment -

          referencing FACELETS-278

          Show
          jhook added a comment - referencing FACELETS-278

            People

            • Assignee:
              youngm
              Reporter:
              Ian Hlavats
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: