dev@javaserverfaces.java.net

web.xml parameter aliasing

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Wed, 19 Nov 2008 12:58:55 -0800

We'll need it because I want the param "facelets.LIBRARIES" to be an
alias to "javax.faces.FACELETS_LIBRARIES".

Here's a changebundle with one implementation. I've checked it in but
it can certainly be changed.

Issue: 274 Facelets

I need this in preparation for more work I must do with ViewHandler to
specify what happens with JSP vs. with Facelets.

This change-bundle implements the aliasing for the param
javax.faces.FACELETS_LIBRARIES (incorrectly typed as
javax.faces.FACELET_LIBRARIES, I've fixed the frame doc) to the old value of
facelets.LIBRARIES.

All automated tests continue to run successfully.


SECTION: Modified Files
----------------------------
M jsf-ri/src/com/sun/faces/config/WebConfiguration.java


SECTION: Diffs
----------------------------
Index: jsf-ri/src/com/sun/faces/config/WebConfiguration.java
===================================================================
--- jsf-ri/src/com/sun/faces/config/WebConfiguration.java (revision 5887)
+++ jsf-ri/src/com/sun/faces/config/WebConfiguration.java (working copy)
 -195,8 +195,16 @@
      * @return the value of the specified parameter
      */
     public String getOptionValue(WebContextInitParameter param) {
+ String result = contextParameters.get(param);
+
+ if (null == result) {
+ WebContextInitParameter alias = param.getAlias(param);
+ if (null != alias) {
+ result = contextParameters.get(alias);
+ }
+ }
 
- return contextParameters.get(param);
+ return result;
 
     }
 
 -710,6 +718,10 @@
               ""
         ),
         FaceletsLibraries(
+ "javax.faces.FACELETS_LIBRARIES",
+ ""
+ ),
+ FaceletsLibrariesAlias(
               "facelets.LIBRARIES",
               ""
         ),
 -741,6 +753,16 @@
             return qualifiedName;
 
         }
+
+ public WebContextInitParameter getAlias(WebContextInitParameter current) {
+ WebContextInitParameter result = null;
+
+ if (current == WebContextInitParameter.FaceletsLibraries) {
+ result = WebContextInitParameter.FaceletsLibrariesAlias;
+ }
+
+ return result;
+ }
 
 
     // ------------------------------------------------- Package Private Methods

-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://ridingthecrest.com/