All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.gkutiel.flip.web.MethodInvokerFinder Maven / Gradle / Ivy

package com.github.gkutiel.flip.web;

import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;

import com.github.gkutiel.flip.utils.Utils;

class MethodInvokerFinder {

	public MethodInvoker find(final HttpServletRequest req) {
		try {
			final String[] args = req.getPathInfo().substring(1).split("/");
			if (args.length < 2) return null;
			final Class clazz = Class.forName("web." + args[0]);
			final Method method = Utils.Reflection.findFirstMethod(clazz, args[1]);
			if (method == null) return null;
			return new MethodInvokerDefault(clazz, method);
		} catch (final ClassNotFoundException e) {
			// TODO (gilad) log
			return null;
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy