use of org.webpieces.router.impl.UrlPath in project webpieces by deanhiller.
the class AbstractRouteBuilder method addContentRoute.
public void addContentRoute(HttpMethod method, String path, String controllerMethod) {
UrlPath p = new UrlPath(routerInfo, path);
Route route = new RouteImpl(method, p, controllerMethod, isHttpsOnlyRoutes);
addRoute(route, null);
}
use of org.webpieces.router.impl.UrlPath in project webpieces by deanhiller.
the class R1RouterBuilder method addStaticRoute.
private void addStaticRoute(String urlPath, String fileSystemPath, boolean isOnClassPath) {
if (isOnClassPath)
throw new UnsupportedOperationException("oops, isOnClassPath not supported yet");
StaticRoute route = new StaticRoute(new UrlPath(routerInfo, urlPath), fileSystemPath, isOnClassPath, holder.getCachedCompressedDirectory());
staticRoutes.add(route);
log.info("scope:'" + routerInfo + "' adding static route=" + route.getFullPath() + " fileSystemPath=" + route.getFileSystemPath());
RouteMeta meta = new RouteMeta(route, holder.getInjector(), currentPackage.get(), holder.getUrlEncoding());
allRouting.addStaticRoute(meta);
}
use of org.webpieces.router.impl.UrlPath in project webpieces by deanhiller.
the class TestCompressionCache method runBasicServerOnce.
private List<StaticRoute> runBasicServerOnce(File stagingDir) {
List<StaticRoute> routes = new ArrayList<>();
routes.add(new StaticRoute(new UrlPath("", "/public/"), stagingDir.getAbsolutePath() + "/", false, cacheDir));
cache.setupCache(routes);
Assert.assertEquals(2, proxy.getReadFiles().size());
Assert.assertEquals(2, proxy.getCompressedFiles().size());
proxy.clear();
return routes;
}
use of org.webpieces.router.impl.UrlPath in project webpieces by deanhiller.
the class AbstractRouteBuilder method addRoute.
@Override
public void addRoute(HttpMethod method, String path, String controllerMethod, RouteId routeId, boolean checkToken) {
UrlPath p = new UrlPath(routerInfo, path);
Route route = new RouteImpl(method, p, controllerMethod, routeId, isHttpsOnlyRoutes, checkToken);
addRoute(route, routeId);
}
use of org.webpieces.router.impl.UrlPath in project webpieces by deanhiller.
the class TestCompressionCache method testStartServerTwiceButUrlPathChanges.
@Test
public void testStartServerTwiceButUrlPathChanges() throws IOException {
File f = new File("src/test/resources/cacheTest1");
File stagingDir = new File("output/staging");
FileUtils.copyDirectory(f, stagingDir);
runBasicServerOnce(stagingDir);
List<StaticRoute> routes2 = new ArrayList<>();
routes2.add(new StaticRoute(new UrlPath("", "/public1.4/"), stagingDir.getAbsolutePath() + "/", false, cacheDir));
//if server is just restarted(no file changes), we should skip reading files...
cache.setupCache(routes2);
Assert.assertEquals(2, proxy.getReadFiles().size());
Assert.assertEquals(2, proxy.getCompressedFiles().size());
}
Aggregations