laurence
laurence

Reputation: 21

What is meant by "the JSF runtime", and how is the "javax.faces.webapp.FacesServlet" related?

I've seen references to "the JSF runtime". I understand in some way the 'javax.faces.webapp.FacesServlet" is the "entry point" to the JSF runtime. It is not clear to me what this consititues.

I gather it is something to do with lifecycle management (- an analogue for which i am faintly familiar with, from my knowledge of Serlvets + JSP - in it being a thing that does the calling of the constructor, the init() method, the Servlet's service() method and destroys the Servlet when the Container shutsdown). However, I suspect there is more to the JSF runtime than this. Should the JSF runtime simply be a thing limited to (and concerned only about) lifecycle management - I would most appreciate a little light being shed on what exactly this means for JSF (- though i understand what it means with Servlet's and JSP's), i do not see what this means specifically in terms of JSF, and would most appreciate guidance on this.

Upvotes: 2

Views: 410

Answers (1)

BalusC
BalusC

Reputation: 1109570

The exact phrase "the JSF runtime" is indeed mentioned a several times in the JSF specification.

Upon completion of rendering, but before state saving the JSF runtime must publish a javax.faces.event.PostRenderViewEvent. After doing so the JSF runtime must save the completed state using the methods of the class StateManager. [...]

A JSF implentation must support JSR 303 Bean Validation if the environment in which the JSF runtime is included requires JSR 303 Bean Validation. [...]

The following method gives the JSF runtime access to the list of listeners stored by this instance.: [...]

When the JSF runtime is directed to shutdown by its container, the following actions must be taken. [...]

There are by the way far more hits on the exact phrase "the runtime" in the very same JSF specification, but I'll leave up to you to find them.

It basically boils down to the currently configured and active JSF application. The entire JSF ecosystem with the FacesServlet, Lifecycle and Application being ready and waiting to process a HTTP request as a Faces request. Configured either as default or overridden/customized via faces-config.xml JSF deployment descriptor files and/or @FacesXxx annotated classes.

The FacesServlet is just a part of the JSF runtime. It indeed acts as the entry point of the ecosystem. If an incoming HttpServletRequest matches the URL pattern of the servlet mapping of the FacesServlet, then it will be invoked by the servletcontainer as usual. The FacesServlet will in turn create the FacesContext and process the request through the Lifecycle of the Application and finally destroy the FacesContext right before returning to servletcontainer.

See also:

Upvotes: 4

Related Questions