Misc. changes.
SECTION: Modified Files
----------------------------
M src/com/sun/faces/renderkit/JsfJsResourcePhaseListener.java
- add Cache-Control response header when sending externalized
JS
M src/com/sun/faces/renderkit/RenderKitUtils.java
- use typeof operator to check if the jsfcljs function exists.
From testing, it appears this works better than calling
if (jsfcljs) { jsfcljs(...) } in Firefox (firefox sometimes
throws a JS error stating jsfcljs is undefined when not using
typeof)
M src/com/sun/faces/util/Util.java
- Simplify logic. Boolean.valueOf() only returns true
if value is 'true' in all other cases, including null,
it will return Boolean.FALSE.
SECTION: Diffs
----------------------------
Index: src/com/sun/faces/renderkit/JsfJsResourcePhaseListener.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/JsfJsResourcePhaseListener.java,v
retrieving revision 1.1
diff -u -r1.1 JsfJsResourcePhaseListener.java
--- src/com/sun/faces/renderkit/JsfJsResourcePhaseListener.java 30 Aug 2006 17:42:50 -0000 1.1
+++ src/com/sun/faces/renderkit/JsfJsResourcePhaseListener.java 5 Sep 2006 18:00:51 -0000
@@ -76,6 +76,7 @@
if (request.getRequestURI().contains(RIConstants.SUN_JSF_JS_URI)) {
HttpServletResponse response = (HttpServletResponse) context
.getExternalContext().getResponse();
+ response.addHeader("Cache-Control", "max-age=3600");
response.setContentType("text/javascript");
try {
RenderKitUtils.writeSunJS(context, response.getWriter());
Index: src/com/sun/faces/renderkit/RenderKitUtils.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/RenderKitUtils.java,v
retrieving revision 1.24
diff -u -r1.24 RenderKitUtils.java
--- src/com/sun/faces/renderkit/RenderKitUtils.java 30 Aug 2006 17:42:50 -0000 1.24
+++ src/com/sun/faces/renderkit/RenderKitUtils.java 5 Sep 2006 18:00:51 -0000
@@ -942,7 +942,7 @@
Param[] params) {
StringBuilder sb = new StringBuilder(256);
- sb.append("if(window.jsfcljs){window.jsfcljs(document.forms['");
+ sb.append("if(typeof jsfcljs == 'function'){jsfcljs(document.forms['");
sb.append(formClientId);
sb.append("'],'");
sb.append(commandClientId).append(',').append(commandClientId);
Index: src/com/sun/faces/util/Util.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
retrieving revision 1.195
diff -u -r1.195 Util.java
--- src/com/sun/faces/util/Util.java 29 Aug 2006 06:13:01 -0000 1.195
+++ src/com/sun/faces/util/Util.java 5 Sep 2006 18:00:51 -0000
@@ -521,16 +521,16 @@
if (null !=
(disabledOrReadonly = component.getAttributes().get("disabled"))) {
if (disabledOrReadonly instanceof String) {
- result = ((String) disabledOrReadonly).equalsIgnoreCase("true");
+ result = Boolean.valueOf((String) disabledOrReadonly);
} else {
result = disabledOrReadonly.equals(Boolean.TRUE);
}
}
- if ((result == false) &&
+ if ((!result) &&
null !=
(disabledOrReadonly = component.getAttributes().get("readonly"))) {
if (disabledOrReadonly instanceof String) {
- result = ((String) disabledOrReadonly).equalsIgnoreCase("true");
+ result = Boolean.valueOf((String) disabledOrReadonly);
} else {
result = disabledOrReadonly.equals(Boolean.TRUE);
}