001package jmri.server.web.spi;
002
003import java.util.List;
004import java.util.Map;
005import javax.annotation.CheckReturnValue;
006import javax.annotation.Nonnull;
007
008/**
009 * Provide additional configurations not encapsulated by a servlet for the
010 * {@link jmri.web.server.WebServer}.
011 *
012 * @author Randall Wood
013 */
014public interface WebServerConfiguration {
015
016    /**
017     * Get paths that are to be returned by the web server as individual files
018     * or directory listings. Note that all files or directories listed must be
019     * in the {@link jmri.util.FileUtil#PREFERENCES},
020     * {@link jmri.util.FileUtil#PROFILE}, {@link jmri.util.FileUtil#SETTINGS},
021     * or {@link jmri.util.FileUtil#PROGRAM} JMRI portable path.
022     *
023     * @return a map containing the web path as the key, and the path on disk as
024     *         the value; return an empty map if none
025     */
026    @CheckReturnValue
027    @Nonnull
028    public Map<String, String> getFilePaths();
029
030    /**
031     * Get paths that are to redirected by the web server.
032     *
033     * @return a map containing the request path as the key and the path to
034     *         redirect to as the value; return an empty map if none
035     */
036    @CheckReturnValue
037    @Nonnull
038    public Map<String, String> getRedirectedPaths();
039
040    /**
041     * Get paths that are not to be returned. Requests for paths listed here
042     * will be denied a
043     * {@link javax.servlet.http.HttpServletResponse#SC_FORBIDDEN} response.
044     *
045     * @return a list containing the request path to be denied access to; return
046     *         an empty list if none
047     */
048    @CheckReturnValue
049    @Nonnull
050    public List<String> getForbiddenPaths();
051
052}