View Javadoc
1   /**
2    * Copyright By Grandsoft Company Limited.  
3    * 2013-8-10 上午06:13:51
4    */
5   package gboat2.base.core.web.md;
6   
7   import gboat2.base.core.util.ActionUtil;
8   import gboat2.base.core.web.BaseActionSupport;
9   
10  import java.lang.reflect.Method;
11  
12  import org.apache.commons.lang3.StringUtils;
13  import org.osgi.framework.Bundle;
14  
15  /**
16   * 
17   * @author lysming
18   * @since jdk1.6
19   * @date 2013-8-10
20   *  
21   */
22  
23  public class ExtendMethodHandler implements IFileFilter {
24  	
25  	@Override
26  	public String getFile(String invokeMethod, BaseActionSupport action, Bundle bundle) {
27  		String filePath = null;
28  		try {
29  			Method method = action.getClass().getMethod("getExtendForView", new Class[] {});
30  			String extend = (String) method.invoke(action, new Object[] {});
31  			if (!StringUtils.isEmpty(extend)) {
32  				filePath = ActionUtil.getPathPrefix(action.getClass()) + "/metadata/" + action.getUriPrefix() + "-" + invokeMethod + "-" + extend
33  				        + ".md";
34  			}
35  		} catch (Exception ignore) {
36  			//ignore the exception
37  		}
38  		return filePath;
39  	}
40  	
41  }