HTML and CSS Reference
In-Depth Information
As shown in the bolded lines, after
appUser
object is created and populated with the user information, it is
assigned to
"weather_user"
group which is mentioned in the mapping file in Listing 12-5.
This is all what we need to do in order to apply container-managed security in the
Weather Application
. In order
to get the full source code of
Weather Application
, download it from Chapter 12 source code that you can find in the
JSF Application Performance
Tuning the performance of JSF applications is one of the most important aspects that every JSF developer needs to
be aware of. In this part, we will talk about the most important aspects that can be tuned in order to enhance the
performance of JSF 2.x applications.
Refresh Period
This interval specifies the amount of time that Facelets compiler has to wait until checking for changes in pages.
In development, it is recommended to set the value of (
javax.faces.FACELETS_REFRESH_PERIOD
) parameter to a
low value in order to help the JSF developers during development to be able to edit pages while the application is
running. In production and in order to gain better performance, it is recommended to set the value of
(
javax.faces.FACELETS_REFRESH_PERIOD
) parameter to
-1
(which means that you don't want the compiler to
check for changes once the page is compiled) as shown in the following.
<?xml version="1.0" encoding="UTF-8"?>
<web-app ...>
...
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>-1</param-value>
</context-param>
...
</web-app>
Skip Comments
Setting (
javax.faces.FACELETS_SKIP_COMMENTS
) parameter to
true
can help reducing the amount of data sent across
the network by removing comments from Facelets pages. These comments can be useful for understanding the code
during development, but they are unnecessary during deployment, and in the same time, they can create a security
risk by allowing the system users looking into the source code comments. Having an impact on both security and
performance, it is important to set this parameter to
true
as shown in the following.
<?xml version="1.0" encoding="UTF-8"?>
<web-app ...>
...
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
...
</web-app>