4 Replies Latest reply on Feb 21, 2007 12:13 PM by Monkey Den

    @LoggedIn at the method level

    Monkey Den Master

      @LoggedIn in the docs is at the TYPE level. Has anyone gotten it to work at the method level? It doesnt seem to be intercepting the method call. I'd like to allow the "list function" of a screen but not the edit function if the user is not logged in.

      public @interface LoggedIn {}

      public class SafeAction implements Safe {
       private Log log;
       public String pingMe(){
       log.debug("Pinging me");
       return "success";
       public String pingMeToo(){
       log.debug("Pinging me too");
       return "home";
       @Destroy @Remove
       public void destroy(){

      public class LoggedInInterceptor {
       private Log log;
       public Object checkLoggedIn(InvocationContext invocation) throws Exception {
       boolean isLoggedIn = Contexts.getSessionContext().get("user")!=null;
       try {
       if (isLoggedIn) {
       return invocation.proceed();
       } else {
       throw new SecurityException();
       } catch (SecurityException se) {
       log.debug("Login required");
       return "login";