[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Gavin King gavin.king at jboss.com
Fri Jun 1 14:42:42 EDT 2007


  User: gavin   
  Date: 07/06/01 14:42:42

  Modified:    src/main/org/jboss/seam/core  Expressions.java
  Log:
  minor cleanup
  
  Revision  Changes    Path
  1.31      +26 -10    jboss-seam/src/main/org/jboss/seam/core/Expressions.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Expressions.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Expressions.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -b -r1.30 -r1.31
  --- Expressions.java	31 May 2007 03:41:03 -0000	1.30
  +++ Expressions.java	1 Jun 2007 18:42:42 -0000	1.31
  @@ -1,4 +1,4 @@
  -//$Id: Expressions.java,v 1.30 2007/05/31 03:41:03 gavin Exp $
  +//$Id: Expressions.java,v 1.31 2007/06/01 18:42:42 gavin Exp $
   package org.jboss.seam.core;
   
   import static org.jboss.seam.InterceptionType.NEVER;
  @@ -36,6 +36,11 @@
   public class Expressions implements Serializable
   {
      
  +   /**
  +    * Get an appropriate ExpressionFactory. If there is an active JSF 
  +    * request, use JSF's ExpressionFactory. Otherwise, use one that we 
  +    * created.
  +    */
      public ExpressionFactory getExpressionFactory()
      {
         FacesContext facesContext = FacesContext.getCurrentInstance();
  @@ -44,19 +49,30 @@
               facesContext.getApplication().getExpressionFactory();
      }
      
  +   /**
  +    * Get an appropriate ELContext. If there is an active JSF request,
  +    * use JSF's ELContext. Otherwise, use one that we created.
  +    */
      public ELContext getELContext()
      {
         FacesContext facesContext = FacesContext.getCurrentInstance();
  -      if ( facesContext==null )
  -      {
  -         return EL_CONTEXT;
  +      return  decorateELContext( facesContext==null ? EL_CONTEXT : facesContext.getELContext() );
         }
  -      else
  +
  +   /**
  +    * Wrap the base ELContext, adding Seam's FunctionMapper.
  +    * 
  +    * Thus, any expressions with s:hasRole, s:hasPermission 
  +    * must be evaluated either via Facelets/JSP (since they
  +    * are declared in the tld/taglib.xml or via the 
  +    * Expressions component.
  +    * 
  +    * @param context the JSF ELContext
  +    */
  +   private EvaluationContext decorateELContext(ELContext context)
         {
  -         ELContext context = facesContext.getELContext();
            return new EvaluationContext( context, new SeamFunctionMapper( context.getFunctionMapper() ), context.getVariableMapper() );
         }
  -   }
      
      public ValueExpression<Object> createValueExpression(String expression)
      {
  
  
  



More information about the jboss-cvs-commits mailing list