java.lang.reflect.Method (java反射机制)
公司Vac方法过滤器使用到反射机制,读取xml配置文件过滤用户访问的方法名是否合法。
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
@SuppressWarnings("unchecked")
Map<Object, Object> requestData = (Map<Object, Object>) httpRequest.getAttribute("requestData");
String methodName = (String) requestData.get(METHOD);
//获得bean的配置
String beanName = mapProtocol.get(methodName).get(BEAN);
// 去除.符号
methodName = getMethod(methodName);
//从spring context中获得bean
Object instance = getContext(filterConfig).getBean(beanName);
Class<? extends Object> clazz = instance.getClass();
Object resultContent = null;
try {
Method method = clazz
.getDeclaredMethod(methodName, getParamTypes());
Map params = removeSysParams(requestData);
resultContent = method.invoke(instance, params);
} catch (InvocationTargetException e) {
if (e.getTargetExce
相关文档:
创建一个JFrame
下面用简单的实例演示了Java Swing创建一个能输入内容的窗口
public class frameTest(){
public static void Main(String args[]){
//创建JFrame对象,JFrame用来在屏幕上显示一个Windows窗口。
JFrame frame = new JFrame("第一个JFrame"); &nbs ......
在java调用exe,com可执行文件和bat,cmd批处理文件
一。运行exe文件
1. Java JDK里已经提供了调用的方法,不在累赘,代码如下。
try {
String command = "notepad";
& ......
public static void getConnAndTableStruct() {
Connection connection = null;
PreparedStatement pstmt = null;
ResultSetMetaData rsmd = null;
try {
// mysql连接
//Class.forName("org.gjt.mm.mysql.Driver");
//connection = DriverManager.g ......
2008 年 6 月 24 日
原文地址: http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
本文介绍 IBM FileNet P8 4.0 Platform 提供的 Content Java API。首先对 FileNet P8 Content Engine 和 API 进行概要介绍, 并说明了一些基本概念,随后详细介绍了 FileNet Content Engine提供的基于 EJB ......