jakartaee / jakartaee/faces

Expose the effective jakarta.faces.FACELETS_REFRESH_PERIOD via public API

Open
#2,205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
127
Forks
59
Avg merge
23h
Merged PRs (30d)
7

Description

Background

The spec (Using Faces in Web Applications, jakarta.faces.FACELETS_REFRESH_PERIOD) mandates a default that depends on Application.getProjectStage(): Production → the runtime must act as if -1 (#936, 2.3), otherwise as if 0 (#1821, 4.1).

That is a normative requirement with no observable public surface. The only public API is the constant ViewHandler.FACELETS_REFRESH_PERIOD_PARAM_NAME. A portable test can read the raw context param, but it cannot obtain the effective value the runtime resolved, which is precisely what the two rules above are about.

Problem

The TCK modules covering this had to reach into com.sun.faces to observe the effective value:

ApplicationAssociate appAss = ApplicationAssociate.getInstance(extContext);
firstName = "" + appAss.getFaceletFactory().getRefreshPeriod();

That is exactly the pattern rejected by challenge #1701 ("Test applications should not depend on com.sun.faces classes"). Consequently faces23/refresh-period-explicit and faces23/refresh-period-production are deactivated in the 5.0 TCK, and both mandated defaults are currently untested.

Note that #1821 is recent: the non-Production half of this requirement has never been covered by a running TCK test, because the modules asserting it were already deactivated when it was written.

Proposal

Add a concrete (non-abstract, hence binary- and source-compatible) accessor returning the effective period in seconds:

// jakarta.faces.application.Application
public int getFaceletsRefreshPeriod() { ... }   // -1 in Production, else 0, unless the context param overrides

ApplicationWrapper delegates for free.

Notes
  • Alternative placement is FaceletCache#getRefreshPeriod(), but FaceletCache is a user-extensible abstract class: adding an abstract method breaks existing subclasses, and a concrete method there has no access to the resolved config. Application already owns getProjectStage(), which is the value the default derives from, so it is the natural home.
  • The unit must be seconds, as the context param is documented. Mojarra's internal accessor returns milliseconds.
  • #1821's title says Development, while the spec text it produced says else, i.e. 0 applies to every non-Production stage. Worth confirming that the accessor's javadoc uses the else wording.

🤖 Generated with Claude Opus 4.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with jakarta.faces.application.Application and ApplicationWrapper, then inspect the FaceletCache and Mojarra ApplicationAssociate access described in the issue. Review the deactivated faces23/refresh-period-explicit and faces23/refresh-period-production TCK modules. Done means the public accessor exposes the effective period in seconds with the specified Production and non-Production defaults, while preserving wrapper compatibility and enabling those tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.