This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 4558740  Context API refactoring.
4558740 is described below

commit 45587403ed3f68771249ecb6ac699eb7e8c36c96
Author: JamesBognar <[email protected]>
AuthorDate: Sun Sep 12 13:01:48 2021 -0400

    Context API refactoring.
---
 .../java/org/apache/juneau/cp/BasicFileFinder.java |   2 +-
 .../main/java/org/apache/juneau/cp/FileFinder.java | 218 ++++++++++++-
 .../org/apache/juneau/cp/FileFinderBuilder.java    | 175 -----------
 .../org/apache/juneau/rest/BasicStaticFiles.java   |   6 +-
 .../java/org/apache/juneau/rest/RestContext.java   | 151 +--------
 .../org/apache/juneau/rest/RestContextBuilder.java | 338 ++++++++++++---------
 .../java/org/apache/juneau/rest/StaticFiles.java   | 118 ++++++-
 .../org/apache/juneau/rest/StaticFilesBuilder.java | 130 --------
 .../juneau/rest/annotation/RestAnnotation.java     |   2 +-
 .../java/org/apache/juneau/cp/FileFinder_Test.java |   4 +-
 .../java/org/apache/juneau/rest/Swagger_Test.java  |   2 +-
 11 files changed, 529 insertions(+), 617 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java
