You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/09/29 19:58:10 UTC
svn commit: r451365 - in /beehive/trunk:
docs/forrest/release/src/documentation/content/xdocs/netui/
netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/
Author: crogers
Date: Fri Sep 29 10:58:09 2006
New Revision: 451365
URL: http://svn.apache.org/viewvc?view=rev&rev=451365
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-1148 - PageFlowActionListener now checks request type before casting to ServletRequest. Also updated BackingClassMethodBinding in the same way.
Tests: NetUI server BVT and jsfWeb BVT (WinXP pass)
Modified:
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/jsf.xml
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java
Modified: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/jsf.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/jsf.xml?view=diff&rev=451365&r1=451364&r2=451365
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/jsf.xml (original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/jsf.xml Fri Sep 29 10:58:09 2006
@@ -10,7 +10,7 @@
<p>
<a href="http://java.sun.com/j2ee/javaserverfaces/">JavaServer Faces</a> is
technology for building web application user interfaces. It allows development of
- very rich component- and event-based pages. NetUI Page Flow treats treats JSF pages as
+ very rich component- and event-based pages. NetUI Page Flow treats JSF pages as
<em>first-class citizens</em>. In addition to allowing the use of "straight" JSF
features, it integrates in the following ways:
</p>
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java?view=diff&rev=451365&r1=451364&r2=451365
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java Fri Sep 29 10:58:09 2006
@@ -29,6 +29,7 @@
import javax.faces.el.MethodNotFoundException;
import javax.faces.el.EvaluationException;
import javax.faces.context.FacesContext;
+import javax.faces.context.ExternalContext;
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponentBase;
import javax.servlet.http.HttpServletRequest;
@@ -88,34 +89,33 @@
if ( result instanceof String )
{
String action = ( String ) result;
- Object request = context.getExternalContext().getRequest();
+ ExternalContext externalContext = context.getExternalContext();
+ Object request = externalContext.getRequest();
+ Object servletContextObject = externalContext.getContext();
assert request != null;
- assert request instanceof HttpServletRequest : request.getClass().getName();
- Object servletContextObject = context.getExternalContext().getContext();
- assert servletContextObject instanceof ServletContext : servletContextObject.getClass().getName();
- ServletContext servletContext = ( ServletContext ) servletContextObject;
-
- HttpServletRequest httpRequest = ( HttpServletRequest ) request;
- Object backingBean = InternalUtils.getFacesBackingBean( httpRequest, servletContext );
-
- if ( backingBean != null )
- {
- Class backingClass = backingBean.getClass();
-
- Method method = _methodCache.getMethod( backingClass, _methodName, _params );
-
- if ( method == null ) throw new MethodNotFoundException( _methodName );
- AnnotationReader annReader = AnnotationReader.getAnnotationReader( backingClass, servletContext );
- ProcessedAnnotation ann = annReader.getJpfAnnotation( method, "CommandHandler" );
-
- if ( ann != null )
- {
- ProcessedAnnotation[] raiseActions =
- AnnotationReader.getAnnotationArrayAttribute( ann, "raiseActions" );
-
- if ( raiseActions != null )
- {
- setOutputFormBeans( raiseActions, backingClass, backingBean, action, httpRequest );
+
+ if (request instanceof HttpServletRequest && servletContextObject instanceof ServletContext) {
+ ServletContext servletContext = (ServletContext) servletContextObject;
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ Object backingBean = InternalUtils.getFacesBackingBean(httpRequest, servletContext);
+
+ if (backingBean != null) {
+ Class backingClass = backingBean.getClass();
+ Method method = _methodCache.getMethod(backingClass, _methodName, _params);
+
+ if (method == null) {
+ throw new MethodNotFoundException(_methodName);
+ }
+ AnnotationReader annReader = AnnotationReader.getAnnotationReader(backingClass, servletContext);
+ ProcessedAnnotation ann = annReader.getJpfAnnotation(method, "CommandHandler");
+
+ if (ann != null) {
+ ProcessedAnnotation[] raiseActions =
+ AnnotationReader.getAnnotationArrayAttribute(ann, "raiseActions");
+
+ if (raiseActions != null) {
+ setOutputFormBeans(raiseActions, backingClass, backingBean, action, httpRequest);
+ }
}
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java?view=diff&rev=451365&r1=451364&r2=451365
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java Fri Sep 29 10:58:09 2006
@@ -48,13 +48,11 @@
{
Object submitFormBean = event.getComponent().getAttributes().get( "submitFormBean" );
FacesContext context = FacesContext.getCurrentInstance();
-
- if ( submitFormBean != null )
- {
+ Object request = context.getExternalContext().getRequest();
+
+ if (submitFormBean != null && request instanceof ServletRequest) {
ValueBinding binding = context.getApplication().createValueBinding( "#{" + submitFormBean + '}' );
Object beanInstance = binding.getValue( context );
- Object request = context.getExternalContext().getRequest();
- assert request instanceof ServletRequest : request.getClass().getName();
ActionForm wrappedFormBean = InternalUtils.wrapFormBean( beanInstance );
InternalUtils.setForwardedFormBean( ( ServletRequest ) request, wrappedFormBean );
}
@@ -62,15 +60,13 @@
_delegate.processAction( event );
// Tell the faces process cycle that we're done... stop the life cycle
- Object request = context.getExternalContext().getRequest();
- assert request instanceof ServletRequest : request.getClass().getName();
- ServletRequest servletRequest = ( ServletRequest ) request;
-
- String actionURI = ( String ) servletRequest.getAttribute( PageFlowNavigationHandler.ALREADY_FORWARDED_ATTR );
-
- if ( actionURI != null )
- {
- throw new AbortProcessingException( "PageFlowNavigationHandler forwarded to: " + actionURI );
+ if (request instanceof ServletRequest) {
+ ServletRequest servletRequest = (ServletRequest) request;
+ String actionURI = (String) servletRequest.getAttribute(PageFlowNavigationHandler.ALREADY_FORWARDED_ATTR);
+
+ if (actionURI != null) {
+ throw new AbortProcessingException("PageFlowNavigationHandler forwarded to: " + actionURI);
+ }
}
}
}