Author: dallen6
Date: 2010-03-07 05:32:05 -0500 (Sun, 07 Mar 2010)
New Revision: 6016
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
Log:
Added in some missing edits from Nik due to earlier conflicts.
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java 2010-03-06
22:51:41 UTC (rev 6015)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java 2010-03-07
10:32:05 UTC (rev 6016)
@@ -172,24 +172,38 @@
*/
public void endRequest(HttpServletRequest request)
{
- if (request.getAttribute(REQUEST_ATTRIBUTE_NAME) != null)
+ if (request.getAttribute(REQUEST_ATTRIBUTE_NAME) == null)
{
- HttpPassThruSessionBeanStore sessionBeanStore = (HttpPassThruSessionBeanStore)
lifecycle.getSessionContext().getBeanStore();
- if ((sessionBeanStore != null) && (sessionBeanStore.isInvalidated()))
- {
- conversationManager(sessionBeanStore.getServletContext()).teardownContext();
- lifecycle.endSession(request.getRequestedSessionId(), sessionBeanStore);
- }
- lifecycle.getSessionContext().setBeanStore(null);
- lifecycle.getSessionContext().setActive(false);
- BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
- if (beanStore == null)
- {
- throw new ForbiddenStateException(REQUEST_SCOPE_BEAN_STORE_MISSING);
- }
- lifecycle.endRequest(request.getRequestURI(), beanStore);
- request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
+ return;
}
+ teardownSession(request);
+ teardownRequest(request);
+ lifecycle.getConversationContext().setBeanStore(null);
+ lifecycle.getConversationContext().setActive(false);
}
+
+ private void teardownSession(HttpServletRequest request)
+ {
+ HttpPassThruSessionBeanStore sessionBeanStore = (HttpPassThruSessionBeanStore)
lifecycle.getSessionContext().getBeanStore();
+ if ((sessionBeanStore != null) && (sessionBeanStore.isInvalidated()))
+ {
+ conversationManager(sessionBeanStore.getServletContext()).teardownContext();
+ lifecycle.endSession(request.getRequestedSessionId(), sessionBeanStore);
+ }
+ lifecycle.getSessionContext().setActive(false);
+ lifecycle.getSessionContext().setBeanStore(null);
+
+ }
+
+ private void teardownRequest(HttpServletRequest request)
+ {
+ BeanStore beanStore = (BeanStore) request.getAttribute(REQUEST_ATTRIBUTE_NAME);
+ if (beanStore == null)
+ {
+ throw new ForbiddenStateException(REQUEST_SCOPE_BEAN_STORE_MISSING);
+ }
+ lifecycle.endRequest(request.getRequestURI(), beanStore);
+ request.removeAttribute(REQUEST_ATTRIBUTE_NAME);
+ }
}