File Source: UIActionPrepareInterceptor.java

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   *  contributor license agreements.  The ASF licenses this file to You
     4   * under the Apache License, Version 2.0 (the "License"); you may not
     5   * use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.  For additional information regarding
    15   * copyright in this work, please see the NOTICE file in the top level
    16   * directory of this distribution.
    17   */
    18  
    19  package org.apache.roller.weblogger.ui.struts2.util;
    20  
    21  import com.opensymphony.xwork2.ActionContext;
    22  import com.opensymphony.xwork2.ActionInvocation;
    23  import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
    24  import org.apache.commons.logging.Log;
    25  import org.apache.commons.logging.LogFactory;
    26  
    27  
    28  /**
    29   * A struts2 interceptor for doing custom prepare logic.
    30   */
         /* 
    P/P   *  Method: void org.apache.roller.weblogger.ui.struts2.util.UIActionPrepareInterceptor()
          */
    31  public class UIActionPrepareInterceptor extends AbstractInterceptor {
    32      
             /* 
    P/P       *  Method: org.apache.roller.weblogger.ui.struts2.util.UIActionPrepareInterceptor__static_init
              * 
              *  Postconditions:
              *    init'ed(log)
              */
    33      private static Log log = LogFactory.getLog(UIActionPrepareInterceptor.class);
    34      
    35      
    36      public String intercept(ActionInvocation invocation) throws Exception {
    37          
                 /* 
    P/P           *  Method: String intercept(ActionInvocation)
                  * 
                  *  Preconditions:
                  *    invocation != null
                  *    log != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    38          log.debug("Entering UIActionPrepareInterceptor");
    39          
    40          final Object action = invocation.getAction();
+   41          final ActionContext context = invocation.getInvocationContext();
    42          
    43          // is this one of our own UIAction classes?
    44          if (action instanceof UIActionPreparable) {
    45              
    46              log.debug("action is UIActionPreparable, calling myPrepare() method");
    47              
    48              UIActionPreparable theAction = (UIActionPreparable) action;
    49              theAction.myPrepare();
    50          }
    51          
    52          return invocation.invoke();
    53      }
    54      
    55  }








SofCheck Inspector Build Version : 2.18479
UIActionPrepareInterceptor.java 2009-Jan-02 14:24:48
UIActionPrepareInterceptor.class 2009-Sep-04 03:12:45