org.webpieces.devrouter.impl.DevLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-router-dev Show documentation
Show all versions of http-router-dev Show documentation
Library that swaps out specific http-router components to be able to compile code on any request that has changed for use in development servers
package org.webpieces.devrouter.impl;
import java.util.List;
import javax.inject.Inject;
import org.webpieces.router.impl.FilterInfo;
import org.webpieces.router.impl.RouteMeta;
import org.webpieces.router.impl.hooks.MetaLoaderProxy;
import org.webpieces.router.impl.loader.AbstractLoader;
import org.webpieces.router.impl.loader.MetaLoader;
import org.webpieces.router.impl.loader.ResolvedMethod;
import com.google.inject.Injector;
public class DevLoader extends AbstractLoader implements MetaLoaderProxy {
private DevClassForName classLoader;
@Inject
public DevLoader(MetaLoader loader, DevClassForName classLoader) {
super(loader);
this.classLoader = classLoader;
}
protected Object createController(Injector injector, String controllerClassFullName) {
Class> clazz = classLoader.clazzForName(controllerClassFullName);
return injector.getInstance(clazz);
}
@Override
public void loadControllerIntoMeta(RouteMeta meta, ResolvedMethod method,
boolean isInitializingAllControllers) {
if(isInitializingAllControllers)
return; //skip on startup
super.loadRouteImpl(meta, method);
}
@Override
public void loadFiltersIntoMeta(RouteMeta m, List> filters, boolean isInitializingAllFilters) {
if(isInitializingAllFilters)
return; //skip on startup
super.loadFiltersIntoMeta(m, filters);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy