001package jmri.web.servlet.directory; 002 003import org.eclipse.jetty.server.handler.ResourceHandler; 004import javax.annotation.Nonnull; 005 006/** 007 * @author Randall Wood Copyright 2016, 2020 008 */ 009public class DirectoryHandler extends ResourceHandler { 010 011 /** 012 * Construct a DirectoryHandler for the named directory with common default 013 * settings. This constructor sets directory listings to true and returns 014 * the contents of index.html within the directory instead of listing the 015 * contents of the directory if index.html exists. 016 * 017 * @param resourceBase the directory to serve, should be non-null, but 018 * allowing null until deprecated constructor is removed 019 */ 020 public DirectoryHandler(@Nonnull String resourceBase) { 021 super(new DirectoryService()); 022 super.setDirectoriesListed(true); 023 super.setWelcomeFiles(new String[]{"index.shtml", "index.html"}); // NOI18N 024 super.setResourceBase(resourceBase); 025 } 026}