"Composite components" are not exactly the same as "compositions" in the question/answer you found. The OP was clearly talking about compositions as in <ui:include>
files which are including <ui:componsition>
content.
You effectively want to prevent direct access to /resources
. This can be achieved by adding the following security constraint entry to web.xml
:
<security-constraint>
<display-name>Restrict direct access to JSF resources</display-name>
<web-resource-collection>
<web-resource-name>JSF resources</web-resource-name>
<url-pattern>/resources/*</url-pattern>
</web-resource-collection>
<auth-constraint /><!-- Empty auth constraint! -->
</security-constraint>
As per the upcoming JSF 2.2, this would not be necessary anymore as it allows you to move the whole /resources
folder into /WEB-INF
by the following configuration entry in web.xml
:
<context-param>
<param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
<param-value>WEB-INF/resources</param-value>
</context-param>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…