index ba74dbc..40c5a02 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java
@@ -63,7 +63,7 @@ public class BasicFileFinder implements FileFinder {
         *
         * @param builder The builder object.
         */
-       public BasicFileFinder(FileFinderBuilder builder) {
+       public BasicFileFinder(FileFinder.Builder builder) {
                this.roots = builder.roots.toArray(new 
LocalDir[builder.roots.size()]);
                this.cachingLimit = builder.cachingLimit;
                this.include = builder.include.toArray(new 
Pattern[builder.include.size()]);
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java
index 6b87ad5..9d52d7d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java
@@ -12,8 +12,19 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.cp;
 
+import static org.apache.juneau.assertions.Assertions.*;
+import static org.apache.juneau.internal.ClassUtils.*;
+import static org.apache.juneau.internal.ExceptionUtils.*;
+
 import java.io.*;
+import java.nio.file.*;
 import java.util.*;
+import java.util.regex.*;
+import java.util.stream.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.collections.*;
+import org.apache.juneau.internal.*;
 
 /**
  * Utility class for finding regular or localized files on the classpath and 
file system.
@@ -51,12 +62,12 @@ import java.util.*;
  *
  * <p>
  * The default implementation of this interface is {@link BasicFileFinder}.
- * The {@link FileFinderBuilder#implClass(Class)} method is provided for 
instantiating other instances.
+ * The {@link Builder#type(Class)} method is provided for instantiating other 
instances.
  *
  * <h5 class='section'>Example:</h5>
  * <p class='bcode w800'>
  *     <jk>public class</jk> MyFileFinder <jk>extends</jk> BasicFileFinder {
- *             <jk>public</jk> MyFileFinder(FileFinderBuilder 
<jv>builder</jv>) {
+ *             <jk>public</jk> MyFileFinder(Builder <jv>builder</jv>) {
  *                     <jk>super</jk>(builder);
  *             }
  *     }
@@ -68,9 +79,9 @@ import java.util.*;
  * <p>
  * Subclasses must provide a public constructor that takes in any of the 
following arguments:
  * <ul>
- *     <li>{@link FileFinderBuilder} - The builder object.
- *     <li>Any beans present in the registered {@link 
FileFinderBuilder#beanStore(BeanStore) bean store}.
- *     <li>Any {@link Optional} beans optionally present in the registered 
{@link FileFinderBuilder#beanStore(BeanStore) bean store}.
+ *     <li>{@link Builder} - The builder object.
+ *     <li>Any beans present in the registered {@link 
Builder#beanStore(BeanStore) bean store}.
+ *     <li>Any {@link Optional} beans optionally present in the registered 
{@link Builder#beanStore(BeanStore) bean store}.
  * </ul>
  */
 public interface FileFinder {
@@ -83,8 +94,201 @@ public interface FileFinder {
         *
         * @return A new builder.
         */
-       public static FileFinderBuilder create() {
-               return new FileFinderBuilder();
+       public static Builder create() {
+               return new Builder();
+       }
+
+       /**
+        * The builder for this object.
+        */
+       public static class Builder {
+
+               final Set<LocalDir> roots;
+               long cachingLimit;
+               List<Pattern> include, exclude;
+               Class<? extends FileFinder> type;
+               FileFinder impl;
+               BeanStore beanStore;
+
+               /**
+                * Constructor.
+                */
+               protected Builder() {
+                       roots = new LinkedHashSet<>();
+                       cachingLimit = -1;
+                       include = AList.of(Pattern.compile(".*"));
+                       exclude = AList.create();
+               }
+
+               /**
+                * Copy constructor.
+                *
+                * @param copyFrom The builder being copied.
+                */
+               protected Builder(Builder copyFrom) {
+                       roots = new LinkedHashSet<>(copyFrom.roots);
+                       cachingLimit = copyFrom.cachingLimit;
+                       include = AList.of(copyFrom.include);
+                       exclude = AList.of(copyFrom.exclude);
+                       beanStore = copyFrom.beanStore;
+                       type = copyFrom.type;
+                       impl = copyFrom.impl;
+               }
+
+               /**
+                * Create a new {@link FileFinder} using this builder.
+                *
+                * @return A new {@link FileFinder}
+                */
+               public FileFinder build() {
+                       try {
+                               if (impl != null)
+                                       return impl;
+                               Class<? extends FileFinder> ic = 
isConcrete(type) ? type : getDefaultType();
+                               return 
BeanStore.of(beanStore).addBeans(Builder.class, this).createBean(ic);
+                       } catch (ExecutableException e) {
+                               throw runtimeException(e);
+                       }
+               }
+
+               /**
+                * Returns the default bean type if not specified via {@link 
#type(Class)}.
+                *
+                * @return The default bean type.
+                */
+               protected Class<? extends FileFinder> getDefaultType() {
+                       return BasicFileFinder.class;
+               }
+
+               /**
+                * Adds a class subpackage to the lookup paths.
+                *
+                * @param c The class whose package will be added to the lookup 
paths.  Must not be <jk>null</jk>.
+                * @param path The absolute or relative subpath.
+                * @param recursive If <jk>true</jk>, also recursively adds all 
the paths of the parent classes as well.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder cp(Class<?> c, String path, boolean recursive) {
+                       assertArgNotNull("c", c);
+                       while (c != null) {
+                               roots.add(new LocalDir(c, path));
+                               c = recursive ? c.getSuperclass() : null;
+                       }
+                       return this;
+               }
+
+               /**
+                * Adds a file system directory to the lookup paths.
+                *
+                * @param path The path relative to the working directory.  
Must not be <jk>null</jk>
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder dir(String path) {
+                       assertArgNotNull("path", path);
+                       return path(Paths.get(".").resolve(path));
+               }
+
+               /**
+                * Adds a file system directory to the lookup paths.
+                *
+                * @param path The directory path.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder path(Path path) {
+                       roots.add(new LocalDir(path));
+                       return this;
+               }
+
+               /**
+                * Enables in-memory caching of files for quicker retrieval.
+                *
+                * @param cachingLimit The maximum file size in bytes.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder caching(long cachingLimit) {
+                       this.cachingLimit = cachingLimit;
+                       return this;
+               }
+
+               /**
+                * Specifies the regular expression file name patterns to use 
to include files being retrieved from the file source.
+                *
+                * @param patterns
+                *      The regular expression include patterns.
+                *      <br>The default is <js>".*"</js>.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder include(String...patterns) {
+                       this.include = 
Arrays.asList(patterns).stream().map(x->Pattern.compile(x)).collect(Collectors.toList());
+                       return this;
+               }
+
+               /**
+                * Specifies the regular expression file name pattern to use to 
exclude files from being retrieved from the file source.
+                *
+                * @param patterns
+                *      The regular expression exclude patterns.
+                *      <br>If none are specified, no files will be excluded.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder exclude(String...patterns) {
+                       this.exclude = 
Arrays.asList(patterns).stream().map(x->Pattern.compile(x)).collect(Collectors.toList());
+                       return this;
+               }
+
+               /**
+                * Specifies the bean store to use for instantiating the {@link 
FileFinder} object.
+                *
+                * <p>
+                * Can be used to instantiate {@link FileFinder} 
implementations with injected constructor argument beans.
+                *
+                * @param value The new value for this setting.
+                * @return  This object.
+                */
+               @FluentSetter
+               public Builder beanStore(BeanStore value) {
+                       this.beanStore = value;
+                       return this;
+               }
+
+               /**
+                * Specifies a subclass of {@link FileFinder} to create when 
the {@link #build()} method is called.
+                *
+                * @param value The new value for this setting.
+                * @return  This object.
+                */
+               @FluentSetter
+               public Builder type(Class<? extends FileFinder> value) {
+                       this.type = value;
+                       return this;
+               }
+
+               /**
+                * Specifies a pre-instantiated bean for the {@link #build()} 
method to return.
+                *
+                * @param value The value for this setting.
+                * @return This object.
+                */
+               @FluentSetter
+               public Builder impl(FileFinder value) {
+                       this.impl = value;
+                       return this;
+               }
+
+               /**
+                * Creates a copy of this builder.
+                *
+                * @return A copy of this builder.
+                */
+               public Builder copy() {
+                       return new Builder(this);
+               }
        }
 
        /**
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java
deleted file mode 100644
index e23b9c1..0000000
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java
+++ /dev/null
@@ -1,175 +0,0 @@
-// 
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
-// * with the License.  You may obtain a copy of the License at                
                                              *
-// *                                                                           
                                              *
-// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
-// *                                                                           
                                              *
-// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
-// * specific language governing permissions and limitations under the 
License.                                              *
-// 
***************************************************************************************************************************
-package org.apache.juneau.cp;
-
-import static org.apache.juneau.assertions.Assertions.*;
-import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ExceptionUtils.*;
-
-import java.nio.file.*;
-import java.util.*;
-import java.util.regex.*;
-import java.util.stream.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.collections.*;
-import org.apache.juneau.internal.*;
-
-/**
- * Builder for {@link FileFinder} objects.
- */
-@FluentSetters
-public class FileFinderBuilder {
-
-       final Set<LocalDir> roots = new LinkedHashSet<>();
-       long cachingLimit = -1;
-       List<Pattern> include = AList.of(Pattern.compile(".*")), exclude = 
AList.create();
-       private Class<? extends FileFinder> implClass;
-       private BeanStore beanStore;
-
-       /**
-        * Create a new {@link FileFinder} using this builder.
-        *
-        * @return A new {@link FileFinder}
-        */
-       public FileFinder build() {
-               try {
-                       Class<? extends FileFinder> ic = isConcrete(implClass) 
? implClass : getDefaultImplClass();
-                       return 
BeanStore.of(beanStore).addBeans(FileFinderBuilder.class, this).createBean(ic);
-               } catch (ExecutableException e) {
-                       throw runtimeException(e);
-               }
-       }
-
-       /**
-        * Specifies the default implementation class if not specified via 
{@link #implClass(Class)}.
-        *
-        * @return The default implementation class if not specified via {@link 
#implClass(Class)}.
-        */
-       protected Class<? extends FileFinder> getDefaultImplClass() {
-               return BasicFileFinder.class;
-       }
-
-       /**
-        * Adds a class subpackage to the lookup paths.
-        *
-        * @param c The class whose package will be added to the lookup paths.  
Must not be <jk>null</jk>.
-        * @param path The absolute or relative subpath.
-        * @param recursive If <jk>true</jk>, also recursively adds all the 
paths of the parent classes as well.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder cp(Class<?> c, String path, boolean recursive) 
{
-               assertArgNotNull("c", c);
-               while (c != null) {
-                       roots.add(new LocalDir(c, path));
-                       c = recursive ? c.getSuperclass() : null;
-               }
-               return this;
-       }
-
-       /**
-        * Adds a file system directory to the lookup paths.
-        *
-        * @param path The path relative to the working directory.  Must not be 
<jk>null</jk>
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder dir(String path) {
-               assertArgNotNull("path", path);
-               return path(Paths.get(".").resolve(path));
-       }
-
-       /**
-        * Adds a file system directory to the lookup paths.
-        *
-        * @param path The directory path.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder path(Path path) {
-               roots.add(new LocalDir(path));
-               return this;
-       }
-
-       /**
-        * Enables in-memory caching of files for quicker retrieval.
-        *
-        * @param cachingLimit The maximum file size in bytes.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder caching(long cachingLimit) {
-               this.cachingLimit = cachingLimit;
-               return this;
-       }
-
-       /**
-        * Specifies the regular expression file name patterns to use to 
include files being retrieved from the file source.
-        *
-        * @param patterns
-        *      The regular expression include patterns.
-        *      <br>The default is <js>".*"</js>.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder include(String...patterns) {
-               this.include = 
Arrays.asList(patterns).stream().map(x->Pattern.compile(x)).collect(Collectors.toList());
-               return this;
-       }
-
-       /**
-        * Specifies the regular expression file name pattern to use to exclude 
files from being retrieved from the file source.
-        *
-        * @param patterns
-        *      The regular expression exclude patterns.
-        *      <br>If none are specified, no files will be excluded.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder exclude(String...patterns) {
-               this.exclude = 
Arrays.asList(patterns).stream().map(x->Pattern.compile(x)).collect(Collectors.toList());
-               return this;
-       }
-
-       /**
-        * Specifies the bean store to use for instantiating the {@link 
FileFinder} object.
-        *
-        * <p>
-        * Can be used to instantiate {@link FileFinder} implementations with 
injected constructor argument beans.
-        *
-        * @param value The new value for this setting.
-        * @return  This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder beanStore(BeanStore value) {
-               this.beanStore = value;
-               return this;
-       }
-
-       /**
-        * Specifies a subclass of {@link FileFinder} to create when the {@link 
#build()} method is called.
-        *
-        * @param value The new value for this setting.
-        * @return  This object (for method chaining).
-        */
-       @FluentSetter
-       public FileFinderBuilder implClass(Class<? extends FileFinder> value) {
-               this.implClass = value;
-               return this;
-       }
-
-       // <FluentSetters>
-
-       // </FluentSetters>
-}
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java
index 8cd5c82..a8c1429 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java
@@ -47,8 +47,8 @@ public class BasicStaticFiles extends BasicFileFinder 
implements StaticFiles {
         *
         * @return A new builder for this object.
         */
-       public static StaticFilesBuilder create() {
-               return new StaticFilesBuilder();
+       public static StaticFiles.Builder create() {
+               return new StaticFiles.Builder();
        }
 
        /**
@@ -56,7 +56,7 @@ public class BasicStaticFiles extends BasicFileFinder 
implements StaticFiles {
         *
         * @param builder The builder object.
         */
-       public BasicStaticFiles(StaticFilesBuilder builder) {
+       public BasicStaticFiles(StaticFiles.Builder builder) {
                super(builder);
                this.headers = builder.headers.toArray(new 
Header[builder.headers.size()]);
                this.mimeTypes = builder.mimeTypes;
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 4acdcf8..e1953a9 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -217,8 +217,6 @@ public class RestContext extends Context {
        private final AtomicBoolean initialized = new AtomicBoolean(false);
 
        final StaticFiles staticFilesDefault;
-       final FileFinder fileFinderDefault;
-
 
        /**
         * Constructor.
@@ -264,13 +262,10 @@ public class RestContext extends Context {
                        partSerializer = bs.add(HttpPartSerializer.class, 
builder.partSerializer().create());
                        partParser = bs.add(HttpPartParser.class, 
builder.partParser().create());
                        jsonSchemaGenerator = bs.add(JsonSchemaGenerator.class, 
builder.jsonSchemaGenerator().build());
+                       fileFinder = bs.add(FileFinder.class, 
builder.fileFinder().build());
 
                        Object r = resource.get();
 
-                       fileFinder = createFileFinder(r, builder, bs);
-                       bs.addBean(FileFinder.class, fileFinder);
-                       fileFinderDefault = 
builder.fileFinderDefault.value().orElse(fileFinder);
-
                        staticFiles = createStaticFiles(r, builder, bs);
                        bs.addBean(StaticFiles.class, staticFiles);
                        staticFilesDefault = 
builder.staticFilesDefault.value().orElse(staticFiles);
@@ -372,136 +367,6 @@ public class RestContext extends Context {
        }
 
        /**
-        * Instantiates the file finder for this REST resource.
-        *
-        * <p>
-        * The file finder is used to retrieve localized files from the 
classpath.
-        *
-        * <p>
-        * Instantiates based on the following logic:
-        * <ul>
-        *      <li>Returns the resource class itself is an instance of {@link 
FileFinder}.
-        *      <li>Looks for file finder value set via any of the following:
-        *              <ul>
-        *                      <li>{@link 
RestContextBuilder#fileFinder(Class)}/{@link 
RestContextBuilder#fileFinder(FileFinder)}
-        *                      <li>{@link Rest#fileFinder()}.
-        *              </ul>
-        *      <li>Resolves it via the {@link RestContextBuilder#beanStore() 
bean store} registered in this context (including Spring beans if using 
SpringRestServlet).
-        *      <li>Looks for file finder default setting.
-        *      <li>Instantiates via {@link 
#createFileFinderBuilder(Object,RestContextBuilder,BeanStore)}.
-        * </ul>
-        *
-        * <p>
-        * Your REST class can also implement a create method called 
<c>createFileFinder()</c> to instantiate your own
-        * file finder.
-        *
-        * <h5 class='figure'>Example:</h5>
-        * <p class='bpcode w800'>
-        *      <ja>@Rest</ja>
-        *      <jk>public class</jk> MyRestClass {
-        *
-        *              <jk>public</jk> FileFinder createFileFinder() 
<jk>throws</jk> Exception {
-        *                      <jc>// Create your own file finder here.</jc>
-        *              }
-        *      }
-        * </p>
-        *
-        * <p>
-        * The <c>createFileFinder()</c> method can be static or non-static can 
contain any of the following arguments:
-        * <ul>
-        *      <li>{@link FileFinder} - The file finder that would have been 
returned by this method.
-        *      <li>{@link FileFinderBuilder} - The file finder returned by 
{@link #createFileFinderBuilder(Object,RestContextBuilder,BeanStore)}.
-        *      <li>{@link RestContext} - This REST context.
-        *      <li>{@link BeanStore} - The bean store of this REST context.
-        *      <li>Any {@doc RestInjection injected bean} types.  Use {@link 
Optional} arguments for beans that may not exist.
-        * </ul>
-        *
-        * @param resource
-        *      The REST servlet or bean that this context defines.
-        * @param builder
-        *      The builder for this object.
-        * @param beanStore
-        *      The factory used for creating beans and retrieving injected 
beans.
-        *      <br>Created by {@link RestContextBuilder#beanStore()}.
-        * @return The file finder for this REST resource.
-        * @throws Exception If file finder could not be instantiated.
-        */
-       protected FileFinder createFileFinder(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
-
-               FileFinder x = null;
-
-               if (resource instanceof FileFinder)
-                       x = (FileFinder)resource;
-
-               if (x == null)
-                       x = builder.fileFinder.value().orElse(null);
-
-               if (x == null)
-                       x = beanStore.getBean(FileFinder.class).orElse(null);
-
-               if (x == null)
-                       x = builder.fileFinderDefault.value().orElse(null);
-
-               if (x == null)
-                       x = createFileFinderBuilder(resource, builder, 
beanStore).build();
-
-               x = BeanStore
-                       .of(beanStore, resource)
-                       .addBean(FileFinder.class, x)
-                       .beanCreateMethodFinder(FileFinder.class, resource)
-                       .find("createFileFinder")
-                       .withDefault(x)
-                       .run();
-
-               return x;
-       }
-
-       /**
-        * Instantiates the file finder builder for this REST resource.
-        *
-        * <p>
-        * Allows subclasses to intercept and modify the builder used by the 
{@link #createFileFinder(Object,RestContextBuilder,BeanStore)} method.
-        *
-        * @param resource
-        *      The REST servlet or bean that this context defines.
-        * @param builder
-        *      The builder for this object.
-        * @param beanStore
-        *      The factory used for creating beans and retrieving injected 
beans.
-        *      <br>Created by {@link RestContextBuilder#beanStore()}.
-        * @return The file finder builder for this REST resource.
-        * @throws Exception If file finder builder could not be instantiated.
-        */
-       protected FileFinderBuilder createFileFinderBuilder(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
-
-               Class<? extends FileFinder> c = 
builder.fileFinder.type().orElse(null);
-
-               if (c == null)
-                       c = builder.fileFinderDefault.type().orElse(null);
-
-               FileFinderBuilder x = FileFinder
-                       .create()
-                       .beanStore(beanStore)
-                       .implClass(c)
-                       .dir("static")
-                       .dir("htdocs")
-                       .cp(getResourceClass(), "htdocs", true)
-                       .cp(getResourceClass(), "/htdocs", true)
-                       .caching(1_000_000)
-                       .exclude("(?i).*\\.(class|properties)");
-
-               x = BeanStore
-                       .of(beanStore, resource)
-                       .addBean(FileFinderBuilder.class, x)
-                       .beanCreateMethodFinder(FileFinderBuilder.class, 
resource)
-                       .find("createFileFinderBuilder")
-                       .withDefault(x)
-                       .run();
-
-               return x;
-       }
-
-       /**
         * Instantiates the static files finder for this REST resource.
         *
         * <p>
@@ -583,17 +448,17 @@ public class RestContext extends Context {
         * @throws Exception If static files builder could not be instantiated.
         */
        @SuppressWarnings("unchecked")
-       protected StaticFilesBuilder createStaticFilesBuilder(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
+       protected StaticFiles.Builder createStaticFilesBuilder(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
 
                Class<? extends StaticFiles> c = 
builder.staticFiles.type().orElse(null);
 
                if (c == null)
                        c = builder.staticFilesDefault.type().orElse(null);
 
-               StaticFilesBuilder x = StaticFiles
+               StaticFiles.Builder x = StaticFiles
                        .create()
                        .beanStore(beanStore)
-                       .implClass((Class<? extends FileFinder>)c)
+                       .type((Class<? extends FileFinder>)c)
                        .dir("static")
                        .dir("htdocs")
                        .cp(getResourceClass(), "htdocs", true)
@@ -604,8 +469,8 @@ public class RestContext extends Context {
 
                x = BeanStore
                        .of(beanStore, resource)
-                       .addBean(StaticFilesBuilder.class, x)
-                       .beanCreateMethodFinder(StaticFilesBuilder.class, 
resource)
+                       .addBean(StaticFiles.Builder.class, x)
+                       .beanCreateMethodFinder(StaticFiles.Builder.class, 
resource)
                        .find("createStaticFilesBuilder")
                        .withDefault(x)
                        .run();
@@ -738,7 +603,7 @@ public class RestContext extends Context {
         * @param beanStore
         *      The factory used for creating beans and retrieving injected 
beans.
         *      <br>Created by {@link RestContextBuilder#beanStore()}.
-        * @param fileFinder The file finder configured on this bean created by 
{@link #createFileFinder(Object,RestContextBuilder,BeanStore)}.
+        * @param fileFinder The file finder configured on this bean created by 
{@link RestContextBuilder#createFileFinder(BeanStore,Supplier)}.
         * @param messages The localized messages configured on this bean.
         * @param varResolver The variable resolver configured on this bean.
         * @return The info provider for this REST resource.
@@ -782,7 +647,7 @@ public class RestContext extends Context {
         * @param beanStore
         *      The factory used for creating beans and retrieving injected 
beans.
         *      <br>Created by {@link RestContextBuilder#beanStore()}.
-        * @param fileFinder The file finder configured on this bean created by 
{@link #createFileFinder(Object,RestContextBuilder,BeanStore)}.
+        * @param fileFinder The file finder configured on this bean created by 
{@link RestContextBuilder#createFileFinder(BeanStore,Supplier)}.
         * @param messages The localized messages configured on this bean.
         * @param varResolver The variable resolver configured on this bean.
         * @return The REST API builder for this REST resource.
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 95c1813..cddeef7 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -135,6 +135,7 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
        private HttpPartSerializer.Creator partSerializer;
        private HttpPartParser.Creator partParser;
        private JsonSchemaGeneratorBuilder jsonSchemaGenerator;
+       private FileFinder.Builder fileFinder;
 
        String
                allowedHeaderParams = env("RestContext.allowedHeaderParams", 
"Accept,Content-Type"),
@@ -161,8 +162,6 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
        BeanRef<DebugEnablement> debugEnablement = 
BeanRef.of(DebugEnablement.class);
        BeanRef<StaticFiles> staticFiles = BeanRef.of(StaticFiles.class);
        BeanRef<StaticFiles> staticFilesDefault = BeanRef.of(StaticFiles.class);
-       BeanRef<FileFinder> fileFinder = BeanRef.of(FileFinder.class);
-       BeanRef<FileFinder> fileFinderDefault = BeanRef.of(FileFinder.class);
        NamedAttributeList defaultRequestAttributes = 
NamedAttributeList.create();
        HeaderListBuilder defaultRequestHeaders = HeaderList.create();
        HeaderListBuilder defaultResponseHeaders = HeaderList.create();
@@ -239,7 +238,6 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
                        if (parentContext != null) {
                                debugDefault = parentContext.debugDefault;
                                
staticFilesDefault.value(parentContext.staticFilesDefault);
-                               
fileFinderDefault.value(parentContext.fileFinderDefault);
                                defaultClasses = 
parentContext.defaultClasses.copy();
                        } else {
                                defaultClasses = DefaultClassList.create();
@@ -1576,7 +1574,6 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
                return jsonSchemaGenerator;
        }
 
-
        /**
         * Instantiates the JSON schema generator for this REST resource.
         *
@@ -1634,6 +1631,191 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
                return v.get();
        }
 
+       /**
+        * Returns the file finder builder for this context.
+        *
+        * @return The file finder builder for this context.
+        */
+       public FileFinder.Builder fileFinder() {
+               if (fileFinder == null)
+                       fileFinder = createFileFinder(beanStore(), resource());
+               return fileFinder;
+       }
+
+       /**
+        * Instantiates the file finder for this REST resource.
+        *
+        * <p>
+        * The file finder is used to retrieve localized files from the 
classpath.
+        *
+        * <p>
+        * Used to retrieve localized files from the classpath for a variety of 
purposes including:
+        * <ul>
+        *      <li>Resolution of {@link FileVar $F} variable contents.
+        * </ul>
+        *
+        * <p>
+        * The file finder can be accessed through the following methods:
+        * <ul class='javatree'>
+        *      <li class='jm'>{@link RestContext#getFileFinder()}
+        *      <li class='jm'>{@link RestRequest#getFileFinder()}
+        * </ul>
+        *
+        * <p>
+        * The file finder is instantiated via the {@link 
RestContextBuilder#createFileFinder(BeanStore,Supplier)} method which in turn 
instantiates
+        * based on the following logic:
+        * <ul>
+        *      <li>Returns the resource class itself if it's an instance of 
{@link FileFinder}.
+        *      <li>Looks for file finder setting.
+        *      <li>Looks for a public <c>createFileFinder()</> method on the 
resource class with an optional {@link RestContext} argument.
+        *      <li>Instantiates the default file finder as specified via file 
finder default setting.
+        *      <li>Instantiates a {@link BasicFileFinder} which provides basic 
support for finding localized
+        *              resources on the classpath and JVM working directory.
+        * </ul>
+        *
+        * <h5 class='section'>Example:</h5>
+        * <p class='bcode w800'>
+        *      <jc>// Create a file finder that looks for files in the /files 
working subdirectory, but overrides the find()
+        *      // method for special handling of special cases.</jc>
+        *      <jk>public class</jk> MyFileFinder <jk>extends</jk> 
BasicFileFinder {
+        *
+        *              <jk>public</jk> MyFileFinder() {
+        *                      <jk>super</jk>(
+        *                              <jk>new</jk> FileFinderBuilder()
+        *                                      .dir(<js>"/files"</js>)
+        *                      );
+        *              }
+        *
+        *              <ja>@Override</ja> <jc>// FileFinder</jc>
+        *              <jk>protected</jk> Optional&lt;InputStream&gt; 
find(String <jv>name</jv>, Locale <jv>locale</jv>) <jk>throws</jk> IOException {
+        *                      <jc>// Do special handling or just call 
super.find().</jc>
+        *                      <jk>return super</jk>.find(<jv>name</jv>, 
<jv>locale</jv>);
+        *              }
+        *      }
+        * </p>
+        *
+        *      <jc>// Option #1 - Registered via annotation.</jc>
+        *      <ja>@Rest</ja>(fileFinder=MyFileFinder.<jk>class</jk>)
+        *      <jk>public class</jk> MyResource {
+        *
+        *              <jc>// Option #2 - Created via createFileFinder() 
method.</jc>
+        *              <jk>public</jk> FileFinder createFileFinder(RestContext 
<jv>context</jv>) <jk>throws</jk> Exception {
+        *                      <jk>return new</jk> MyFileFinder();
+        *              }
+        *
+        *              <jc>// Option #3 - Registered via builder passed in 
through resource constructor.</jc>
+        *              <jk>public</jk> MyResource(RestContextBuilder 
<jv>builder</jv>) <jk>throws</jk> Exception {
+        *
+        *                      <jc>// Using method on builder.</jc>
+        *                      
<jv>builder</jv>.fileFinder(MyFileFinder.<jk>class</jk>);
+        *
+        *                      <jc>// Use a pre-instantiated object 
instead.</jc>
+        *                      <jv>builder</jv>.fileFinder(<jk>new</jk> 
MyFileFinder());
+        *              }
+        *
+        *              <jc>// Option #4 - Registered via builder passed in 
through init method.</jc>
+        *              <ja>@RestHook</ja>(<jsf>INIT</jsf>)
+        *              <jk>public void</jk> init(RestContextBuilder 
<jv>builder</jv>) <jk>throws</jk> Exception {
+        *                      
<jv>builder</jv>.fileFinder(MyFileFinder.<jk>class</jk>);
+        *              }
+        *
+        *              <jc>// Create a REST method that uses the file 
finder.</jc>
+        *              <ja>@RestGet</ja>
+        *              <jk>public</jk> InputStream foo(RestRequest 
<jv>req</jv>) {
+        *                      <jk>return</jk> 
<jv>req</jv>.getFileFinder().getStream(<js>"foo.json"</js>).orElseThrow(NotFound::<jk>new</jk>);
+        *              }
+        *      }
+        * </p>
+        * <p>
+        * Instantiates based on the following logic:
+        * <ul>
+        *      <li>Returns the resource class itself is an instance of {@link 
FileFinder}.
+        *      <li>Looks for file finder value set via any of the following:
+        *              <ul>
+        *                      <li>{@link RestContextBuilder#fileFinder()}
+        *                      <li>{@link Rest#fileFinder()}.
+        *              </ul>
+        *      <li>Resolves it via the {@link RestContextBuilder#beanStore() 
bean store} registered in this context (including Spring beans if using 
SpringRestServlet).
+        *      <li>Looks for file finder default setting.
+        * </ul>
+        *
+        * <p>
+        * Your REST class can also implement a create method called 
<c>createFileFinder()</c> to instantiate your own
+        * file finder.
+        *
+        * <h5 class='figure'>Example:</h5>
+        * <p class='bpcode w800'>
+        *      <ja>@Rest</ja>
+        *      <jk>public class</jk> MyRestClass {
+        *
+        *              <jk>public</jk> FileFinder createFileFinder() 
<jk>throws</jk> Exception {
+        *                      <jc>// Create your own file finder here.</jc>
+        *              }
+        *      }
+        * </p>
+        *
+        * <p>
+        * The <c>createFileFinder()</c> method can be static or non-static can 
contain any of the following arguments:
+        * <ul>
+        *      <li>{@link FileFinder} - The file finder that would have been 
returned by this method.
+        *      <li>{@link RestContext} - This REST context.
+        *      <li>{@link BeanStore} - The bean store of this REST context.
+        *      <li>Any {@doc RestInjection injected bean} types.  Use {@link 
Optional} arguments for beans that may not exist.
+        * </ul>
+        *
+        * @param beanStore
+        *      The factory used for creating beans and retrieving injected 
beans.
+        * @param resource
+        *      The REST servlet or bean that this context defines.
+        * @return The file finder for this REST resource.
+        */
+       protected FileFinder.Builder createFileFinder(BeanStore beanStore, 
Supplier<?> resource) {
+
+               Value<FileFinder.Builder> v = Value.empty();
+               Object r = resource.get();
+
+               beanStore.getBean(FileFinder.Builder.class).map(x -> 
x.copy()).ifPresent(x -> v.set(x));
+
+               if (v.isEmpty()) {
+                       v.set(
+                               FileFinder
+                                       .create()
+                                       .beanStore(beanStore)
+                                       .dir("static")
+                                       .dir("htdocs")
+                                       .cp(r.getClass(), "htdocs", true)
+                                       .cp(r.getClass(), "/htdocs", true)
+                                       .caching(1_000_000)
+                                       .exclude("(?i).*\\.(class|properties)")
+                       );
+               }
+
+               beanStore.getBean(FileFinder.class).ifPresent(x -> 
v.get().impl(x));
+
+               if (r instanceof FileFinder)
+                       v.get().impl((FileFinder)r);
+
+               defaultClasses.get(FileFinder.class).ifPresent(x -> 
v.get().type(x));
+
+               BeanStore
+                       .of(beanStore, r)
+                       .addBean(FileFinder.Builder.class, v.get())
+                       .beanCreateMethodFinder(FileFinder.Builder.class, r)
+                       .find("createFileFinder")
+                       .execute()
+                       .ifPresent(x -> v.set(x));
+
+               BeanStore
+                       .of(beanStore, r)
+                       .addBean(FileFinder.Builder.class, v.get())
+                       .beanCreateMethodFinder(FileFinder.class, r)
+                       .find("createFileFinder")
+                       .execute()
+                       .ifPresent(x -> v.get().impl(x));
+
+               return v.get();
+       }
+
        
//----------------------------------------------------------------------------------------------------
        // Methods that give access to the config file, var resolver, and 
properties.
        
//----------------------------------------------------------------------------------------------------
@@ -2507,154 +2689,6 @@ public class RestContextBuilder extends ContextBuilder 
implements ServletConfig
        }
 
        /**
-        * Configuration property:  File finder.
-        *
-        * <p>
-        * Used to retrieve localized files from the classpath for a variety of 
purposes including:
-        * <ul>
-        *      <li>Resolution of {@link FileVar $F} variable contents.
-        * </ul>
-        *
-        * <p>
-        * The file finder can be accessed through the following methods:
-        * <ul class='javatree'>
-        *      <li class='jm'>{@link RestContext#getFileFinder()}
-        *      <li class='jm'>{@link RestRequest#getFileFinder()}
-        * </ul>
-        *
-        * <p>
-        * The file finder is instantiated via the {@link 
RestContext#createFileFinder(Object,RestContextBuilder,BeanStore)} method which 
in turn instantiates
-        * based on the following logic:
-        * <ul>
-        *      <li>Returns the resource class itself if it's an instance of 
{@link FileFinder}.
-        *      <li>Looks for file finder setting.
-        *      <li>Looks for a public <c>createFileFinder()</> method on the 
resource class with an optional {@link RestContext} argument.
-        *      <li>Instantiates the default file finder as specified via file 
finder default setting.
-        *      <li>Instantiates a {@link BasicFileFinder} which provides basic 
support for finding localized
-        *              resources on the classpath and JVM working directory.
-        * </ul>
-        *
-        * <h5 class='section'>Example:</h5>
-        * <p class='bcode w800'>
-        *      <jc>// Create a file finder that looks for files in the /files 
working subdirectory, but overrides the find()
-        *      // method for special handling of special cases.</jc>
-        *      <jk>public class</jk> MyFileFinder <jk>extends</jk> 
BasicFileFinder {
-        *
-        *              <jk>public</jk> MyFileFinder() {
-        *                      <jk>super</jk>(
-        *                              <jk>new</jk> FileFinderBuilder()
-        *                                      .dir(<js>"/files"</js>)
-        *                      );
-        *              }
-        *
-        *              <ja>@Override</ja> <jc>// FileFinder</jc>
-        *              <jk>protected</jk> Optional&lt;InputStream&gt; 
find(String <jv>name</jv>, Locale <jv>locale</jv>) <jk>throws</jk> IOException {
-        *                      <jc>// Do special handling or just call 
super.find().</jc>
-        *                      <jk>return super</jk>.find(<jv>name</jv>, 
<jv>locale</jv>);
-        *              }
-        *      }
-        * </p>
-        *
-        *      <jc>// Option #1 - Registered via annotation.</jc>
-        *      <ja>@Rest</ja>(fileFinder=MyFileFinder.<jk>class</jk>)
-        *      <jk>public class</jk> MyResource {
-        *
-        *              <jc>// Option #2 - Created via createFileFinder() 
method.</jc>
-        *              <jk>public</jk> FileFinder createFileFinder(RestContext 
<jv>context</jv>) <jk>throws</jk> Exception {
-        *                      <jk>return new</jk> MyFileFinder();
-        *              }
-        *
-        *              <jc>// Option #3 - Registered via builder passed in 
through resource constructor.</jc>
-        *              <jk>public</jk> MyResource(RestContextBuilder 
<jv>builder</jv>) <jk>throws</jk> Exception {
-        *
-        *                      <jc>// Using method on builder.</jc>
-        *                      
<jv>builder</jv>.fileFinder(MyFileFinder.<jk>class</jk>);
-        *
-        *                      <jc>// Use a pre-instantiated object 
instead.</jc>
-        *                      <jv>builder</jv>.fileFinder(<jk>new</jk> 
MyFileFinder());
-        *              }
-        *
-        *              <jc>// Option #4 - Registered via builder passed in 
through init method.</jc>
-        *              <ja>@RestHook</ja>(<jsf>INIT</jsf>)
-        *              <jk>public void</jk> init(RestContextBuilder 
<jv>builder</jv>) <jk>throws</jk> Exception {
-        *                      
<jv>builder</jv>.fileFinder(MyFileFinder.<jk>class</jk>);
-        *              }
-        *
-        *              <jc>// Create a REST method that uses the file 
finder.</jc>
-        *              <ja>@RestGet</ja>
-        *              <jk>public</jk> InputStream foo(RestRequest 
<jv>req</jv>) {
-        *                      <jk>return</jk> 
<jv>req</jv>.getFileFinder().getStream(<js>"foo.json"</js>).orElseThrow(NotFound::<jk>new</jk>);
-        *              }
-        *      }
-        * </p>
-        *
-        * @param value
-        *      The new value for this setting.
-        *      <br>The default is {@link BasicFileFinder}.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestContextBuilder fileFinder(Class<? extends FileFinder> value) 
{
-               fileFinder.type(value);
-               return this;
-       }
-
-       /**
-        * Configuration property:  File finder.
-        *
-        * <p>
-        * Used to retrieve localized files from the classpath for a variety of 
purposes including:
-        * <ul>
-        *      <li>Resolution of {@link FileVar $F} variable contents.
-        * </ul>
-        *
-        * <p>
-        * Same as {@link #fileFinder(Class)} but takes in a pre-instantiated 
object.
-        *
-        * @param value
-        *      The new value for this setting.
-        *      <br>The default is {@link BasicFileFinder}.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestContextBuilder fileFinder(FileFinder value) {
-               fileFinder.value(value);
-               return this;
-       }
-
-       /**
-        * Configuration property:  File finder default.
-        *
-        * <p>
-        * The default file finder.
-        *
-        * @param value
-        *      The new value for this setting.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestContextBuilder fileFinderDefault(Class<? extends FileFinder> 
value) {
-               fileFinderDefault.type(value);
-               return this;
-       }
-
-       /**
-        * Configuration property:  File finder default.
-        *
-        * <p>
-        * The default file finder.
-        *
-        * @param value
-        *      The new value for this setting.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestContextBuilder fileFinderDefault(FileFinder value) {
-               fileFinderDefault.value(value);
-               return this;
-       }
-
-       /**
         * The maximum allowed input size (in bytes) on HTTP requests.
         *
         * <p>
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFiles.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFiles.java
index bec3c69..77a07e1 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFiles.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFiles.java
@@ -12,9 +12,17 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.rest;
 
+import java.nio.file.*;
 import java.util.*;
 
+import javax.activation.*;
+
+import org.apache.http.*;
+import org.apache.juneau.collections.*;
+import org.apache.juneau.cp.*;
 import org.apache.juneau.http.resource.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.utils.*;
 
 /**
  * API for retrieving localized static files from either the classpath or file 
system.
@@ -29,8 +37,114 @@ public interface StaticFiles {
         *
         * @return A new builder for this object.
         */
-       public static StaticFilesBuilder create() {
-               return new StaticFilesBuilder();
+       public static Builder create() {
+               return new Builder();
+       }
+
+       /**
+        * The builder for this object.
+        */
+       @FluentSetters
+       public static class Builder extends FileFinder.Builder {
+
+               List<Header> headers = AList.create();
+               MimetypesFileTypeMap mimeTypes = new 
ExtendedMimetypesFileTypeMap();
+
+               @Override
+               protected Class<? extends FileFinder> getDefaultType() {
+                       return BasicStaticFiles.class;
+               }
+
+               /**
+                * Appends headers to add to HTTP responses.
+                *
+                * <p>
+                * Can be called multiple times to add multiple headers.
+                *
+                * @param headers The headers to add.
+                * @return This object (for method chaining).
+                */
+               @FluentSetter
+               public Builder headers(Header...headers) {
+                       this.headers.addAll(Arrays.asList(headers));
+                       return this;
+               }
+
+               /**
+                * Prepend the MIME type values to the MIME types registry.
+                *
+                * @param mimeTypes A .mime.types formatted string of entries.  
See {@link MimetypesFileTypeMap#addMimeTypes(String)}.
+                * @return This object (for method chaining).
+                */
+               @FluentSetter
+               public Builder addMimeTypes(String mimeTypes) {
+                       this.mimeTypes.addMimeTypes(mimeTypes);
+                       return this;
+               }
+
+               /**
+                * Replaces the MIME types registry used for determining 
content types.
+                *
+                * @param mimeTypes The new MIME types registry.
+                * @return This object (for method chaining).
+                */
+               @FluentSetter
+               public Builder mimeTypes(MimetypesFileTypeMap mimeTypes) {
+                       this.mimeTypes = mimeTypes;
+                       return this;
+               }
+
+               // <FluentSetters>
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder beanStore(BeanStore value) {
+                       super.beanStore(value);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder caching(long cachingLimit) {
+                       super.caching(cachingLimit);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder cp(Class<?> c, String path, boolean recursive) {
+                       super.cp(c, path, recursive);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder dir(String path) {
+                       super.dir(path);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder exclude(String...patterns) {
+                       super.exclude(patterns);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder type(Class<? extends 
org.apache.juneau.cp.FileFinder> value) {
+                       super.type(value);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder include(String...patterns) {
+                       super.include(patterns);
+                       return this;
+               }
+
+               @Override /* GENERATED - FileFinderBuilder */
+               public Builder path(Path path) {
+                       super.path(path);
+                       return this;
+               }
+
+               // </FluentSetters>
        }
 
        /**
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFilesBuilder.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFilesBuilder.java
deleted file mode 100644
index 8503776..0000000
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFilesBuilder.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// 
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
-// * with the License.  You may obtain a copy of the License at                
                                              *
-// *                                                                           
                                              *
-// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
-// *                                                                           
                                              *
-// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
-// * specific language governing permissions and limitations under the 
License.                                              *
-// 
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import java.nio.file.*;
-import java.util.*;
-
-import javax.activation.*;
-
-import org.apache.http.*;
-import org.apache.juneau.collections.*;
-import org.apache.juneau.cp.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.utils.*;
-
-/**
- * Builder class for {@link BasicStaticFiles} objects.
- */
-@FluentSetters
-public class StaticFilesBuilder extends FileFinderBuilder {
-
-       List<Header> headers = AList.create();
-       MimetypesFileTypeMap mimeTypes = new ExtendedMimetypesFileTypeMap();
-
-       @Override
-       protected Class<? extends FileFinder> getDefaultImplClass() {
-               return BasicStaticFiles.class;
-       }
-
-       /**
-        * Appends headers to add to HTTP responses.
-        *
-        * <p>
-        * Can be called multiple times to add multiple headers.
-        *
-        * @param headers The headers to add.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public StaticFilesBuilder headers(Header...headers) {
-               this.headers.addAll(Arrays.asList(headers));
-               return this;
-       }
-
-       /**
-        * Prepend the MIME type values to the MIME types registry.
-        *
-        * @param mimeTypes A .mime.types formatted string of entries.  See 
{@link MimetypesFileTypeMap#addMimeTypes(String)}.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public StaticFilesBuilder addMimeTypes(String mimeTypes) {
-               this.mimeTypes.addMimeTypes(mimeTypes);
-               return this;
-       }
-
-       /**
-        * Replaces the MIME types registry used for determining content types.
-        *
-        * @param mimeTypes The new MIME types registry.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public StaticFilesBuilder mimeTypes(MimetypesFileTypeMap mimeTypes) {
-               this.mimeTypes = mimeTypes;
-               return this;
-       }
-
-       // <FluentSetters>
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder beanStore(BeanStore value) {
-               super.beanStore(value);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder caching(long cachingLimit) {
-               super.caching(cachingLimit);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder cp(Class<?> c, String path, boolean 
recursive) {
-               super.cp(c, path, recursive);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder dir(String path) {
-               super.dir(path);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder exclude(String...patterns) {
-               super.exclude(patterns);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder implClass(Class<? extends 
org.apache.juneau.cp.FileFinder> value) {
-               super.implClass(value);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder include(String...patterns) {
-               super.include(patterns);
-               return this;
-       }
-
-       @Override /* GENERATED - FileFinderBuilder */
-       public StaticFilesBuilder path(Path path) {
-               super.path(path);
-               return this;
-       }
-
-       // </FluentSetters>
-}
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
index 4216564..81709cb 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java
@@ -1068,7 +1068,7 @@ public class RestAnnotation {
                        
string(a.uriRelativity()).map(UriRelativity::valueOf).ifPresent(x -> 
b.uriRelativity(x));
                        
string(a.uriResolution()).map(UriResolution::valueOf).ifPresent(x -> 
b.uriResolution(x));
                        b.messages().location(c.inner(), 
string(a.messages()).orElse(null));
-                       type(a.fileFinder()).ifPresent(x -> b.fileFinder(x));
+                       type(a.fileFinder()).ifPresent(x -> 
b.fileFinder().type(x));
                        type(a.staticFiles()).ifPresent(x -> b.staticFiles(x));
                        string(a.path()).ifPresent(x -> b.path(x));
                        string(a.clientVersionHeader()).ifPresent(x -> 
b.clientVersionHeader(x));
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java 
b/juneau-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java
index e211ee3..d455f8a 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java
@@ -667,12 +667,12 @@ public class FileFinder_Test {
                        .create()
                        .dir(".")
                        .caching(100_000_000)
-                       .implClass(E03b.class)
+                       .type(E03b.class)
                        .build();
                assertObject(x).isType(E03b.class);
        }
 
-       public static class E03a extends FileFinderBuilder {}
+       public static class E03a extends FileFinder.Builder {}
        public static class E03b extends BasicFileFinder {
                public static E03a create() {
                        return new E03a();
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java 
b/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
index 9e7c82d..bac45d7 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
@@ -45,7 +45,7 @@ public class Swagger_Test {
        public void testMethod() {}
 
        private org.apache.juneau.dto.swagger.Swagger getSwaggerWithFile(Object 
resource) throws Exception {
-               RestContext rc = 
RestContext.create(resource.getClass(),null,null).init(resource).fileFinder(TestClasspathFileFinder.class).build();
+               RestContext rc = 
RestContext.create(resource.getClass(),null,null).init(resource).defaultClasses(TestClasspathFileFinder.class).build();
                RestOpContext roc = 
RestOpContext.create(Swagger_Test.class.getMethod("testMethod"), rc).build();
                RestRequest req = rc.createRequest(new RestCall(resource, rc, 
new MockServletRequest(), new MockServletResponse()).restOpContext(roc));
                SwaggerProvider ip = rc.getSwaggerProvider();

Reply via email to