Hello Neil, this email pertains to
<
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1512>.
Issue: 1512
SECTION: SPEC Considerations
First, let's assume I'll file a spec issue, targeted at 2.0 Rev a, that
loosens the the following wording on the javadoc of
FacesServlet.service().
The very last sentance in the javadoc for FacesServlet.service() is:
"In a finally block, FacesContext.release() must be called."
I want to change this to:
"The implementation must make it so FacesContext.release() is called
within a finally block as late as possible in the processing for the JSF
related portion of this request".
SECTION: Impl considerations
I plan to affect this change by removing the call to
FacesContext.release() from FacesServlet.service() and moving it to a
finally block in Mojarra's implementation of
javax.servlet.ServletRequestListener.requestDestroyed().
Ryan Lubke mentioned has reason to believe that this method is not
called in a JSR-168 portlet environment. Rather, he asserts we can only
rely on ServletContextListener in JSR-168.
Neil, can you please share your insights about whether or not it is ok
to make this implementation change with respect to JSR-168 portlets?
Thanks,
Ed
SECTION: Modified Files
----------------------------
M jsf-api/src/main/java/javax/faces/webapp/FacesServlet.java
M jsf-ri/src/com/sun/faces/application/WebappLifecycleListener.java
SECTION: Diffs
----------------------------
Index: jsf-api/src/main/java/javax/faces/webapp/FacesServlet.java
===================================================================
--- jsf-api/src/main/java/javax/faces/webapp/FacesServlet.java (revision 8290)
+++ jsf-api/src/main/java/javax/faces/webapp/FacesServlet.java (working copy)
@@ -322,10 +322,6 @@
}
}
}
- finally {
- // Release the FacesContext instance for this request
- context.release();
- }
requestEnd(); // V3 Probe hook
}
Index: jsf-ri/src/com/sun/faces/application/WebappLifecycleListener.java
===================================================================
--- jsf-ri/src/com/sun/faces/application/WebappLifecycleListener.java (revision 8290)
+++ jsf-ri/src/com/sun/faces/application/WebappLifecycleListener.java (working copy)
@@ -61,6 +61,9 @@
import com.sun.faces.util.FacesLogger;
import java.util.Map;
import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.ExceptionQueuedEventContext;
import javax.faces.event.SystemEvent;
import javax.faces.event.PreDestroyViewMapEvent;
import javax.faces.event.ViewMapListener;
@@ -100,16 +103,28 @@
*
* @param event the notification event
*/
- public void requestDestroyed(ServletRequestEvent event) {
- ServletRequest request = event.getServletRequest();
- for (Enumeration e = request.getAttributeNames(); e.hasMoreElements(); ) {
- String beanName = (String)e.nextElement();
- handleAttributeEvent(beanName,
- request.getAttribute(beanName),
- ELUtils.Scope.REQUEST);
+ public void requestDestroyed(ServletRequestEvent event) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ try {
+ ServletRequest request = event.getServletRequest();
+ for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) {
+ String beanName = (String) e.nextElement();
+ handleAttributeEvent(beanName,
+ request.getAttribute(beanName),
+ ELUtils.Scope.REQUEST);
+ }
+ syncSessionScopedBeans(request);
+ } catch (Throwable t) {
+ ExceptionQueuedEventContext eventContext =
+ new ExceptionQueuedEventContext(context, t);
+ context.getApplication().publishEvent(context,
+ ExceptionQueuedEvent.class, eventContext);
+ context.getExceptionHandler().handle();
}
- syncSessionScopedBeans(request);
- ApplicationAssociate.setCurrentInstance(null);
+ finally {
+ context.release();
+ ApplicationAssociate.setCurrentInstance(null);
+ }
}
/**
--
| ed.burns_at_sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/