private static ResourceHandler resourceHandler() { return resource( new ClassPathResourceManager( StandaloneTestingService.class.getClassLoader())); }
public static MappedEndpoint staticFiles(String url, String docPath) { url = resolveUrl(url); url = url.isEmpty() ? BASE_PATH : url; docPath = docPath.startsWith(BASE_PATH) ? docPath.replaceFirst(BASE_PATH, "") : docPath; HttpHandler handler = Handlers.path() .addPrefixPath(url, Handlers.resource(new ClassPathResourceManager(Thread.currentThread().getContextClassLoader(), docPath)) .addWelcomeFiles(INDEX_HTML)); return new MappedEndpoint(Methods.GET_STRING, url, MappedEndpoint.Type.STATIC, handler); }
public static MappedEndpoint staticFiles(String url, String docPath, List<Interceptor> interceptors) { Objects.requireNonNull(url, Messages.INVALID_URL); url = resolveUrl(url); docPath = docPath.startsWith(BASE_PATH) ? docPath.replaceFirst(BASE_PATH, "") : docPath; HttpHandler handler = Handlers.path() .addPrefixPath(url, Handlers.resource(new ClassPathResourceManager(Thread.currentThread().getContextClassLoader(), docPath)) .addWelcomeFiles("index.html")); InterceptorHandler interceptorHandler = new InterceptorHandler(interceptors); interceptorHandler.setNext(handler); return new MappedEndpoint(MappedEndpoint.Type.STATIC.name(), url, MappedEndpoint.Type.STATIC, interceptorHandler); }
public static MappedEndpoint staticFiles(String url, String docPath, List<Interceptor> interceptors) { Objects.requireNonNull(url, Messages.INVALID_URL); url = resolveUrl(url); docPath = docPath.startsWith(BASE_PATH) ? docPath.replaceFirst(BASE_PATH, "") : docPath; HttpHandler handler = Handlers.path() .addPrefixPath(url, Handlers.resource(new ClassPathResourceManager(Thread.currentThread().getContextClassLoader(), docPath)) .addWelcomeFiles("index.html")); InterceptorHandler interceptorHandler = new InterceptorHandler(interceptors); interceptorHandler.setNext(handler); return new MappedEndpoint(Methods.GET_STRING, url, MappedEndpoint.Type.STATIC, interceptorHandler); }
ResourceHandler handler = resource(new FileResourceManager(file, 3)) .addWelcomeFiles(welcomeFile) .setDirectoryListingEnabled(false);
ResourceHandler resourceHandler = Handlers.resource(combinedResourceManager);
new PathHandler(resource(new FileResourceManager( new File(base), Integer .valueOf(transferMinSize))))
Handlers.resource(new ClassPathResourceManager(classloader, "webRoot")));