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 09f28fe  Context API refactoring.
09f28fe is described below

commit 09f28fe60b0bc3bc16b1ee631a14d56fb4ae13a5
Author: JamesBognar <[email protected]>
AuthorDate: Sat Sep 11 14:31:14 2021 -0400

    Context API refactoring.
---
 .../src/main/java/org/apache/juneau/rest/RestContext.java   | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

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 6473949..8d1662a 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
@@ -244,28 +244,25 @@ public class RestContext extends Context {
                try {
                        this.builder = builder;
 
-                       this.resourceClass = builder.resourceClass;
-                       this.resource = builder.resource;
-                       Object r = getResource();
-
+                       resourceClass = builder.resourceClass;
+                       resource = builder.resource;
                        parentContext = builder.parentContext;
-
                        rootBeanStore = builder.beanStore();
 
                        beanStore = rootBeanStore.copy().build();
                        beanStore
                                .addBean(BeanStore.class, beanStore)
                                .addBean(RestContext.class, this)
-                               .addBean(Object.class, r)
+                               .addBean(Object.class, resource.get())
                                .addBean(RestContextBuilder.class, builder)
                                .addBean(AnnotationWorkList.class, 
builder.getApplied());
-
                        BeanStore bs = beanStore;
 
                        logger = bs.add(Logger.class, builder.logger());
                        thrownStore = bs.add(ThrownStore.class, 
builder.thrownStore().build());
                        methodExecStore = bs.add(MethodExecStore.class, 
builder.methodExecStore().thrownStoreOnce(thrownStore).build());
 
+                       Object r = resource.get();
                        Messages m = messages = createMessages(r, builder);
 
                        VarResolver vr = varResolver = builder
@@ -325,7 +322,7 @@ public class RestContext extends Context {
                        debugEnablement = createDebugEnablement(r, builder, bs);
 
                        path = ofNullable(builder.path).orElse("");
-                       fullPath = (builder.parentContext == null ? "" : 
(builder.parentContext.fullPath + '/')) + path;
+                       fullPath = (parentContext == null ? "" : 
(parentContext.fullPath + '/')) + path;
 
                        String p = path;
                        if (! p.endsWith("/*"))

Reply via email to