<servlet>
<servlet-name>Rcfaces resources Servlet</servlet-name>
<servlet-class>org.rcfaces.renderkit.html.internal.resource.ResourcesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Rcfaces resources Servlet</servlet-name>
<url-pattern>/rc-fwk/*</url-pattern>
</servlet-mapping>
The size of HTTP exchanges tends to increase with modern Web applications.
To minimize the network traffic, RC Faces can add expiration dates to the static resources (JavaScript, css, images, ...) used by JSF components.
With expiration dates, the browser or the proxy server will put the RC Faces resources in a cache and will not make further requests for those resources.
The main problem with this mechanism is the deployment of a new version of an application. If the cached resources have been modified, there is normally no way to tell the proxy or the browsers to clear their cache immediatly !
The role of the Application Version Servlet (AVS) is to get around this problem. To do so the AVS manage HTTP header for each RcFaces resource (Last Modified, Expires date, a special calculation of Etag and the content-MD5 attributes). It will also change the URL of the resources whenever a new version of an application is deployed. The change of URL will force the browser and the proxy server to get a new version of all the resources used by an application.
Register this servlet like this :
<servlet>
<servlet-name>Rcfaces Application version</servlet-name>
<servlet-class> org.rcfaces.core.internal.version.ApplicationVersionServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Rcfaces Application version</servlet-name>
<url-pattern>/rc-av/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.rcfaces.core.APPLICATION_VERSION</param-name>
<param-value>hashcode</param-value>
<!-- param-value>v10.0</param-value -->
<!-- param-value>v10.1</param-value -->
</context-param>
RC Faces has a servlet to manage Css file. The first role of this servlet is to merge all the CSS files needed by an application in a single file. In this way web browsers don't have to load too many files.
The generation of this single CSS file can be a time-consuming task. To maximize the application performance, the Application Content Servlet caches the generated CSS file in memory.
Register this servlet like this :
<servlet>
<servlet-name>Rcfaces Application Contents</servlet-name>
<servlet-class> org.rcfaces.core.internal.contentStorage.ContentStorageServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Rcfaces Application Contents</servlet-name>
<url-pattern>/rc-content/*</url-pattern>
</servlet-mapping>
The second Role of the Application Content Dynamics Servlet is to modify dynamically an image.
The servlet allows to :
Sample page that uses the dynamic image features of the servlet :
<v:image imageURL="images/back64.gif" />
<v:image imageURL="hover::images/back64.gif" />
<v:image imageURL="disabled::images/back64.gif" />
<v:image imageURL="selected::images/back64.gif" />
<v:image imageURL="gray::images/back64.gif" />
<v:image imageURL="contrast(0.6)::images/back64.gif" />
<v:image imageURL="brithness(-0.6)::images/back64.gif" />
<v:image imageURL="scale(0.5)::images/back64.gif" />
<!--size in px -->
<v:image imageURL="resize(50)::images/back64.gif" />
<v:image imageURL="setSize(80,150)::images/back64.gif" />
<v:imageCheckButton
imageURL="images/home.gif"
hoverImageURL="hover::"
disabledImageURL="disabled::"
selectedImageURL="selected::"
/>
<v:imageCheckButton disabled="true"
imageURL="images/home.gif"
disabledImageURL="disabled::"
/>
<!--GIF to JPEG -->
<v:image imageURL="jpeg(quality=1)::images/babelfish.gif" />
<!--JPEG to JPEG -->
<v:image imageURL="jpeg(quality=0.7)::images/babelfish.jpg" />
<!--JPEG to GIF -->
<v:image imageURL="gif::images/babelfish.jpg" />
<!--JPEG to PNG -->
<v:image imageURL="png::images/babelfish.jpg" />
<!--GIF to PNG -->
<v:image imageURL="png::images/babelfish.gif" />
Results :

<servlet>
<servlet-name>Rcfaces client bundle</servlet-name>
<servlet-class> org.rcfaces.html.internal.clientBundle.clientResourceBundleServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Rcfaces Client bundle</servlet-name>
<url-pattern>/rc-cb/*</url-pattern>
</servlet-mapping>
In Faces-Config.xml declare all the needed locales :
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>fr</supported-locale>
<supported-locale>de</supported-locale>
</locale-config>
</application>
greeting_text=Greeting
forfun_alert=Framework created by Olivier Oeuillot
test=java is {0} and {1}
<vh:loadBundle bundleName="messages" baseName="bundle.Messages" />
<script>
var bundle=f_resourceBundle.Get("messages");
try {
alert("Bundle="+bundle.f_format("forfun_alert"));
alert("Bundle="+bundle.f_format("test", "good", "powerfull" ));
} catch (x) {
alert("Test: "+x);
}
</script>
<v:textEntry id="demoText" value="#{messages.greeting_text}" required="true">
<v:text for="demoText" text="Label : "/>
</v:textEntry>