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 1886b67  Context API refactoring.
1886b67 is described below

commit 1886b67b04ee25413a60988b0bba22757220a2de
Author: JamesBognar <[email protected]>
AuthorDate: Thu Sep 9 19:19:07 2021 -0400

    Context API refactoring.
---
 .../main/java/org/apache/juneau/utils/BeanRef.java |  11 +-
 .../java/org/apache/juneau/rest/RestContext.java   | 184 +++------------------
 .../org/apache/juneau/rest/RestContextBuilder.java | 118 ++++++++++---
 .../java/org/apache/juneau/rest/RestRequest.java   |   4 -
 .../org/apache/juneau/rest/annotation/Rest.java    |   4 -
 .../juneau/rest/annotation/RestAnnotation.java     |   2 +-
 6 files changed, 129 insertions(+), 194 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/BeanRef.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/BeanRef.java
index 9f9c875..1b57906 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/BeanRef.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/BeanRef.java
@@ -18,7 +18,7 @@ import java.util.*;
 
 /**
  * Represents a holder for a bean or bean type.
- * 
+ *
  * @param <T> The bean type.
  */
 public class BeanRef<T> {
@@ -75,4 +75,13 @@ public class BeanRef<T> {
        public Optional<Class<? extends T>> type() {
                return ofNullable(type);
        }
+
+       /**
+        * Returns <jk>true</jk> if neither the value or type is specified on 
this reference.
+        *
+        * @return <jk>true</jk> if neither the value or type is specified on 
this reference.
+        */
+       public boolean isEmpty() {
+               return type == null && value == null;
+       }
 }
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 035c11b..36ee0c9 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
@@ -435,146 +435,6 @@ public class RestContext extends BeanContext {
         */
        public static final String REST_renderResponseStackTraces = PREFIX + 
".renderResponseStackTraces.b";
 
-       /**
-        * Configuration property:  Static file finder.
-        *
-        * <h5 class='section'>Property:</h5>
-        * <ul class='spaced-list'>
-        *      <li><b>ID:</b>  {@link 
org.apache.juneau.rest.RestContext#REST_staticFiles REST_staticFiles}
-        *      <li><b>Name:</b>  <js>"RestContext.staticFiles.o"</js>
-        *      <li><b>Data type:</b>  {@link 
org.apache.juneau.rest.StaticFiles}
-        *      <li><b>Default:</b>  {@link #REST_staticFilesDefault}
-        *      <li><b>Session property:</b>  <jk>false</jk>
-        *      <li><b>Annotations:</b>
-        *              <ul>
-        *                      <li class='ja'>{@link 
org.apache.juneau.rest.annotation.Rest#staticFiles()}
-        *              </ul>
-        *      <li><b>Methods:</b>
-        *              <ul>
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.RestContextBuilder#staticFiles(Class)}
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.RestContextBuilder#staticFiles(StaticFiles)}
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.RestContext#createStaticFiles(Object,ContextProperties,BeanStore)}
-        *              </ul>
-        * </ul>
-        *
-        * <h5 class='section'>Description:</h5>
-        * <p>
-        * Used to retrieve localized files to be served up as static files 
through the REST API via the following
-        * predefined methods:
-        * <ul class='javatree'>
-        *      <li class='jm'>{@link BasicRestObject#getHtdoc(String, Locale)}.
-        *      <li class='jm'>{@link BasicRestServlet#getHtdoc(String, 
Locale)}.
-        * </ul>
-        *
-        * <p>
-        * The static file finder can be accessed through the following methods:
-        * <ul class='javatree'>
-        *      <li class='jm'>{@link RestContext#getStaticFiles()}
-        *      <li class='jm'>{@link RestRequest#getStaticFiles()}
-        * </ul>
-        *
-        * <p>
-        * The static file finder is instantiated via the {@link 
RestContext#createStaticFiles(Object,ContextProperties,BeanStore)} method which 
in turn instantiates
-        * based on the following logic:
-        * <ul>
-        *      <li>Returns the resource class itself is an instance of {@link 
StaticFiles}.
-        *      <li>Looks in {@link #REST_staticFiles} setting.
-        *      <li>Looks for a public <c>createStaticFiles()</> method on the 
resource class with an optional {@link RestContext} argument.
-        *      <li>Instantiates a {@link BasicStaticFiles} 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 static file finder that looks for files in the 
/files working subdirectory, but overrides the find()
-        *      // and resolve methods for special handling of special cases 
and adds a Foo header to all requests.</jc>
-        *      <jk>public class</jk> MyStaticFiles <jk>extends</jk> 
StaticFiles {
-        *
-        *              <jk>public</jk> MyStaticFiles() <jk>extends</jk> 
BasicStaticFiles {
-        *                      <jk>super</jk>(
-        *                              <jk>new</jk> StaticFilesBuilder()
-        *                                      .dir(<js>"/files"</js>)
-        *                                      
.headers(BasicStringHeader.<jsm>of</jsm>(<js>"Foo"</js>, <js>"bar"</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>);
-        *              }
-        *
-        *              <ja>@Override</ja> <jc>// staticFiles</jc>
-        *              <jk>public</jk> Optional&lt;BasicHttpResource&gt; 
resolve(String <jv>path</jv>, Locale <jv>locale</jv>) {
-        *                      <jc>// Do special handling or just call 
super.resolve().</jc>
-        *                      <jk>return super</jk>.resolve(<jv>path</jv>, 
<jv>locale</jv>);
-        *              }
-        *      }
-        * </p>
-        *
-        *      <jc>// Option #1 - Registered via annotation.</jc>
-        *      <ja>@Rest</ja>(staticFiles=MyStaticFiles.<jk>class</jk>)
-        *      <jk>public class</jk> MyResource {
-        *
-        *              <jc>// Option #2 - Created via createStaticFiles() 
method.</jc>
-        *              <jk>public</jk> StaticFiles 
createStaticFiles(RestContext <jv>context</jv>) <jk>throws</jk> Exception {
-        *                      <jk>return new</jk> MyStaticFiles();
-        *              }
-        *
-        *              <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>.staticFiles(MyStaticFiles.<jk>class</jk>);
-        *
-        *                      <jc>// Same, but using property.</jc>
-        *                      
<jv>builder</jv>.set(<jsf>REST_staticFiles</jsf>, 
MyStaticFiles.<jk>class</jk>));
-        *
-        *                      <jc>// Use a pre-instantiated object 
instead.</jc>
-        *                      <jv>builder</jv>.staticFiles(<jk>new</jk> 
MyStaticFiles());
-        *              }
-        *
-        *              <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>.staticFiles(MyStaticFiles.<jk>class</jk>);
-        *              }
-        *
-        *              <jc>// Create a REST method that uses the static files 
finder.</jc>
-        *              <ja>@RestGet<ja>(<js>"/htdocs/*"</js>)
-        *              <jk>public</jk> HttpResource htdocs(RestRequest 
<jv>req</jv>, <ja>@Path</ja>("/*") String <jv>path</jv>, Locale 
<jv>locale</jv>) <jk>throws</jk> NotFound {
-        *                      <jk>return</jk> 
<jv>req</jv>.getStaticFiles().resolve(<jv>path</jv>, 
<jv>locale</jv>).orElseThrow(NotFound::<jk>new</jk>);
-        *              }
-        *      }
-        * </p>
-        */
-       public static final String REST_staticFiles = PREFIX + ".staticFiles.o";
-
-       /**
-        * Configuration property:  Static file finder default.
-        *
-        * <h5 class='section'>Property:</h5>
-        * <ul class='spaced-list'>
-        *      <li><b>ID:</b>  {@link 
org.apache.juneau.rest.RestContext#REST_staticFilesDefault 
REST_staticFilesDefault}
-        *      <li><b>Name:</b>  <js>"RestContext.staticFilesDefault.o"</js>
-        *      <li><b>Data type:</b>  {@link 
org.apache.juneau.rest.StaticFiles}
-        *      <li><b>Default:</b>  {@link 
org.apache.juneau.rest.BasicStaticFiles}
-        *      <li><b>Session property:</b>  <jk>false</jk>
-        *      <li><b>Methods:</b>
-        *              <ul>
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.RestContextBuilder#staticFilesDefault(Class)}
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.RestContextBuilder#staticFilesDefault(StaticFiles)}
-        *              </ul>
-        * </ul>
-        *
-        * <h5 class='section'>Description:</h5>
-        * <p>
-        * The default static file finder.
-        * <p>
-        * This setting is inherited from the parent context.
-        */
-       public static final String REST_staticFilesDefault = PREFIX + 
".staticFilesDefault.o";
-
        
//-------------------------------------------------------------------------------------------------------------------
        // Static
        
//-------------------------------------------------------------------------------------------------------------------
@@ -665,6 +525,8 @@ public class RestContext extends BeanContext {
        // Gets set when postInitChildFirst() gets called.
        private final AtomicBoolean initialized = new AtomicBoolean(false);
 
+       final StaticFiles staticFilesDefault;
+
        /**
         * Constructor.
         *
@@ -766,9 +628,11 @@ public class RestContext extends BeanContext {
                        FileFinder ff = fileFinder = createFileFinder(r, cp, 
bf);
                        bf.addBean(FileFinder.class, ff);
 
-                       staticFiles = createStaticFiles(r, cp, bf);
+                       staticFiles = createStaticFiles(r, builder, bf);
                        bf.addBean(StaticFiles.class, staticFiles);
 
+                       staticFilesDefault = 
builder.staticFilesDefault.value().orElse(staticFiles);
+
                        defaultRequestHeaders = createDefaultRequestHeaders(r, 
builder, bf).build();
                        defaultResponseHeaders = 
createDefaultResponseHeaders(r, builder, bf).build();
                        defaultRequestAttributes = 
createDefaultRequestAttributes(r, builder, bf);
@@ -1128,7 +992,7 @@ public class RestContext extends BeanContext {
         * Instantiates based on the following logic:
         * <ul>
         *      <li>Returns the resource class itself is an instance of 
FileFinder.
-        *      <li>Looks for {@link #REST_staticFiles} value set via any of 
the following:
+        *      <li>Looks for static files set via any of the following:
         *              <ul>
         *                      <li>{@link 
RestContextBuilder#staticFiles(Class)}/{@link 
RestContextBuilder#staticFiles(StaticFiles)}
         *                      <li>{@link Rest#staticFiles()}.
@@ -1142,26 +1006,21 @@ public class RestContext extends BeanContext {
         *                      <li>Any {@doc RestInjection injected beans}.
         *              </ul>
         *      <li>Resolves it via the bean store registered in this context.
-        *      <li>Looks for value in {@link #REST_staticFilesDefault} setting.
+        *      <li>Looks for value in default static files setting.
         *      <li>Instantiates a {@link BasicStaticFiles}.
         * </ul>
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link #REST_staticFiles}
-        * </ul>
-        *
         * @param resource
         *      The REST servlet or bean that this context defines.
-        * @param properties
-        *      The properties of this bean.
-        *      <br>Consists of all properties gathered through the builder and 
annotations on this class and all parent classes.
+        * @param builder
+        *      The builder for this object.
         * @param beanStore
         *      The factory used for creating beans and retrieving injected 
beans.
         *      <br>Created by {@link 
#createBeanStore(Object,ContextProperties,RestContext)}.
         * @return The file finder for this REST resource.
         * @throws Exception If file finder could not be instantiated.
         */
-       protected StaticFiles createStaticFiles(Object resource, 
ContextProperties properties, BeanStore beanStore) throws Exception {
+       protected StaticFiles createStaticFiles(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
 
                StaticFiles x = null;
 
@@ -1169,16 +1028,16 @@ public class RestContext extends BeanContext {
                        x = (StaticFiles)resource;
 
                if (x == null)
-                       x = properties.getIfType(REST_staticFiles, 
StaticFiles.class).orElse(null);
+                       x = builder.staticFiles.value().orElse(null);
 
                if (x == null)
                        x = beanStore.getBean(StaticFiles.class).orElse(null);
 
                if (x == null)
-                       x = properties.getIfType(REST_staticFilesDefault, 
StaticFiles.class).orElse(null);
+                       x = builder.staticFilesDefault.value().orElse(null);
 
                if (x == null)
-                       x = (StaticFiles)createStaticFilesBuilder(resource, 
properties, beanStore).build();
+                       x = (StaticFiles)createStaticFilesBuilder(resource, 
builder, beanStore).build();
 
                x = BeanStore
                        .of(beanStore, resource)
@@ -1195,13 +1054,12 @@ public class RestContext extends BeanContext {
         * Instantiates the static files builder for this REST resource.
         *
         * <p>
-        * Allows subclasses to intercept and modify the builder used by the 
{@link #createStaticFiles(Object,ContextProperties,BeanStore)} method.
+        * Allows subclasses to intercept and modify the builder used by the 
{@link #createStaticFiles(Object,RestContextBuilder,BeanStore)} method.
         *
         * @param resource
         *      The REST servlet or bean that this context defines.
-        * @param properties
-        *      The properties of this bean.
-        *      <br>Consists of all properties gathered through the builder and 
annotations on this class and all parent classes.
+        * @param builder
+        *      The builder for this object.
         * @param beanStore
         *      The factory used for creating beans and retrieving injected 
beans.
         *      <br>Created by {@link 
#createBeanStore(Object,ContextProperties,RestContext)}.
@@ -1209,12 +1067,12 @@ public class RestContext extends BeanContext {
         * @throws Exception If static files builder could not be instantiated.
         */
        @SuppressWarnings("unchecked")
-       protected StaticFilesBuilder createStaticFilesBuilder(Object resource, 
ContextProperties properties, BeanStore beanStore) throws Exception {
+       protected StaticFilesBuilder createStaticFilesBuilder(Object resource, 
RestContextBuilder builder, BeanStore beanStore) throws Exception {
 
-               Class<? extends StaticFiles> c = 
properties.getIfClass(REST_staticFiles, StaticFiles.class).orElse(null);
+               Class<? extends StaticFiles> c = 
builder.staticFiles.type().orElse(null);
 
                if (c == null)
-                       c = properties.getIfClass(REST_staticFilesDefault, 
StaticFiles.class).orElse(null);
+                       c = builder.staticFilesDefault.type().orElse(null);
 
                StaticFilesBuilder x = StaticFiles
                        .create()
@@ -3170,10 +3028,6 @@ public class RestContext extends BeanContext {
        /**
         * Returns the static files associated with this context.
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFiles}
-        * </ul>
-        *
         * @return
         *      The static files for this resource.
         *      <br>Never <jk>null</jk>.
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 1a262aa..c4f488d 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
@@ -139,6 +139,8 @@ public class RestContextBuilder extends BeanContextBuilder 
implements ServletCon
        BeanRef<RestLogger> callLoggerDefault = BeanRef.of(RestLogger.class);
        BeanRef<RestLogger> callLogger = BeanRef.of(RestLogger.class);
        BeanRef<DebugEnablement> debugEnablement = 
BeanRef.of(DebugEnablement.class);
+       BeanRef<StaticFiles> staticFiles = BeanRef.of(StaticFiles.class);
+       BeanRef<StaticFiles> staticFilesDefault = BeanRef.of(StaticFiles.class);
        NamedAttributeList defaultRequestAttributes = 
NamedAttributeList.create();
        HeaderListBuilder defaultRequestHeaders = HeaderList.create();
        HeaderListBuilder defaultResponseHeaders = HeaderList.create();
@@ -223,8 +225,8 @@ public class RestContextBuilder extends BeanContextBuilder 
implements ServletCon
                                RestContext pc = parentContext.get();
                                callLoggerDefault = pc.callLoggerDefault;
                                debugDefault = pc.debugDefault;
+                               staticFilesDefault.value(pc.staticFilesDefault);
                                ContextProperties pcp = 
pc.getContextProperties();
-                               set(REST_staticFilesDefault, 
pcp.get(REST_staticFilesDefault).orElse(null));
                                set(REST_fileFinderDefault, 
pcp.get(REST_fileFinderDefault).orElse(null));
                        }
 
@@ -2410,7 +2412,7 @@ public class RestContextBuilder extends 
BeanContextBuilder implements ServletCon
        }
 
        /**
-        * Configuration property:  Static files finder.
+        * Static files finder.
         *
         * <p>
         * Used to retrieve localized files to be served up as static files 
through the REST API via the following
@@ -2420,20 +2422,95 @@ public class RestContextBuilder extends 
BeanContextBuilder implements ServletCon
         *      <li class='jm'>{@link BasicRestServlet#getHtdoc(String, 
Locale)}.
         * </ul>
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFiles}
+        * <p>
+        * The static file finder can be accessed through the following methods:
+        * <ul class='javatree'>
+        *      <li class='jm'>{@link RestContext#getStaticFiles()}
+        *      <li class='jm'>{@link RestRequest#getStaticFiles()}
+        * </ul>
+        *
+        * <p>
+        * The static file finder is instantiated via the {@link 
RestContext#createStaticFiles(Object,RestContextBuilder,BeanStore)} method 
which in turn instantiates
+        * based on the following logic:
+        * <ul>
+        *      <li>Returns the resource class itself is an instance of {@link 
StaticFiles}.
+        *      <li>Looks for a public <c>createStaticFiles()</> method on the 
resource class with an optional {@link RestContext} argument.
+        *      <li>Instantiates a {@link BasicStaticFiles} 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 static file finder that looks for files in the 
/files working subdirectory, but overrides the find()
+        *      // and resolve methods for special handling of special cases 
and adds a Foo header to all requests.</jc>
+        *      <jk>public class</jk> MyStaticFiles <jk>extends</jk> 
StaticFiles {
+        *
+        *              <jk>public</jk> MyStaticFiles() <jk>extends</jk> 
BasicStaticFiles {
+        *                      <jk>super</jk>(
+        *                              <jk>new</jk> StaticFilesBuilder()
+        *                                      .dir(<js>"/files"</js>)
+        *                                      
.headers(BasicStringHeader.<jsm>of</jsm>(<js>"Foo"</js>, <js>"bar"</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>);
+        *              }
+        *
+        *              <ja>@Override</ja> <jc>// staticFiles</jc>
+        *              <jk>public</jk> Optional&lt;BasicHttpResource&gt; 
resolve(String <jv>path</jv>, Locale <jv>locale</jv>) {
+        *                      <jc>// Do special handling or just call 
super.resolve().</jc>
+        *                      <jk>return super</jk>.resolve(<jv>path</jv>, 
<jv>locale</jv>);
+        *              }
+        *      }
+        * </p>
+        *
+        *      <jc>// Option #1 - Registered via annotation.</jc>
+        *      <ja>@Rest</ja>(staticFiles=MyStaticFiles.<jk>class</jk>)
+        *      <jk>public class</jk> MyResource {
+        *
+        *              <jc>// Option #2 - Created via createStaticFiles() 
method.</jc>
+        *              <jk>public</jk> StaticFiles 
createStaticFiles(RestContext <jv>context</jv>) <jk>throws</jk> Exception {
+        *                      <jk>return new</jk> MyStaticFiles();
+        *              }
+        *
+        *              <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>.staticFiles(MyStaticFiles.<jk>class</jk>);
+        *
+        *                      <jc>// Use a pre-instantiated object 
instead.</jc>
+        *                      <jv>builder</jv>.staticFiles(<jk>new</jk> 
MyStaticFiles());
+        *              }
+        *
+        *              <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>.staticFiles(MyStaticFiles.<jk>class</jk>);
+        *              }
+        *
+        *              <jc>// Create a REST method that uses the static files 
finder.</jc>
+        *              <ja>@RestGet<ja>(<js>"/htdocs/*"</js>)
+        *              <jk>public</jk> HttpResource htdocs(RestRequest 
<jv>req</jv>, <ja>@Path</ja>("/*") String <jv>path</jv>, Locale 
<jv>locale</jv>) <jk>throws</jk> NotFound {
+        *                      <jk>return</jk> 
<jv>req</jv>.getStaticFiles().resolve(<jv>path</jv>, 
<jv>locale</jv>).orElseThrow(NotFound::<jk>new</jk>);
+        *              }
+        *      }
+        * </p>
+        *
         * @param value The new value for this setting.
         * @return This object (for method chaining).
         */
        @FluentSetter
        public RestContextBuilder staticFiles(Class<? extends StaticFiles> 
value) {
-               return set(REST_staticFiles, value);
+               staticFiles.type(value);
+               return this;
        }
 
        /**
-        * Configuration property:  Static files finder.
+        * Static files finder.
         *
         * <p>
         * Used to retrieve localized files to be served up as static files 
through the REST API via the following
@@ -2443,46 +2520,49 @@ public class RestContextBuilder extends 
BeanContextBuilder implements ServletCon
         *      <li class='jm'>{@link BasicRestServlet#getHtdoc(String, 
Locale)}.
         * </ul>
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFiles}
-        * </ul>
+        * <p>
+        * Same as {@link #staticFiles(Class)} but takes in an instantated 
object.
         *
         * @param value The new value for this setting.
         * @return This object (for method chaining).
         */
        @FluentSetter
        public RestContextBuilder staticFiles(StaticFiles value) {
-               return set(REST_staticFiles, value);
+               staticFiles.value(value);
+               return this;
        }
 
        /**
-        * Configuration property:  Static files finder default.
+        * Static files finder default.
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFilesDefault}
-        * </ul>
+        * <p>
+        * The default static file finder.
+        *
+        * <p>
+        * This setting is inherited from the parent context if not overrided 
by this context.
         *
         * @param value The new value for this setting.
         * @return This object (for method chaining).
         */
        @FluentSetter
        public RestContextBuilder staticFilesDefault(Class<? extends 
StaticFiles> value) {
-               return set(REST_staticFilesDefault, value);
+               staticFilesDefault.type(value);
+               return this;
        }
 
        /**
         * Configuration property:  Static files finder default.
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFilesDefault}
-        * </ul>
+        * <p>
+        * Same as {@link #staticFilesDefault(Class)} but takes in an 
instantated object.
         *
         * @param value The new value for this setting.
         * @return This object (for method chaining).
         */
        @FluentSetter
        public RestContextBuilder staticFilesDefault(StaticFiles value) {
-               return set(REST_staticFilesDefault, value);
+               staticFilesDefault.value(value);
+               return this;
        }
 
        /**
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index 1a3a7e2..59d00b7 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -1811,10 +1811,6 @@ public final class RestRequest {
         * <p>
         * Used to retrieve localized files to be served up as static files 
through the REST API.
         *
-        * <ul class='seealso'>
-        *      <li class='jf'>{@link RestContext#REST_staticFiles}
-        * </ul>
-        *
         * @return This object (for method chaining).
         */
        public StaticFiles getStaticFiles() {
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java
index 6f82b12..d5e0372 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java
@@ -1229,10 +1229,6 @@ public @interface Rest {
         *      <li class='jm'>{@link RestContext#getStaticFiles()}
         *      <li class='jm'>{@link RestRequest#getStaticFiles()}
         * </ul>
-        *
-        * <ul class='seealso'>
-        *      <li class='jm'>{@link RestContext#REST_staticFiles}
-        * </ul>
         */
        Class<? extends StaticFiles> staticFiles() default 
StaticFiles.Null.class;
 
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 16a97a2..fa99c44 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
@@ -1063,7 +1063,7 @@ public class RestAnnotation {
                        
string(a.uriResolution()).map(UriResolution::valueOf).ifPresent(x -> 
b.uriResolution(x));
                        b.prependTo(REST_messages, Tuple2.of(c.inner(), 
string(a.messages()).orElse(null)));
                        type(a.fileFinder()).ifPresent(x -> 
b.set(REST_fileFinder, x));
-                       type(a.staticFiles()).ifPresent(x -> 
b.set(REST_staticFiles, 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));
                        type(a.beanStore()).ifPresent(x -> 
b.set(REST_beanStore, x));

Reply via email to