[jboss-cvs] jboss-seam/examples/booking/src/org/jboss/seam/example/booking ...

Gavin King gavin.king at jboss.com
Sun Dec 17 08:12:56 EST 2006


  User: gavin   
  Date: 06/12/17 08:12:56

  Modified:    examples/booking/src/org/jboss/seam/example/booking 
                        LoggedInInterceptor.java
  Log:
  improves the loggedininterceptor
  updated to new element names
  
  Revision  Changes    Path
  1.14      +11 -32    jboss-seam/examples/booking/src/org/jboss/seam/example/booking/LoggedInInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LoggedInInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/booking/src/org/jboss/seam/example/booking/LoggedInInterceptor.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- LoggedInInterceptor.java	17 Dec 2006 01:04:51 -0000	1.13
  +++ LoggedInInterceptor.java	17 Dec 2006 13:12:56 -0000	1.14
  @@ -1,24 +1,16 @@
  -//$Id: LoggedInInterceptor.java,v 1.13 2006/12/17 01:04:51 gavin Exp $
  +//$Id: LoggedInInterceptor.java,v 1.14 2006/12/17 13:12:56 gavin Exp $
   package org.jboss.seam.example.booking;
   
   import java.lang.reflect.Method;
   
  -import javax.faces.event.PhaseId;
   import javax.interceptor.AroundInvoke;
   import javax.interceptor.InvocationContext;
   
  +import org.jboss.seam.InterceptorType;
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.contexts.Contexts;
  -import org.jboss.seam.contexts.Lifecycle;
  -import org.jboss.seam.interceptors.BijectionInterceptor;
  -import org.jboss.seam.interceptors.BusinessProcessInterceptor;
  -import org.jboss.seam.interceptors.ConversationInterceptor;
  -import org.jboss.seam.interceptors.RemoveInterceptor;
  -import org.jboss.seam.interceptors.ValidationInterceptor;
  -
  - at Interceptor(around={BijectionInterceptor.class, ValidationInterceptor.class, 
  -                     ConversationInterceptor.class, BusinessProcessInterceptor.class},
  -             within=RemoveInterceptor.class)
  +
  + at Interceptor(type=InterceptorType.CLIENT)
   public class LoggedInInterceptor
   {
   
  @@ -26,19 +18,6 @@
      public Object checkLoggedIn(InvocationContext invocation) throws Exception
      {
         boolean isLoggedIn = Contexts.getSessionContext().get("loggedIn")!=null;
  -      if ( Lifecycle.getPhaseId()==PhaseId.INVOKE_APPLICATION )
  -      {
  -         if (isLoggedIn) 
  -         {
  -            return invocation.proceed();
  -         }
  -         else 
  -         {
  -            return "login";
  -         }
  -      }
  -      else
  -      {
            if ( isLoggedIn )
            {
               return invocation.proceed();
  @@ -46,7 +25,8 @@
            else
            {
               Method method = invocation.getMethod();
  -            if ( method.getReturnType().equals(void.class) )
  +         Class<?> returnType = method.getReturnType();
  +         if ( returnType.equals(void.class) || returnType.equals(String.class) )
               {
                  return null;
               }
  @@ -56,6 +36,5 @@
               }
            }
         }
  -   }
   
   }
  
  
  



More information about the jboss-cvs-commits mailing list