Navigation Menu

Skip to content

Commit

Permalink
Rename DefaultControllerRouteHandler ControllerRouteHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
decebals committed Jan 14, 2017
1 parent 2baf551 commit e6b1856
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
Expand Up @@ -157,7 +157,7 @@ private void registerControllerMethods(Map<Method, Class<? extends Annotation>>
String fullPath = StringUtils.addStart(StringUtils.removeEnd(controllerPath, "/"), "/");

// create the route handler
RouteHandler handler = new DefaultControllerRouteHandler(application, controllerClass, method.getName());
RouteHandler handler = new ControllerRouteHandler(application, controllerClass, method.getName());

// create the route
Route route = new Route(httpMethod, fullPath, handler)
Expand All @@ -175,7 +175,7 @@ private void registerControllerMethods(Map<Method, Class<? extends Annotation>>
String fullPath = StringUtils.addStart(StringUtils.removeEnd(path, "/"), "/");

// create the route handler
RouteHandler handler = new DefaultControllerRouteHandler(application, controllerClass, method.getName());
RouteHandler handler = new ControllerRouteHandler(application, controllerClass, method.getName());

// create the route
Route route = new Route(httpMethod, fullPath, handler)
Expand Down
Expand Up @@ -22,7 +22,6 @@
import ro.pippo.controller.util.ControllerUtils;
import ro.pippo.core.ContentTypeEngines;
import ro.pippo.core.HttpConstants;
import ro.pippo.core.Messages;
import ro.pippo.core.PippoRuntimeException;
import ro.pippo.core.Request;
import ro.pippo.core.route.Route;
Expand All @@ -45,39 +44,35 @@
import java.util.TreeSet;

/**
* DefaultControllerRouteHandler executes controller methods.
* {@code ControllerRouteHandler} executes controller methods.
*
* @author Decebal Suiu
* @author James Moger
*/
public class DefaultControllerRouteHandler implements RouteHandler {
public class ControllerRouteHandler implements RouteHandler {

private static final Logger log = LoggerFactory.getLogger(DefaultControllerRouteHandler.class);
private static final Logger log = LoggerFactory.getLogger(ControllerRouteHandler.class);

protected final Class<? extends Controller> controllerClass;
protected final String controllerMethodName;
protected final Method controllerMethod;
private final Class<? extends Controller> controllerClass;
private final Method controllerMethod;

protected final ControllerApplication application;
protected final Messages messages;
private final ControllerApplication application;

protected final List<RouteHandler> routeInterceptors;
protected final List<String> declaredConsumes;
protected final List<String> declaredProduces;
protected final boolean isNoCache;
protected MethodParameterExtractor[] extractors;
private final List<RouteHandler> routeInterceptors;
private final List<String> declaredConsumes;
private final List<String> declaredProduces;
private final boolean isNoCache;
private MethodParameterExtractor[] extractors;

public DefaultControllerRouteHandler(ControllerApplication application, Class<? extends Controller> controllerClass, String controllerMethodName) {
public ControllerRouteHandler(ControllerApplication application, Class<? extends Controller> controllerClass, String controllerMethodName) {
this.application = application;
this.controllerClass = controllerClass;
this.controllerMethodName = controllerMethodName;

this.controllerMethod = findMethod(controllerClass, controllerMethodName);
if (controllerMethod == null) {
throw new PippoRuntimeException("Failed to find method '{}'", controllerClass + "::" + controllerMethodName);
}

this.messages = application.getMessages();

this.routeInterceptors = new ArrayList<>();
ControllerUtils.collectRouteInterceptors(controllerMethod).forEach(handlerClass -> {
RouteHandler<RouteContext> handler;
Expand Down

0 comments on commit e6b1856

Please sign in to comment.