package fr.wseduc.webutils.http;

import fr.wseduc.webutils.Controller;
import fr.wseduc.webutils.Server;
import fr.wseduc.webutils.security.SecuredAction;
import org.vertx.java.core.Vertx;
import org.vertx.java.core.http.RouteMatcher;
import org.vertx.java.platform.Container;

import java.util.Map;

public class BaseController extends Controller {

	private BaseController(Vertx vertx, Container container, RouteMatcher rm,
						   Map<String, SecuredAction> securedActions) {
		super(vertx, container, rm, securedActions);
	}

	public BaseController() {
		this(null, null, null, null);
	}

	public void init(Vertx vertx, Container container, RouteMatcher rm,
					 Map<String, SecuredAction> securedActions) {
		super.vertx = vertx;
		super.container = container;
		super.rm = rm;
		super.securedActions = securedActions;
		super.eb = Server.getEventBus(vertx);
		super.pathPrefix = Server.getPathPrefix(container.config());
		if (rm != null) {
			loadRoutes();
		} else {
			log.error("RouteMatcher is null.");
		}
	}

}

@@ -860,16 +860,45 @@
 vertx);%0A
+%09%09if (pathPrefix == null) %7B%0A%09
 %09%09super.
@@ -952,16 +952,20 @@
 fig());%0A
+%09%09%7D%0A
 %09%09if (rm

allow set specific path prefix