You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2022/08/07 21:26:26 UTC
[juneau] branch jbFixRestNpe updated: Javadocs
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch jbFixRestNpe
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/jbFixRestNpe by this push:
new 2dace3fa2 Javadocs
2dace3fa2 is described below
commit 2dace3fa21bfd5ffdc1f46a26af0e439d2ccb509
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Sun Aug 7 17:25:32 2022 -0400
Javadocs
---
.../02.jrs.AnnotatedClasses.html | 3 -
.../03.jrs.RestOpAnnotatedMethods.html | 1 -
.../02.jrs.JavaMethodParameters.html | 17 +-
.../03.jrs.JavaMethodReturnTypes.html | 17 +-
.../04.jrs.HttpParts/01.jrs.PartMarshallers.html | 4 +-
.../04.jrs.HttpParts/03.jrs.DefaultParts.html | 30 +-
.../08.juneau-rest-server/12.jrs.SvlVariables.html | 11 +-
.../08.juneau-rest-server/13.jrs.StaticFiles.html | 2 +-
.../18.jrs.LoggingAndDebugging.html | 10 +-
juneau-doc/src/main/javadoc/overview.html | 95 +-
.../src/main/javadoc/resources/juneau-doc.css | 2 +-
.../java/org/apache/juneau/rest/RestContext.java | 1302 ++++++++++----------
.../java/org/apache/juneau/rest/RestOpContext.java | 520 ++++----
.../org/apache/juneau/rest/annotation/Rest.java | 46 -
.../juneau/rest/annotation/RestAnnotation.java | 48 -
.../apache/juneau/rest/annotation/RestDelete.java | 11 -
.../rest/annotation/RestDeleteAnnotation.java | 20 -
.../org/apache/juneau/rest/annotation/RestGet.java | 11 -
.../juneau/rest/annotation/RestGetAnnotation.java | 20 -
.../org/apache/juneau/rest/annotation/RestOp.java | 11 -
.../juneau/rest/annotation/RestOpAnnotation.java | 20 -
.../apache/juneau/rest/annotation/RestPost.java | 11 -
.../juneau/rest/annotation/RestPostAnnotation.java | 20 -
.../org/apache/juneau/rest/annotation/RestPut.java | 11 -
.../juneau/rest/annotation/RestPutAnnotation.java | 20 -
.../apache/juneau/rest/config/DefaultConfig.java | 2 -
.../rest/annotation/RestAnnotation_Test.java | 11 -
.../rest/annotation/RestDeleteAnnotation_Test.java | 6 -
.../rest/annotation/RestGetAnnotation_Test.java | 6 -
.../rest/annotation/RestOpAnnotation_Test.java | 6 -
.../rest/annotation/RestPostAnnotation_Test.java | 6 -
.../rest/annotation/RestPutAnnotation_Test.java | 6 -
.../juneau/rest/annotation/Rest_Context_Test.java | 104 --
33 files changed, 1034 insertions(+), 1376 deletions(-)
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/02.jrs.AnnotatedClasses.html b/juneau-doc/docs/Topics/08.juneau-rest-server/02.jrs.AnnotatedClasses.html
index a5f4ae4f2..a22237138 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/02.jrs.AnnotatedClasses.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/02.jrs.AnnotatedClasses.html
@@ -28,13 +28,11 @@
<li class='jma'>{@link oajr.annotation.Rest#allowedMethodHeaders() allowedMethodHeaders}
<li class='jma'>{@link oajr.annotation.Rest#allowedMethodParams() allowedMethodParams}
<li class='jma'>{@link oajr.annotation.Rest#beanStore() beanStore}
- <li class='jma'>{@link oajr.annotation.Rest#builder() builder}
<li class='jma'>{@link oajr.annotation.Rest#callLogger() callLogger}
<li class='jma'>{@link oajr.annotation.Rest#children() children}
<li class='jma'>{@link oajr.annotation.Rest#clientVersionHeader() clientVersionHeader}
<li class='jma'>{@link oajr.annotation.Rest#config() config}
<li class='jma'>{@link oajr.annotation.Rest#consumes() consumes}
- <li class='jma'>{@link oajr.annotation.Rest#contextClass() contextClass}
<li class='jma'>{@link oajr.annotation.Rest#converters() converters}
<li class='jma'>{@link oajr.annotation.Rest#debug() debug}
<li class='jma'>{@link oajr.annotation.Rest#debugEnablement() debugEnablement}
@@ -63,7 +61,6 @@
<li class='jma'>{@link oajr.annotation.Rest#responseProcessors() responseProcessors}
<li class='jma'>{@link oajr.annotation.Rest#restChildrenClass() restChildrenClass}
<li class='jma'>{@link oajr.annotation.Rest#restOpArgs() restOpArgs}
- <li class='jma'>{@link oajr.annotation.Rest#restOpContextClass() restOpContextClass}
<li class='jma'>{@link oajr.annotation.Rest#restOperationsClass() restOperationsClass}
<li class='jma'>{@link oajr.annotation.Rest#roleGuard() roleGuard}
<li class='jma'>{@link oajr.annotation.Rest#rolesDeclared() rolesDeclared}
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods.html b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods.html
index 885b23e96..d565504ce 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods.html
@@ -26,7 +26,6 @@
<ul class='javatreec'>
<li class='jma'>{@link oajr.annotation.RestOp#clientVersion() clientVersion}
<li class='jma'>{@link oajr.annotation.RestOp#consumes() consumes}
- <li class='jma'>{@link oajr.annotation.RestOp#contextClass() contextClass}
<li class='jma'>{@link oajr.annotation.RestOp#converters() converters}
<li class='jma'>{@link oajr.annotation.RestOp#debug() debug}
<li class='jma'>{@link oajr.annotation.RestOp#defaultAccept() defaultAccept}
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/02.jrs.JavaMethodParameters.html b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/02.jrs.JavaMethodParameters.html
index 148258bf3..ec2e3c0d3 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/02.jrs.JavaMethodParameters.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/02.jrs.JavaMethodParameters.html
@@ -182,7 +182,20 @@
| }
</p>
<p>
- Additional parameter types can be defined by overriding {@link oajr.RestContext.Builder#createRestOpArgs(BeanStore,Supplier)} or
- by adding them to the bean store using {@link oajr.RestContext.Builder#createBeanStore(Supplier)}.
+ Additional parameter types can be defined via the annotation {@link oajr.annotation.Rest#restOpArgs()} or by calling {@link oajr.RestContext.Builder#restOpArgs(Class...)}.
+ </p>
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ | <ja>@Rest</ja>(
+ | restOpArgs={ MyOpArg.<jk>class</jk> } <jc>// Option #1 - Via annotation</jc>
+ | )
+ | <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
+ |
+ | // Option #2 - Programmatically
+ | <ja>@RestInit</ja>
+ | <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ | <jv>builder</jv>.restOpArgs(MyOpArg.<jk>class</jk>);
+ | }
+ | }
</p>
</div>
\ No newline at end of file
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/03.jrs.JavaMethodReturnTypes.html b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/03.jrs.JavaMethodReturnTypes.html
index cc1cb4b51..491624ad4 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/03.jrs.JavaMethodReturnTypes.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/03.jrs.RestOpAnnotatedMethods/03.jrs.JavaMethodReturnTypes.html
@@ -149,6 +149,21 @@
| }
</p>
<p>
- Additional parameter types can be defined by overriding {@link oajr.RestContext.Builder#createResponseProcessors(BeanStore,Supplier)}.
+ Additional parameter types can be defined via the annotation {@link oajr.annotation.Rest#responseProcessors()} or by calling {@link oajr.RestContext.Builder#responseProcessors(Class...)}.
</p>
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ | <ja>@Rest</ja>(
+ | responseProcessors={ MyResponseProcessor.<jk>class</jk> } <jc>// Option #1 - Via annotation</jc>
+ | )
+ | <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
+ |
+ | // Option #2 - Programmatically
+ | <ja>@RestInit</ja>
+ | <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ | <jv>builder</jv>.responseProcessors(MyResponseProcessor.<jk>class</jk>);
+ | }
+ | }
+ </p>
+
</div>
\ No newline at end of file
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/01.jrs.PartMarshallers.html b/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/01.jrs.PartMarshallers.html
index ec1b85759..6020a9735 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/01.jrs.PartMarshallers.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/01.jrs.PartMarshallers.html
@@ -56,8 +56,8 @@
</li>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createPartSerializer(BeanStore,Supplier) createPartSerializer(BeanStore,Supplier)}
- <li class='jmp'>{@link oajr.RestContext.Builder#createPartParser(BeanStore,Supplier) createPartParser(BeanStore,Supplier)}
+ <li class='jmp'>{@link oajr.RestContext.Builder#partSerializer(HttpPartSerializer) partSerializer(HttpPartSerializer)}
+ <li class='jmp'>{@link oajr.RestContext.Builder#partParser(HttpPartParser) partParser(HttpPartParser)}
</ul>
</li>
</ul>
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/03.jrs.DefaultParts.html b/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/03.jrs.DefaultParts.html
index 06ae25b3f..6225b6f90 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/03.jrs.DefaultParts.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/04.jrs.HttpParts/03.jrs.DefaultParts.html
@@ -111,49 +111,29 @@
<ul class='javatree'>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createDefaultRequestAttributes(BeanStore,Supplier) createDefaultRequestAttributes(BeanStore,Supplier)}
- <li class='jmp'>{@link oajr.RestContext.Builder#createDefaultRequestHeaders(BeanStore,Supplier) createDefaultRequestHeaders(BeanStore,Supplier)}
- <li class='jmp'>{@link oajr.RestContext.Builder#createDefaultResponseHeaders(BeanStore,Supplier) createDefaultResponseHeaders(BeanStore,Supplier)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultAccept(String) defaultAccept(String)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultCharset(Charset) defaultCharset(Charset)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultContentType(String) defaultContentType(String)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
<li class='jm'>{@link oajr.RestContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
</ul>
</li>
<li class='jc'>{@link oajr.RestOpContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestOpContext.Builder#createDefaultRequestAttributes(BeanStore,RestContext.Builder,Supplier) createDefaultRequestAttributes(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link oajr.RestOpContext.Builder#createDefaultRequestFormData(BeanStore,RestContext.Builder,Supplier) createDefaultRequestFormData(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link oajr.RestOpContext.Builder#createDefaultRequestHeaders(BeanStore,RestContext.Builder,Supplier) createDefaultRequestHeaders(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link oajr.RestOpContext.Builder#createDefaultRequestQueryData(BeanStore,RestContext.Builder,Supplier) createDefaultRequestQueryData(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link oajr.RestOpContext.Builder#createDefaultResponseHeaders(BeanStore,RestContext.Builder,Supplier) createDefaultResponseHeaders(BeanStore,Builder,Supplier)}
<li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
+ <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
<li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestFormData() defaultRequestFormData()}
- <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestFormData(Consumer) defaultRequestFormData(Consumer)}
+ <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestFormData(NameValuePair...) defaultRequestFormData(NameValuePair...)}
<li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
+ <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
<li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestQueryData() defaultRequestQueryData()}
- <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestQueryData(Consumer) defaultRequestQueryData(Consumer)}
+ <li class='jm'>{@link oajr.RestOpContext.Builder#defaultRequestQueryData(NameValuePair...) defaultRequestQueryData(NameValuePair...)}
<li class='jm'>{@link oajr.RestOpContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link oajr.RestOpContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
+ <li class='jm'>{@link oajr.RestOpContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
</ul>
</li>
</ul>
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/12.jrs.SvlVariables.html b/juneau-doc/docs/Topics/08.juneau-rest-server/12.jrs.SvlVariables.html
index e02eb9e4b..70c8c4542 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/12.jrs.SvlVariables.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/12.jrs.SvlVariables.html
@@ -251,9 +251,9 @@
<ul class='javatree'>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createVarResolver(BeanStore,Supplier,Class) createVarResolver(BeanStore,Supplier,Class)}
<li class='jm'>{@link oajr.RestContext.Builder#varResolver() varResolver()}
- <li class='jm'>{@link oajr.RestContext.Builder#varResolver(Consumer) varResolver(Consumer)}
+ <li class='jm'>{@link oajr.RestContext.Builder#vars(Class...) vars(Class...)}
+ <li class='jm'>{@link oajr.RestContext.Builder#vars(Var...) vars(Var...)}
</ul>
</li>
</ul>
@@ -275,10 +275,11 @@
|
| <jc>// Register it with our resource.</jc>
| <ja>@Rest</ja>(...)
- | <jk>public class</jk> MyResource {
+ | <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
|
- | <jk>public</jk> MyResource(RestContext.Builder <jv>builder</jv>) {
- | <jv>builder</jv>.varResolver().vars(BracketVar.<jk>class</jk>);
+ | <ja>@RestInit</ja>
+ | <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ | <jv>builder</jv>.vars(BracketVar.<jk>class</jk>);
| }
| }
</p>
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/13.jrs.StaticFiles.html b/juneau-doc/docs/Topics/08.juneau-rest-server/13.jrs.StaticFiles.html
index 3d5d1ac40..5fa607963 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/13.jrs.StaticFiles.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/13.jrs.StaticFiles.html
@@ -63,7 +63,7 @@
<ul class='javatree'>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createStaticFiles() createStaticFiles(BeanStore,Supplier)}
+ <li class='jmp'>{@link oajr.RestContext.Builder#staticFiles(StaticFiles) staticFiles(StaticFiles)}
<li class='jm'>{@link oajr.RestContext.Builder#staticFiles() staticFiles()}
</ul>
</li>
diff --git a/juneau-doc/docs/Topics/08.juneau-rest-server/18.jrs.LoggingAndDebugging.html b/juneau-doc/docs/Topics/08.juneau-rest-server/18.jrs.LoggingAndDebugging.html
index 23dc4cc74..60fcdcc93 100644
--- a/juneau-doc/docs/Topics/08.juneau-rest-server/18.jrs.LoggingAndDebugging.html
+++ b/juneau-doc/docs/Topics/08.juneau-rest-server/18.jrs.LoggingAndDebugging.html
@@ -91,8 +91,9 @@
<li class='jc'>{@link oajr.debug.BasicDebugEnablement}
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createDebugEnablement(BeanStore,Supplier) createDebugEnablement(BeanStore,Supplier)}
<li class='jm'>{@link oajr.RestContext.Builder#debugEnablement() debugEnablement()}
+ <li class='jm'>{@link oajr.RestContext.Builder#debugEnablement(Class) debugEnablement(Class)}
+ <li class='jm'>{@link oajr.RestContext.Builder#debugEnablement(DebugEnablement) debugEnablement(DebugEnablement)}
</ul>
</li>
</ul>
@@ -168,8 +169,9 @@
</li>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createCallLogger(BeanStore,Supplier) createCallLogger(BeanStore,Supplier)}
<li class='jm'>{@link oajr.RestContext.Builder#callLogger() callLogger()}
+ <li class='jm'>{@link oajr.RestContext.Builder#callLogger(Class) callLogger(Class)}
+ <li class='jm'>{@link oajr.RestContext.Builder#callLogger(CallLogger) callLogger(CallLogger)}
</ul>
</li>
</ul>
@@ -216,9 +218,9 @@
<ul class='javatree'>
<li class='jc'>{@link oajr.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link oajr.RestContext.Builder#createThrownStore(BeanStore,Supplier,RestContext) createThrownStore(BeanStore,Supplier)}
<li class='jm'>{@link oajr.RestContext.Builder#thrownStore() thrownStore()}
- <li class='jm'>{@link oajr.RestContext.Builder#thrownStore(Consumer) thrownStore(Consumer)}
+ <li class='jm'>{@link oajr.RestContext.Builder#thrownStore(Class) thrownStore(Class)}
+ <li class='jm'>{@link oajr.RestContext.Builder#thrownStore(ThrownStore) thrownStore(ThrownStore)}
</ul>
</li>
</ul>
diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html
index 200c92365..a8457add7 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -16382,13 +16382,11 @@
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#allowedMethodHeaders() allowedMethodHeaders}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#allowedMethodParams() allowedMethodParams}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#beanStore() beanStore}
- <li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#builder() builder}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#callLogger() callLogger}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#children() children}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#clientVersionHeader() clientVersionHeader}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#config() config}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#consumes() consumes}
- <li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#contextClass() contextClass}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#converters() converters}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#debug() debug}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#debugEnablement() debugEnablement}
@@ -16417,7 +16415,6 @@
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#responseProcessors() responseProcessors}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#restChildrenClass() restChildrenClass}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#restOpArgs() restOpArgs}
- <li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#restOpContextClass() restOpContextClass}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#restOperationsClass() restOperationsClass}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#roleGuard() roleGuard}
<li class='jma'>{@link org.apache.juneau.rest.annotation.Rest#rolesDeclared() rolesDeclared}
@@ -16862,7 +16859,6 @@
<ul class='javatreec'>
<li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#clientVersion() clientVersion}
<li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#consumes() consumes}
- <li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#contextClass() contextClass}
<li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#converters() converters}
<li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#debug() debug}
<li class='jma'>{@link org.apache.juneau.rest.annotation.RestOp#defaultAccept() defaultAccept}
@@ -17156,8 +17152,21 @@
}
</p>
<p>
- Additional parameter types can be defined by overriding {@link org.apache.juneau.rest.RestContext.Builder#createRestOpArgs(BeanStore,Supplier)} or
- by adding them to the bean store using {@link org.apache.juneau.rest.RestContext.Builder#createBeanStore(Supplier)}.
+ Additional parameter types can be defined via the annotation {@link org.apache.juneau.rest.annotation.Rest#restOpArgs()} or by calling {@link org.apache.juneau.rest.RestContext.Builder#restOpArgs(Class...)}.
+ </p>
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ <ja>@Rest</ja>(
+ restOpArgs={ MyOpArg.<jk>class</jk> } <jc>// Option #1 - Via annotation</jc>
+ )
+ <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
+
+ // Option #2 - Programmatically
+ <ja>@RestInit</ja>
+ <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ <jv>builder</jv>.restOpArgs(MyOpArg.<jk>class</jk>);
+ }
+ }
</p>
</div>
</div><!-- END: 8.3.2 - juneau-rest-server.jrs.RestOpAnnotatedMethods.jrs.JavaMethodParameters -->
@@ -17300,8 +17309,23 @@
}
</p>
<p>
- Additional parameter types can be defined by overriding {@link org.apache.juneau.rest.RestContext.Builder#createResponseProcessors(BeanStore,Supplier)}.
+ Additional parameter types can be defined via the annotation {@link org.apache.juneau.rest.annotation.Rest#responseProcessors()} or by calling {@link org.apache.juneau.rest.RestContext.Builder#responseProcessors(Class...)}.
+ </p>
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ <ja>@Rest</ja>(
+ responseProcessors={ MyResponseProcessor.<jk>class</jk> } <jc>// Option #1 - Via annotation</jc>
+ )
+ <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
+
+ // Option #2 - Programmatically
+ <ja>@RestInit</ja>
+ <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ <jv>builder</jv>.responseProcessors(MyResponseProcessor.<jk>class</jk>);
+ }
+ }
</p>
+
</div>
</div><!-- END: 8.3.3 - juneau-rest-server.jrs.RestOpAnnotatedMethods.jrs.JavaMethodReturnTypes -->
@@ -17711,8 +17735,8 @@
</li>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createPartSerializer(BeanStore,Supplier) createPartSerializer(BeanStore,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createPartParser(BeanStore,Supplier) createPartParser(BeanStore,Supplier)}
+ <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#partSerializer(HttpPartSerializer) partSerializer(HttpPartSerializer)}
+ <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#partParser(HttpPartParser) partParser(HttpPartParser)}
</ul>
</li>
</ul>
@@ -18280,49 +18304,29 @@
<ul class='javatree'>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createDefaultRequestAttributes(BeanStore,Supplier) createDefaultRequestAttributes(BeanStore,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createDefaultRequestHeaders(BeanStore,Supplier) createDefaultRequestHeaders(BeanStore,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createDefaultResponseHeaders(BeanStore,Supplier) createDefaultResponseHeaders(BeanStore,Supplier)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultAccept(String) defaultAccept(String)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultCharset(Charset) defaultCharset(Charset)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultContentType(String) defaultContentType(String)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
</ul>
</li>
<li class='jc'>{@link org.apache.juneau.rest.RestOpContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestOpContext.Builder#createDefaultRequestAttributes(BeanStore,RestContext.Builder,Supplier) createDefaultRequestAttributes(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestOpContext.Builder#createDefaultRequestFormData(BeanStore,RestContext.Builder,Supplier) createDefaultRequestFormData(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestOpContext.Builder#createDefaultRequestHeaders(BeanStore,RestContext.Builder,Supplier) createDefaultRequestHeaders(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestOpContext.Builder#createDefaultRequestQueryData(BeanStore,RestContext.Builder,Supplier) createDefaultRequestQueryData(BeanStore,Builder,Supplier)}
- <li class='jmp'>{@link org.apache.juneau.rest.RestOpContext.Builder#createDefaultResponseHeaders(BeanStore,RestContext.Builder,Supplier) createDefaultResponseHeaders(BeanStore,Builder,Supplier)}
<li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestAttributes() defaultRequestAttributes()}
- <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestAttributes(Consumer) defaultRequestAttributes(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestAttributes(NamedAttribute...) defaultRequestAttributes(NamedAttribute...)}
<li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestFormData() defaultRequestFormData()}
- <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestFormData(Consumer) defaultRequestFormData(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestFormData(NameValuePair...) defaultRequestFormData(NameValuePair...)}
<li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestHeaders() defaultRequestHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestHeaders(Consumer) defaultRequestHeaders(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestHeaders(Header...) defaultRequestHeaders(Header...)}
<li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestQueryData() defaultRequestQueryData()}
- <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestQueryData(Consumer) defaultRequestQueryData(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultRequestQueryData(NameValuePair...) defaultRequestQueryData(NameValuePair...)}
<li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultResponseHeaders() defaultResponseHeaders()}
- <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultResponseHeaders(Consumer) defaultResponseHeaders(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#defaultResponseHeaders(Header...) defaultResponseHeaders(Header...)}
</ul>
</li>
</ul>
@@ -19620,9 +19624,9 @@
<ul class='javatree'>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createVarResolver(BeanStore,Supplier,Class) createVarResolver(BeanStore,Supplier,Class)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#varResolver() varResolver()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#varResolver(Consumer) varResolver(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#vars(Class...) vars(Class...)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#vars(Var...) vars(Var...)}
</ul>
</li>
</ul>
@@ -19644,10 +19648,11 @@
<jc>// Register it with our resource.</jc>
<ja>@Rest</ja>(...)
- <jk>public class</jk> MyResource {
+ <jk>public class</jk> MyResource <jk>extends</jk> BasicRestObject <jk>implements</jk> BasicUniversalConfig {
- <jk>public</jk> MyResource(RestContext.Builder <jv>builder</jv>) {
- <jv>builder</jv>.varResolver().vars(BracketVar.<jk>class</jk>);
+ <ja>@RestInit</ja>
+ <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) {
+ <jv>builder</jv>.vars(BracketVar.<jk>class</jk>);
}
}
</p>
@@ -19721,7 +19726,7 @@
<ul class='javatree'>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createStaticFiles() createStaticFiles(BeanStore,Supplier)}
+ <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#staticFiles(StaticFiles) staticFiles(StaticFiles)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#staticFiles() staticFiles()}
</ul>
</li>
@@ -21353,8 +21358,9 @@
<li class='jc'>{@link org.apache.juneau.rest.debug.BasicDebugEnablement}
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createDebugEnablement(BeanStore,Supplier) createDebugEnablement(BeanStore,Supplier)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#debugEnablement() debugEnablement()}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#debugEnablement(Class) debugEnablement(Class)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#debugEnablement(DebugEnablement) debugEnablement(DebugEnablement)}
</ul>
</li>
</ul>
@@ -21430,8 +21436,9 @@
</li>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createCallLogger(BeanStore,Supplier) createCallLogger(BeanStore,Supplier)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#callLogger() callLogger()}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#callLogger(Class) callLogger(Class)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#callLogger(CallLogger) callLogger(CallLogger)}
</ul>
</li>
</ul>
@@ -21478,9 +21485,9 @@
<ul class='javatree'>
<li class='jc'>{@link org.apache.juneau.rest.RestContext.Builder}
<ul class='javatreec'>
- <li class='jmp'>{@link org.apache.juneau.rest.RestContext.Builder#createThrownStore(BeanStore,Supplier,RestContext) createThrownStore(BeanStore,Supplier)}
<li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#thrownStore() thrownStore()}
- <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#thrownStore(Consumer) thrownStore(Consumer)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#thrownStore(Class) thrownStore(Class)}
+ <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#thrownStore(ThrownStore) thrownStore(ThrownStore)}
</ul>
</li>
</ul>
diff --git a/juneau-doc/src/main/javadoc/resources/juneau-doc.css b/juneau-doc/src/main/javadoc/resources/juneau-doc.css
index dfbb7c3c5..f3e062dbf 100755
--- a/juneau-doc/src/main/javadoc/resources/juneau-doc.css
+++ b/juneau-doc/src/main/javadoc/resources/juneau-doc.css
@@ -232,7 +232,7 @@ red { color:red; }
review { display:block; background-color:#ffdf00; padding:10px; border-radius:5px; text-align:center; box-shadow:1px 1px 1px 0px rgba(0, 0, 0, 0.5); margin:20px 0px; font-weight:bold; width:800px !important; }
reviewed { display:block; background-color:lightgreen; padding:10px; border-radius:5px; text-align:center; box-shadow:1px 1px 1px 0px rgba(0, 0, 0, 0.5); margin:20px 0px; font-weight:bold; width:800px !important; }
-ul.javatreec, .javatreec ul { padding-left:0px; margin:0px; }
+ul.javatreec, .javatreec ul { padding-left:0px; margin:0px;max-width:900px; }
.javatreec li { display:inline-block; padding-left:5px; }
.javatreec li::before { font-weight:bolder; font-size:x-small; }
.javatreec li.ja::before { color:#00ced1; content:'\00a0\00a0\24d0\00a0'; }
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 791e08a33..61099080f 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
@@ -15,7 +15,6 @@ package org.apache.juneau.rest;
import static javax.servlet.http.HttpServletResponse.*;
import static org.apache.juneau.collections.JsonMap.*;
import static org.apache.juneau.http.HttpHeaders.*;
-import static org.apache.juneau.internal.ArgUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.IOUtils.*;
@@ -124,15 +123,6 @@ public class RestContext extends Context {
// Static
//-------------------------------------------------------------------------------------------------------------------
- /**
- * Represents a null value for the {@link Rest#contextClass()} annotation.
- */
- public static final class Void extends RestContext {
- private Void(Builder builder) throws Exception {
- super(builder);
- }
- }
-
private static final Map<Class<?>, RestContext> REGISTRY = new ConcurrentHashMap<>();
/**
@@ -147,12 +137,6 @@ public class RestContext extends Context {
/**
* Creates a new builder for this object.
*
- * <p>
- * The builder class can be subclassed by using the {@link Rest#builder()} annotation.
- * This can be useful when you want to perform any customizations on the builder class, typically by overriding protected methods that create
- * the various builders used in the created {@link RestContext} object (which itself can be overridden via {@link RestContext.Builder#type(Class)}).
- * The subclass must contain a public constructor that takes in the same arguments passed in to this method.
- *
* @param resourceClass
* The class annotated with <ja>@Rest</ja>.
* <br>Must not be <jk>null</jk>.
@@ -168,21 +152,7 @@ public class RestContext extends Context {
* @throws ServletException Something bad happened.
*/
public static Builder create(Class<?> resourceClass, RestContext parentContext, ServletConfig servletConfig) throws ServletException {
-
- Value<Class<? extends Builder>> v = Value.of(Builder.class);
- ClassInfo.of(resourceClass).forEachAnnotation(Rest.class, x -> isNotVoid(x.builder()), x -> v.set(x.builder()));
-
- if (v.get() == Builder.class)
- return new Builder(resourceClass, parentContext, servletConfig);
-
- return BeanStore
- .of(parentContext == null ? null : parentContext.getRootBeanStore())
- .addBean(Class.class, resourceClass)
- .addBean(RestContext.class, parentContext)
- .addBean(ServletConfig.class, servletConfig)
- .createBean(Builder.class)
- .type(v.get())
- .run();
+ return new Builder(resourceClass, parentContext, servletConfig);
}
//-------------------------------------------------------------------------------------------------------------------
@@ -193,16 +163,7 @@ public class RestContext extends Context {
* Builder class.
*/
@FluentSetters(ignore={"set"})
- public static class Builder extends Context.Builder implements ServletConfig {
-
- /**
- * Represents a <jk>null</jk> value for the {@link Rest#builder()} annotation.
- */
- public static final class Void extends Builder {
- private Void(Class<?> resourceClass, RestContext parentContext, ServletConfig servletConfig) {
- super(resourceClass, parentContext, servletConfig);
- }
- }
+ public static final class Builder extends Context.Builder implements ServletConfig {
private static final Set<Class<?>> DELAYED_INJECTION = set(
BeanContext.Builder.class,
@@ -599,16 +560,22 @@ public class RestContext extends Context {
* Returns the bean store in this builder.
*
* <p>
- * Can be used to add more beans to the bean store.
+ * The bean store is a simple storage database for beans keyed by type and name.
*
* <p>
- * The bean store is created by the constructor using the {@link #createBeanStore(Supplier)} method and is initialized with the following beans:
- * <ul>
- * <li>{@link RestContext.Builder}
- * <li>{@link ServletConfig}
- * <li>{@link ServletContext}
- * <li>{@link VarResolver}
- * <li>{@link Config}
+ * The bean store is created with the parent root bean store as the parent, allowing any beans in the root bean store to be available
+ * in this builder. The root bean store typically pulls from an injection framework such as Spring to allow injected beans to be used.
+ *
+ * <p>
+ * The default bean store can be overridden via any of the following:
+ * <ul class='spaced-list'>
+ * <li>Class annotation: {@link Rest#beanStore() @Rest(beanStore)}
+ * <li>{@link RestBean @RestBean}-annotated methods:
+ * <p class='bjava'>
+ * <ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] BeanStore.Builder myMethod(<i><args></i>) {...}
+ * <ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] BeanStore myMethod(<i><args></i>) {...}
+ * </p>
+ * Args can be any injected bean including {@link org.apache.juneau.cp.BeanStore.Builder}, the default builder.
* </ul>
*
* @return The bean store in this builder.
@@ -618,30 +585,51 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the bean store in this builder.
+ * Adds a bean to the bean store of this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.beanStore().add(<jv>beanType</jv>, <jv>bean</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param <T> The class to associate this bean with.
+ * @param beanType The class to associate this bean with.
+ * @param bean The bean. Can be <jk>null</jk>.
+ * @return This object.
+ */
+ public <T> Builder beanStore(Class<T> beanType, T bean) {
+ beanStore().addBean(beanType, bean);
+ return this;
+ }
+
+ /**
+ * Adds a bean to the bean store of this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .beanStore(<jv>x</jv> -> <jv>x</jv>.addSupplier(MyBean.<jk>class</jk>, ()-><jsm>getMyBean</jsm>()))
- * .build();
+ * <jv>builder</jv>.beanStore().add(<jv>beanType</jv>, <jv>bean</jv>, <jv>name</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param <T> The class to associate this bean with.
+ * @param beanType The class to associate this bean with.
+ * @param bean The bean. Can be <jk>null</jk>.
+ * @param name The bean name if this is a named bean. Can be <jk>null</jk>.
* @return This object.
*/
- public Builder beanStore(Consumer<BeanStore> operation) {
- operation.accept(beanStore());
+ public <T> Builder beanStore(Class<T> beanType, T bean, String name) {
+ beanStore().addBean(beanType, bean, name);
return this;
}
/**
* Returns the root bean store.
*
+ * <p>
+ * This is the bean store inherited from the parent resource and does not include
+ * any beans added by this class.
+ *
* @return The root bean store.
*/
public BeanStore rootBeanStore() {
@@ -651,22 +639,6 @@ public class RestContext extends Context {
/**
* Creates the bean store in this builder.
*
- * <p>
- * Gets called in the constructor to create the bean store used for finding other beans.
- *
- * <p>
- * The bean store is created with the parent root bean store as the parent, allowing any beans in the root bean store to be available
- * in this builder. The root bean store typically pulls from an injection framework such as Spring to allow injected beans to be used.
- *
- * The default bean store can be overridden via any of the following methods:
- * <ul>
- * <li>Annotation: {@link Rest#beanStore()}
- * <li>Method: <c><ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] BeanStore.Builder myMethod(<i><args></i>)</c>
- * <br>Args can be any injectable bean including {@link org.apache.juneau.cp.BeanStore.Builder}, the default builder.
- * <li>Method: <c><ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] BeanStore myMethod(<i><args></i>)</c>
- * <br>Args can be any injectable bean including {@link org.apache.juneau.cp.BeanStore.Builder}, the default builder.
- * </ul>
- *
* @param resource
* The REST servlet/bean instance that this context is defined against.
* @return A new bean store builder.
@@ -707,30 +679,62 @@ public class RestContext extends Context {
* Returns the variable resolver sub-builder.
*
* <p>
- * Can be used to add more variables or context objects to the variable resolver.
- * These variables affect the variable resolver returned by {@link RestRequest#getVarResolverSession()} which is
- * used to resolve string variables of the form <js>"$X{...}"</js> in various places such as annotations on the REST class and methods.
+ * The variable resolver is used to resolve string variables of the form <js>"$X{...}"</js> in various places such as annotations on the REST class and methods.
+ *
+ * <p>
+ * Can be used to add more variables or context objects to the variable resolver.
+ * These variables affect the variable resolver returned by {@link RestRequest#getVarResolverSession()}.
+ *
+ * <p>
+ * The var resolver is created by the constructor using the {@link #createVarResolver(BeanStore,Supplier,Class)} method and is initialized with the following variables:
+ * <ul class='javatreec'>
+ * <li class='jc'>{@link ArgsVar}
+ * <li class='jc'>{@link CoalesceVar}
+ * <li class='jc'>{@link ConfigVar}
+ * <li class='jc'>{@link EnvVariablesVar}
+ * <li class='jc'>{@link FileVar}
+ * <li class='jc'>{@link HtmlWidgetVar}
+ * <li class='jc'>{@link IfVar}
+ * <li class='jc'>{@link LenVar}
+ * <li class='jc'>{@link LocalizationVar}
+ * <li class='jc'>{@link LowerCaseVar}
+ * <li class='jc'>{@link ManifestFileVar}
+ * <li class='jc'>{@link NotEmptyVar}
+ * <li class='jc'>{@link PatternExtractVar}
+ * <li class='jc'>{@link PatternMatchVar}
+ * <li class='jc'>{@link PatternReplaceVar}
+ * <li class='jc'>{@link RequestAttributeVar}
+ * <li class='jc'>{@link RequestFormDataVar}
+ * <li class='jc'>{@link RequestHeaderVar}
+ * <li class='jc'>{@link RequestPathVar}
+ * <li class='jc'>{@link RequestQueryVar}
+ * <li class='jc'>{@link RequestSwaggerVar}
+ * <li class='jc'>{@link RequestVar}
+ * <li class='jc'>{@link SerializedRequestAttrVar}
+ * <li class='jc'>{@link ServletInitParamVar}
+ * <li class='jc'>{@link SubstringVar}
+ * <li class='jc'>{@link SwaggerVar}
+ * <li class='jc'>{@link SwitchVar}
+ * <li class='jc'>{@link SystemPropertiesVar}
+ * <li class='jc'>{@link UpperCaseVar}
+ * <li class='jc'>{@link UrlEncodeVar}
+ * <li class='jc'>{@link UrlVar}
+ * </ul>
*
* <p>
- * The var resolver is created by the constructor using the {@link #createVarResolver(BeanStore,Supplier,Class)} method and is initialized with the following beans:
- * <ul>
- * <li>{@link ConfigVar}
- * <li>{@link FileVar}
- * <li>{@link SystemPropertiesVar}
- * <li>{@link EnvVariablesVar}
- * <li>{@link ArgsVar}
- * <li>{@link ManifestFileVar}
- * <li>{@link SwitchVar}
- * <li>{@link IfVar}
- * <li>{@link CoalesceVar}
- * <li>{@link PatternMatchVar}
- * <li>{@link PatternReplaceVar}
- * <li>{@link PatternExtractVar}
- * <li>{@link UpperCaseVar}
- * <li>{@link LowerCaseVar}
- * <li>{@link NotEmptyVar}
- * <li>{@link LenVar}
- * <li>{@link SubstringVar}
+ * The default var resolver can be overridden via any of the following:
+ * <ul class='spaced-list'>
+ * <li>Injected via bean store.
+ * <li>{@link RestBean @RestBean}-annotated methods:
+ * <p class='bjava'>
+ * <ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] VarResolver.Builder myMethod(<i><args></i>) {...}
+ * <ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] VarResolver myMethod(<i><args></i>) {...}
+ * </p>
+ * Args can be any injected bean including {@link org.apache.juneau.svl.VarResolver.Builder}, the default builder.
+ * </ul>
+ *
+ * <ul class='seealso'>
+ * <li>{@doc jrs.SvlVariables}
* </ul>
*
* @return The variable resolver sub-builder.
@@ -740,49 +744,54 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the variable resolver sub-builder.
+ * Adds one or more variables to the var resolver of this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .varResolver(<jv>x</jv> -> <jv>x</jv>.vars(MyVar.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.vars().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * <ul class='seealso'>
+ * <li>{@doc jrs.SvlVariables}
+ * </ul>
+ *
+ * @param value The values to add.
* @return This object.
*/
- public Builder varResolver(Consumer<VarResolver.Builder> operation) {
- operation.accept(varResolver());
+ @SafeVarargs
+ public final Builder vars(Class<? extends Var>...value) {
+ varResolver.vars(value);
return this;
}
/**
- * Creates the variable resolver sub-builder.
+ * Adds one or more variables to the var resolver of this class.
*
* <p>
- * Gets called in the constructor to create the var resolver for performing variable resolution in strings.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.vars().add(<jv>value</jv>);
+ * </p>
*
- * <p>
- * Instantiates based on the following logic:
- * <ol>
- * <li>
- * Looks for the following method on the resource class and sets it as the implementation bean:
- * <br><c><jk>public static</jk> VarResolver createVarResolver(<any-bean-types-in-bean-store>) {}</c>
- * <li>
- * Looks for bean of type {@link org.apache.juneau.svl.VarResolver} in bean store and sets it as the implementation bean.
- * <li>
- * Looks for the following method on the resource class:
- * <br><c><jk>public static</jk> VarResolver.Builder createVarResolver(<any-bean-types-in-bean-store>) {}</c>
- * <li>
- * Looks for bean of type {@link org.apache.juneau.svl.VarResolver.Builder} in bean store and returns a copy of it.
- * <li>
- * Creates a default builder with default variables pulled from {@link #createVars(BeanStore,Supplier,Class)}.
- * </ol>
+ * <ul class='seealso'>
+ * <li>{@doc jrs.SvlVariables}
+ * </ul>
+ *
+ * @param value The values to add.
+ * @return This object.
+ */
+ public Builder vars(Var...value) {
+ varResolver.vars(value);
+ return this;
+ }
+
+ /**
+ * Creates the variable resolver sub-builder.
+ *
+ * <ul class='seealso'>
+ * <li>{@doc jrs.SvlVariables}
+ * </ul>
*
* @param beanStore
* The factory used for creating beans and retrieving injected beans.
@@ -799,8 +808,27 @@ public class RestContext extends Context {
VarResolver
.create()
.defaultVars()
- .vars(createVars(beanStore, resource, resourceClass))
- .vars(FileVar.class)
+ .vars(
+ VarList.of(
+ ConfigVar.class,
+ FileVar.class,
+ LocalizationVar.class,
+ RequestAttributeVar.class,
+ RequestFormDataVar.class,
+ RequestHeaderVar.class,
+ RequestPathVar.class,
+ RequestQueryVar.class,
+ RequestVar.class,
+ RequestSwaggerVar.class,
+ SerializedRequestAttrVar.class,
+ ServletInitParamVar.class,
+ SwaggerVar.class,
+ UrlVar.class,
+ UrlEncodeVar.class,
+ HtmlWidgetVar.class
+ )
+ .addDefault()
+ )
.bean(FileFinder.class, FileFinder.create(beanStore).cp(resourceClass,null,true).build())
);
@@ -825,70 +853,6 @@ public class RestContext extends Context {
return v.get();
}
- /**
- * Instantiates the variable resolver variables for this REST resource.
- *
- * <p>
- * Instantiates based on the following logic:
- * <ol>
- * <li>
- * Looks for the following method on the resource class:
- * <br><c><jk>public static</jk> VarList createVars(<any-bean-types-in-bean-store>) {}</c>
- * <li>
- * Looks for bean of type {@link org.apache.juneau.svl.VarList} in bean store and returns a copy of it.
- * <li>
- * Creates a default builder with default variables.
- * </ol>
- *
- * @param beanStore
- * The factory used for creating beans and retrieving injected beans.
- * @param resource
- * The REST servlet/bean instance that this context is defined against.
- * @param resourceClass
- * The REST servlet/bean type that this context is defined against.
- * @return A new var resolver variable list.
- */
- protected VarList createVars(BeanStore beanStore, Supplier<?> resource, Class<?> resourceClass) {
-
- // Default value.
- Value<VarList> v = Value.of(
- VarList.of(
- ConfigVar.class,
- FileVar.class,
- LocalizationVar.class,
- RequestAttributeVar.class,
- RequestFormDataVar.class,
- RequestHeaderVar.class,
- RequestPathVar.class,
- RequestQueryVar.class,
- RequestVar.class,
- RequestSwaggerVar.class,
- SerializedRequestAttrVar.class,
- ServletInitParamVar.class,
- SwaggerVar.class,
- UrlVar.class,
- UrlEncodeVar.class,
- HtmlWidgetVar.class
- )
- .addDefault()
- );
-
- // Replace with bean from bean store.
- beanStore
- .getBean(VarList.class)
- .map(x -> x.copy())
- .ifPresent(x -> v.set(x));
-
- // Replace with bean from: @RestBean public [static] VarList xxx(<args>)
- beanStore
- .createMethodFinder(VarList.class)
- .addBean(VarList.class, v.get())
- .find(Builder::isRestBeanMethod)
- .run(x -> v.set(x));
-
- return v.get();
- }
-
//-----------------------------------------------------------------------------------------------------------------
// config
//-----------------------------------------------------------------------------------------------------------------
@@ -897,46 +861,30 @@ public class RestContext extends Context {
* Returns the external configuration file for this resource.
*
* <p>
- * The configuration file location is determined via the {@link Rest#config() @Rest(config)}
- * annotation on the resource.
- *
- * <p>
- * The config file can be programmatically overridden by adding the following method to your resource:
- * <p class='bjava'>
- * <jk>public</jk> Config createConfig(ServletConfig <jv>servletConfig</jv>) <jk>throws</jk> ServletException;
- * </p>
+ * The default config can be overridden via any of the following:
+ * <ul class='spaced-list'>
+ * <li>Injected via bean store.
+ * <li>Class annotation: {@link Rest#config() @Rest(config)}
+ * <li>{@link RestBean @RestBean}-annotated method:
+ * <p class='bjava'>
+ * <ja>@RestBean</ja> <jk>public</jk> [<jk>static</jk>] Config myMethod(<i><args></i>) {...}
+ * </p>
+ * Args can be any injected bean.
+ * </ul>
*
* <p>
* If a config file is not set up, then an empty config file will be returned that is not backed by any file.
*
+ * <ul class='seealso'>
+ * <li>{@doc jrs.ConfigurationFiles}
+ * </ul>
+ *
* @return The external configuration file for this resource.
*/
public Config config() {
return config;
}
- /**
- * Applies an operation to the external configuration file for this resource.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .config(<jv>x</jv> -> <jv>x</jv>.set(<js>"Foo/bar"</js>, <js>"baz"</js>).save())
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder config(Consumer<Config> operation) {
- operation.accept(config());
- return this;
- }
-
/**
* Overwrites the default config file with a custom config file.
*
@@ -945,6 +893,10 @@ public class RestContext extends Context {
* annotation.
* This method allows you to programmatically override it with your own custom config file.
*
+ * <ul class='seealso'>
+ * <li>{@doc jrs.ConfigurationFiles}
+ * </ul>
+ *
* @param config The new config file.
* @return This object.
*/
@@ -957,6 +909,10 @@ public class RestContext extends Context {
/**
* Creates the config for this builder.
*
+ * <ul class='seealso'>
+ * <li>{@doc jrs.ConfigurationFiles}
+ * </ul>
+ *
* @param beanStore
* The factory used for creating beans and retrieving injected beans.
* @param resource
@@ -1018,28 +974,6 @@ public class RestContext extends Context {
return logger;
}
- /**
- * Applies an operation to the logger for this resource.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .logger(<jv>x</jv> -> <jv>x</jv>.setFilter(<jv>logFilter</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder logger(Consumer<Logger> operation) {
- operation.accept(logger());
- return this;
- }
-
/**
* Sets the logger for this resource.
*
@@ -1117,24 +1051,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the thrown-store sub-builder.
+ * Specifies the thrown store for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.thrownStore().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder thrownStore(Class<? extends ThrownStore> value) {
+ thrownStore().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the thrown store for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .logger(<jv>x</jv> -> <jv>x</jv>.statsImplClass(MyStatsImplClass.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.thrownStore().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder thrownStore(Consumer<ThrownStore.Builder> operation) {
- operation.accept(thrownStore());
+ public Builder thrownStore(ThrownStore value) {
+ thrownStore().impl(value);
return this;
}
@@ -1217,24 +1163,37 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the encoder group sub-builder.
+ * Adds one or more encoders to this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.encoders().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder encoders(Class<? extends Encoder>...value) {
+ encoders().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more encoders to this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .encoders(<jv>x</jv> -> <jv>x</jv>.add(MyEncoder.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.encoders().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public Builder encoders(Consumer<EncoderSet.Builder> operation) {
- operation.accept(encoders());
+ public Builder encoders(Encoder...value) {
+ encoders().add(value);
return this;
}
@@ -1321,24 +1280,37 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the serializer group sub-builder.
+ * Adds one or more serializers to this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.serializers().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder serializers(Class<? extends Serializer>...value) {
+ serializers().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more serializers to this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .serializers(<jv>x</jv> -> <jv>x</jv>.add(MySerializer.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.serializers().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public Builder serializers(Consumer<SerializerSet.Builder> operation) {
- operation.accept(serializers());
+ public Builder serializers(Serializer...value) {
+ serializers().add(value);
return this;
}
@@ -1403,24 +1375,37 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the parser group sub-builder.
+ * Adds one or more parsers to this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.parsers().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder parsers(Class<? extends Parser>...value) {
+ parsers().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more parsers to this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .parsers(<jv>x</jv> -> <jv>x</jv>.add(MyParser.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.parsers().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public Builder parsers(Consumer<ParserSet.Builder> operation) {
- operation.accept(parsers());
+ public Builder parsers(Parser...value) {
+ parsers().add(value);
return this;
}
@@ -1485,24 +1470,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the method execution statistics store sub-builder.
+ * Specifies the method execution store for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.methodExecStore().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder methodExecStore(Class<? extends MethodExecStore> value) {
+ methodExecStore().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the method execution store for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .methodExecStore(<jv>x</jv> -> <jv>x</jv>.statsImplClass(MyStats.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.methodExecStore().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder methodExecStore(Consumer<MethodExecStore.Builder> operation) {
- operation.accept(methodExecStore());
+ public Builder methodExecStore(MethodExecStore value) {
+ methodExecStore().impl(value);
return this;
}
@@ -1566,24 +1563,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the messages sub-builder.
+ * Specifies the messages bundle for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.messages().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder messages(Class<? extends Messages> value) {
+ messages().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the messages bundle for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .messages(<jv>x</jv> -> <jv>x</jv>.name(<js>"MyMessages"</js>))
- * .build();
+ * <jv>builder</jv>.messages().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder messages(Consumer<Messages.Builder> operation) {
- operation.accept(messages());
+ public Builder messages(Messages value) {
+ messages().impl(value);
return this;
}
@@ -1795,24 +1804,37 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the response processor list sub-builder.
+ * Adds one or more response processors to this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.responseProcessors().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder responseProcessors(Class<? extends ResponseProcessor>...value) {
+ responseProcessors().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more response processors to this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .responseProcessors(<jv>x</jv> -> <jv>x</jv>.add(MyResponseProcessor.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.responseProcessors().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public Builder responseProcessors(Consumer<ResponseProcessorList.Builder> operation) {
- operation.accept(responseProcessors());
+ public Builder responseProcessors(ResponseProcessor...value) {
+ responseProcessors().add(value);
return this;
}
@@ -1959,9 +1981,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the call logger class to use for this REST context.
+ * Specifies the call logger for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.callLogger().type(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder callLogger(Class<? extends CallLogger> value) {
@@ -1970,9 +1998,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the call logger class to use for this REST context.
+ * Specifies the call logger for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.callLogger().impl(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder callLogger(CallLogger value) {
@@ -2042,7 +2076,7 @@ public class RestContext extends Context {
}
//-----------------------------------------------------------------------------------------------------------------
- // partSerializer
+ // beanContext
//-----------------------------------------------------------------------------------------------------------------
/**
@@ -2056,28 +2090,6 @@ public class RestContext extends Context {
return beanContext;
}
- /**
- * Applies an operation to the bean context sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .beanContext(<jv>x</jv> -> <jv>x</jv>.interfaces(MyInterface.<jk>class</jk>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder beanContext(Consumer<BeanContext.Builder> operation) {
- operation.accept(beanContext());
- return this;
- }
-
/**
* Instantiates the bean context sub-builder.
*
@@ -2151,24 +2163,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the part serializer sub-builder.
+ * Specifies the part serializer to use for serializing HTTP parts for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.partSerializer().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder partSerializer(Class<? extends HttpPartSerializer> value) {
+ partSerializer().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the part serializer to use for serializing HTTP parts for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .partSerializer(<jv>x</jv> -> <jv>x</jv>.builder(OpenApiSerializer.Builder.<jk>class</jk>, <jv>y</jv> -> <jv>y</jv>.sortProperties()))
- * .build();
+ * <jv>builder</jv>.partSerializer().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder partSerializer(Consumer<HttpPartSerializer.Creator> operation) {
- operation.accept(partSerializer());
+ public Builder partSerializer(HttpPartSerializer value) {
+ partSerializer().impl(value);
return this;
}
@@ -2263,24 +2287,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the part parser sub-builder.
+ * Specifies the part parser to use for parsing HTTP parts for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.partParser().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder partParser(Class<? extends HttpPartParser> value) {
+ partParser().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the part parser to use for parsing HTTP parts for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .partParser(<jv>x</jv> -> <jv>x</jv>.builder(OpenApiParser.Builder.<jk>class</jk>, <jv>y</jv> -> <jv>y</jv>.ignoreUnknownBeanProperties()))
- * .build();
+ * <jv>builder</jv>.partParser().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder partParser(Consumer<HttpPartParser.Creator> operation) {
- operation.accept(partParser());
+ public Builder partParser(HttpPartParser value) {
+ partParser().impl(value);
return this;
}
@@ -2375,24 +2411,36 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the JSON schema generator sub-builder.
+ * Specifies the JSON schema generator for this class.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.jsonSchemaGenerator().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder jsonSchemaGenerator(Class<? extends JsonSchemaGenerator> value) {
+ jsonSchemaGenerator().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the JSON schema generator for this class.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .jsonSchemaGenerator(<jv>x</jv> -> <jv>x</jv>.allowNestedExamples()))
- * .build();
+ * <jv>builder</jv>.jsonSchemaGenerator().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public Builder jsonSchemaGenerator(Consumer<JsonSchemaGenerator.Builder> operation) {
- operation.accept(jsonSchemaGenerator());
+ public Builder jsonSchemaGenerator(JsonSchemaGenerator value) {
+ jsonSchemaGenerator().impl(value);
return this;
}
@@ -2470,9 +2518,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the file finder class to use for this REST context.
+ * Specifies the file finder for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.fileFinder().type(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder fileFinder(Class<? extends FileFinder> value) {
@@ -2481,9 +2535,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the file finder class to use for this REST context.
+ * Specifies the file finder for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.fileFinder().impl(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder fileFinder(FileFinder value) {
@@ -2656,9 +2716,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the static files class to use for this REST context.
+ * Specifies the static files resource finder for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.staticFiles().type(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder staticFiles(Class<? extends StaticFiles> value) {
@@ -2667,9 +2733,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the static files class to use for this REST context.
+ * Specifies the static files resource finder for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.staticFiles().impl(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder staticFiles(StaticFiles value) {
@@ -2812,27 +2884,27 @@ public class RestContext extends Context {
return defaultRequestHeaders;
}
- /**
- * Applies an operation to the default request headers sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .defaultRequestHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder defaultRequestHeaders(Consumer<HeaderList.Builder> operation) {
- operation.accept(defaultRequestHeaders());
- return this;
- }
+// /**
+// * Applies an operation to the default request headers sub-builder.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .defaultRequestHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder defaultRequestHeaders(Consumer<HeaderList.Builder> operation) {
+// operation.accept(defaultRequestHeaders());
+// return this;
+// }
/**
* Default request headers.
@@ -2978,27 +3050,27 @@ public class RestContext extends Context {
return defaultResponseHeaders;
}
- /**
- * Applies an operation to the default response headers sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .defaultResponseHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder defaultResponseHeaders(Consumer<HeaderList.Builder> operation) {
- operation.accept(defaultResponseHeaders());
- return this;
- }
+// /**
+// * Applies an operation to the default response headers sub-builder.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .defaultResponseHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder defaultResponseHeaders(Consumer<HeaderList.Builder> operation) {
+// operation.accept(defaultResponseHeaders());
+// return this;
+// }
/**
* Default response headers.
@@ -3110,27 +3182,27 @@ public class RestContext extends Context {
return defaultRequestAttributes;
}
- /**
- * Applies an operation to the default request attributes sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .defaultRequestAttributes(<jv>x</jv> -> <jv>x</jv>.add(BasicNamedAttribute.<jsm>of</jsm>(<js>"Foo"</js>, ()-><jsm>getFoo</jsm>()))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder defaultRequestAttributes(Consumer<NamedAttributeList.Builder> operation) {
- operation.accept(defaultRequestAttributes());
- return this;
- }
+// /**
+// * Applies an operation to the default request attributes sub-builder.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .defaultRequestAttributes(<jv>x</jv> -> <jv>x</jv>.add(BasicNamedAttribute.<jsm>of</jsm>(<js>"Foo"</js>, ()-><jsm>getFoo</jsm>()))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder defaultRequestAttributes(Consumer<NamedAttributeList.Builder> operation) {
+// operation.accept(defaultRequestAttributes());
+// return this;
+// }
/**
* Default request attributes.
@@ -3239,99 +3311,21 @@ public class RestContext extends Context {
}
/**
- * Applies an operation to the REST operation args sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .restOpArgs(<jv>x</jv> -> <jv>x</jv>.add(MyRestOpArg.<jk>class</jk>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder restOpArgs(Consumer<RestOpArgList.Builder> operation) {
- operation.accept(restOpArgs());
- return this;
- }
-
- /**
- * Java method parameter resolvers.
- *
- * <p>
- * By default, the Juneau framework will automatically Java method parameters of various types (e.g.
- * <c>RestRequest</c>, <c>Accept</c>, <c>Reader</c>).
- * This annotation allows you to provide your own resolvers for your own class types that you want resolved.
+ * Adds one or more REST operation args to this class.
*
* <p>
- * For example, if you want to pass in instances of <c>MySpecialObject</c> to your Java method, define
- * the following resolver:
+ * Equivalent to calling:
* <p class='bjava'>
- * <jc>// Define a parameter resolver for resolving MySpecialObject objects.</jc>
- * <jk>public class</jk> MyRestOpArg <jk>implements</jk> RestOpArg {
- *
- * <jc>// Must implement a static creator method that takes in a ParamInfo that describes the parameter
- * // being checked. If the parameter isn't of type MySpecialObject, then it should return null.</jc>
- * <jk>public static</jk> MyRestOpArg <jsm>create</jsm>(ParamInfo <jv>paramInfo</jv>) {
- * <jk>if</jk> (<jv>paramInfo</jv>.isType(MySpecialObject.<jk>class</jk>)
- * <jk>return new</jk> MyRestParam();
- * <jk>return null</jk>;
- * }
- *
- * <jk>public</jk> MyRestOpArg(ParamInfo <jv>paramInfo</jv>) {}
- *
- * <jc>// The method that creates our object.
- * // In this case, we're taking in a query parameter and converting it to our object.</jc>
- * <ja>@Override</ja>
- * <jk>public</jk> Object resolve(RestCall <jv>call</jv>) <jk>throws</jk> Exception {
- * <jk>return new</jk> MySpecialObject(<jv>call</jv>.getRestRequest().getQuery().get(<js>"myparam"</js>));
- * }
- * }
- *
- * <jc>// Option #1 - Registered via annotation.</jc>
- * <ja>@Rest</ja>(restOpArgs=MyRestParam.<jk>class</jk>)
- * <jk>public class</jk> MyResource {
- *
- * <jc>// Option #2 - Registered via builder passed in through resource constructor.</jc>
- * <jk>public</jk> MyResource(RestContext.Builder <jv>builder</jv>) <jk>throws</jk> Exception {
- *
- * <jc>// Using method on builder.</jc>
- * <jv>builder</jv>.restOpArgs(MyRestParam.<jk>class</jk>);
- * }
- *
- * <jc>// Option #3 - Registered via builder passed in through init method.</jc>
- * <ja>@RestInit</ja>
- * <jk>public void</jk> init(RestContext.Builder <jv>builder</jv>) <jk>throws</jk> Exception {
- * <jv>builder</jv>.restOpArgs(MyRestParam.<jk>class</jk>);
- * }
- *
- * <jc>// Now pass it into your method.</jc>
- * <ja>@RestPost</ja>(...)
- * <jk>public</jk> Object doMyMethod(MySpecialObject <jv>mySpecialObject</jv>) {
- * <jc>// Do something with it.</jc>
- * }
- * }
+ * <jv>builder</jv>.restOpArgs().add(<jv>value</jv>);
* </p>
*
- * <ul class='notes'>
- * <li class='note'>
- * Inner classes of the REST resource class are allowed.
- * <li class='note'>
- * Refer to {@link RestOpArg} for the list of predefined parameter resolvers.
- * </ul>
- *
- * @param values The values to add to this setting.
+ * @param value The new value.
* @return This object.
- * @throws IllegalArgumentException if any class does not extend from {@link RestOpArg}.
*/
+ @SafeVarargs
@FluentSetter
- public Builder restOpArgs(Class<?>...values) {
- restOpArgs().add(assertClassArrayArgIsType("values", RestOpArg.class, values));
+ public final Builder restOpArgs(Class<? extends RestOpArg>...value) {
+ restOpArgs().add(value);
return this;
}
@@ -3522,27 +3516,27 @@ public class RestContext extends Context {
return startCallMethods;
}
- /**
- * Applies an operation to the start call method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .startCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder startCallMethods(Consumer<MethodList> operation) {
- operation.accept(startCallMethods());
- return this;
- }
+// /**
+// * Applies an operation to the start call method list.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .startCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder startCallMethods(Consumer<MethodList> operation) {
+// operation.accept(startCallMethods());
+// return this;
+// }
/**
* Instantiates the start call method list.
@@ -3585,27 +3579,27 @@ public class RestContext extends Context {
return endCallMethods;
}
- /**
- * Applies an operation to the end call method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .endCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder endCallMethods(Consumer<MethodList> operation) {
- operation.accept(endCallMethods());
- return this;
- }
+// /**
+// * Applies an operation to the end call method list.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .endCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder endCallMethods(Consumer<MethodList> operation) {
+// operation.accept(endCallMethods());
+// return this;
+// }
/**
* Instantiates the end call method list.
@@ -3648,27 +3642,27 @@ public class RestContext extends Context {
return postInitMethods;
}
- /**
- * Applies an operation to the post-init method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .postInitMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder postInitMethods(Consumer<MethodList> operation) {
- operation.accept(postInitMethods());
- return this;
- }
+// /**
+// * Applies an operation to the post-init method list.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .postInitMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder postInitMethods(Consumer<MethodList> operation) {
+// operation.accept(postInitMethods());
+// return this;
+// }
/**
* Instantiates the post-init method list.
@@ -3711,27 +3705,27 @@ public class RestContext extends Context {
return postInitChildFirstMethods;
}
- /**
- * Applies an operation to the post-init-child-first method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .postInitChildFirstMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder postInitChildFirstMethods(Consumer<MethodList> operation) {
- operation.accept(postInitChildFirstMethods());
- return this;
- }
+// /**
+// * Applies an operation to the post-init-child-first method list.
+// *
+// * <p>
+// * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+// *
+// * <h5 class='section'>Example:</h5>
+// * <p class='bjava'>
+// * RestContext <jv>context</jv> = RestContext
+// * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
+// * .postInitChildFirstMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
+// * .build();
+// * </p>
+// *
+// * @param operation The operation to apply.
+// * @return This object.
+// */
+// public Builder postInitChildFirstMethods(Consumer<MethodList> operation) {
+// operation.accept(postInitChildFirstMethods());
+// return this;
+// }
/**
* Instantiates the post-init-child-first method list.
@@ -3774,28 +3768,6 @@ public class RestContext extends Context {
return destroyMethods;
}
- /**
- * Applies an operation to the destroy method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .destroyMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder destroyMethods(Consumer<MethodList> operation) {
- operation.accept(destroyMethods());
- return this;
- }
-
/**
* Instantiates the destroy method list.
*
@@ -3840,28 +3812,6 @@ public class RestContext extends Context {
return preCallMethods;
}
- /**
- * Applies an operation to the pre-call method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .preCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder preCallMethods(Consumer<MethodList> operation) {
- operation.accept(preCallMethods());
- return this;
- }
-
/**
* Instantiates the pre-call method list.
*
@@ -3906,28 +3856,6 @@ public class RestContext extends Context {
return postCallMethods;
}
- /**
- * Applies an operation to the post-call method list.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestContext <jv>context</jv> = RestContext
- * .<jsm>create</jsm>(<jv>resourceClass</jv>, <jv>parentContext</jv>, <jv>servletConfig</jv>)
- * .postCallMethods(<jv>x</jv> -> <jv>x</jv>.add(<jv>extraMethod</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public Builder postCallMethods(Consumer<MethodList> operation) {
- operation.accept(postCallMethods());
- return this;
- }
-
/**
* Instantiates the post-call method list.
*
@@ -4196,9 +4124,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the call logger class to use for this REST context.
+ * Specifies the swagger provider for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.swaggerProvider().type(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder swaggerProvider(Class<? extends SwaggerProvider> value) {
@@ -4207,9 +4141,15 @@ public class RestContext extends Context {
}
/**
- * Specifies the call logger class to use for this REST context.
+ * Specifies the swagger provider for this class.
*
- * @param value The new value for this setting.
+ * <p>
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.swaggerProvider().impl(<jv>value</jv>);
+ * </p>
+ *
+ * @param value The new value.
* @return This object.
*/
public Builder swaggerProvider(SwaggerProvider value) {
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
index fee7195a6..855ddfe7e 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
@@ -33,6 +33,7 @@ import java.util.function.*;
import javax.servlet.*;
import javax.servlet.http.*;
+import org.apache.http.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.collections.*;
@@ -83,13 +84,6 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
// Static
//-------------------------------------------------------------------------------------------------------------------
- /** Represents a null value for the {@link RestOp#contextClass()} annotation.*/
- public static final class Void extends RestOpContext {
- private Void(Builder builder) throws Exception {
- super(builder);
- }
- }
-
/**
* Creates a new builder for this object.
*
@@ -109,7 +103,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
* Builder class.
*/
@FluentSetters
- public static class Builder extends Context.Builder {
+ public static final class Builder extends Context.Builder {
RestContext restContext;
RestContext.Builder parent;
@@ -210,7 +204,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The REST servlet/bean instance that this context is defined against.
*/
- public final Supplier<?> resource() {
+ public Supplier<?> resource() {
return restContext.builder.resource();
}
@@ -230,7 +224,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default classes list for this builder.
*/
- public final DefaultClassList defaultClasses() {
+ public DefaultClassList defaultClasses() {
return restContext.builder.defaultClasses();
}
@@ -246,47 +240,75 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The bean store being used by this builder.
*/
- public final BeanStore beanStore() {
+ public BeanStore beanStore() {
return beanStore;
}
- //-----------------------------------------------------------------------------------------------------------------
- // beanContext
- //-----------------------------------------------------------------------------------------------------------------
-
/**
- * Returns the bean context sub-builder.
+ * Specifies a {@link BeanStore} to use when resolving constructor arguments.
*
- * @return The bean context sub-builder.
+ * @param beanStore The bean store to use for resolving constructor arguments.
+ * @return This object.
*/
- public final BeanContext.Builder beanContext() {
- if (beanContext == null)
- beanContext = createBeanContext(beanStore(), parent, resource());
- return beanContext;
+ protected Builder beanStore(BeanStore beanStore) {
+ this.beanStore = beanStore;
+ return this;
}
/**
- * Applies an operation to the bean context sub-builder.
+ * Adds a bean to the bean store of this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.beanStore().add(<jv>beanType</jv>, <jv>bean</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param <T> The class to associate this bean with.
+ * @param beanType The class to associate this bean with.
+ * @param bean The bean. Can be <jk>null</jk>.
+ * @return This object.
+ */
+ public <T> Builder beanStore(Class<T> beanType, T bean) {
+ beanStore().addBean(beanType, bean);
+ return this;
+ }
+
+ /**
+ * Adds a bean to the bean store of this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .beanContext(<jv>x</jv> -> <jv>x</jv>.ignoreUnknownBeanProperties())
- * .build();
+ * <jv>builder</jv>.beanStore().add(<jv>beanType</jv>, <jv>bean</jv>, <jv>name</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param <T> The class to associate this bean with.
+ * @param beanType The class to associate this bean with.
+ * @param bean The bean. Can be <jk>null</jk>.
+ * @param name The bean name if this is a named bean. Can be <jk>null</jk>.
* @return This object.
*/
- public final Builder beanContext(Consumer<BeanContext.Builder> operation) {
- operation.accept(beanContext());
+ public <T> Builder beanStore(Class<T> beanType, T bean, String name) {
+ beanStore().addBean(beanType, bean, name);
return this;
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // beanContext
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Returns the bean context sub-builder.
+ *
+ * @return The bean context sub-builder.
+ */
+ public BeanContext.Builder beanContext() {
+ if (beanContext == null)
+ beanContext = createBeanContext(beanStore(), parent, resource());
+ return beanContext;
+ }
+
/**
* Instantiates the bean context sub-builder.
*
@@ -322,7 +344,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<BeanContext> getBeanContext() {
+ Optional<BeanContext> getBeanContext() {
return optional(beanContext).map(x -> x.build());
}
@@ -335,31 +357,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The encoder group sub-builder.
*/
- public final EncoderSet.Builder encoders() {
+ public EncoderSet.Builder encoders() {
if (encoders == null)
encoders = createEncoders(beanStore(), parent, resource());
return encoders;
}
/**
- * Applies an operation to the encoder group sub-builder.
+ * Adds one or more encoders to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.encoders().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder encoders(Class<? extends Encoder>...value) {
+ encoders().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more encoders to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .encoders(<jv>x</jv> -> <jv>x</jv>.add(MyEncoder.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.encoders().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder encoders(Consumer<EncoderSet.Builder> operation) {
- operation.accept(encoders());
+ public Builder encoders(Encoder...value) {
+ encoders().add(value);
return this;
}
@@ -398,7 +433,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<EncoderSet> getEncoders() {
+ Optional<EncoderSet> getEncoders() {
return optional(encoders).map(x -> x.build());
}
@@ -411,31 +446,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The serializer group sub-builder.
*/
- public final SerializerSet.Builder serializers() {
+ public SerializerSet.Builder serializers() {
if (serializers == null)
serializers = createSerializers(beanStore(), parent, resource());
return serializers;
}
/**
- * Applies an operation to the serializer group sub-builder.
+ * Adds one or more serializers to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.serializers().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder serializers(Class<? extends Serializer>...value) {
+ serializers().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more serializers to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .serializers(<jv>x</jv> -> <jv>x</jv>.add(MySerializer.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.serializers().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder serializers(Consumer<SerializerSet.Builder> operation) {
- operation.accept(serializers());
+ public Builder serializers(Serializer...value) {
+ serializers().add(value);
return this;
}
@@ -474,7 +522,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<SerializerSet> getSerializers() {
+ Optional<SerializerSet> getSerializers() {
return optional(serializers).map(x -> x.build());
}
@@ -487,31 +535,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The parser group sub-builder.
*/
- public final ParserSet.Builder parsers() {
+ public ParserSet.Builder parsers() {
if (parsers == null)
parsers = createParsers(beanStore(), parent, resource());
return parsers;
}
/**
- * Applies an operation to the parser group sub-builder.
+ * Adds one or more parsers to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.parsers().add(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder parsers(Class<? extends Parser>...value) {
+ parsers().add(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more parsers to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .parsers(<jv>x</jv> -> <jv>x</jv>.add(MyParser.<jk>class</jk>))
- * .build();
+ * <jv>builder</jv>.parsers().add(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder parsers(Consumer<ParserSet.Builder> operation) {
- operation.accept(parsers());
+ public Builder parsers(Parser...value) {
+ parsers().add(value);
return this;
}
@@ -550,7 +611,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<ParserSet> getParsers() {
+ Optional<ParserSet> getParsers() {
return optional(parsers).map(x -> x.build());
}
@@ -563,31 +624,43 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The part serializer sub-builder.
*/
- public final HttpPartSerializer.Creator partSerializer() {
+ public HttpPartSerializer.Creator partSerializer() {
if (partSerializer == null)
partSerializer = createPartSerializer(beanStore(), parent, resource());
return partSerializer;
}
/**
- * Applies an operation to the part serializer sub-builder.
+ * Specifies the part serializer to use for serializing HTTP parts for this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.partSerializer().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder partSerializer(Class<? extends HttpPartSerializer> value) {
+ partSerializer().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the part serializer to use for serializing HTTP parts for this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .partSerializer(<jv>x</jv> -> <jv>x</jv>.builder(OpenApiSerializer.Builder.<jk>class</jk>, <jv>y</jv> -> <jv>y</jv>.sortProperties()))
- * .build();
+ * <jv>builder</jv>.partSerializer().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public final Builder partSerializer(Consumer<HttpPartSerializer.Creator> operation) {
- operation.accept(partSerializer());
+ public Builder partSerializer(HttpPartSerializer value) {
+ partSerializer().impl(value);
return this;
}
@@ -626,7 +699,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<HttpPartSerializer> getPartSerializer() {
+ Optional<HttpPartSerializer> getPartSerializer() {
return optional(partSerializer).map(x -> x.create());
}
@@ -639,31 +712,43 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The part parser sub-builder.
*/
- public final HttpPartParser.Creator partParser() {
+ public HttpPartParser.Creator partParser() {
if (partParser == null)
partParser = createPartParser(beanStore(), parent, resource());
return partParser;
}
/**
- * Applies an operation to the part parser sub-builder.
+ * Specifies the part parser to use for parsing HTTP parts for this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.partParser().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder partParser(Class<? extends HttpPartParser> value) {
+ partParser().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the part parser to use for parsing HTTP parts for this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .partParser(<jv>x</jv> -> <jv>x</jv>.builder(OpenApiParser.Builder.<jk>class</jk>, <jv>y</jv> -> <jv>y</jv>.ignoreUnknownBeanProperties()))
- * .build();
+ * <jv>builder</jv>.partParser().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public final Builder partParser(Consumer<HttpPartParser.Creator> operation) {
- operation.accept(partParser());
+ public Builder partParser(HttpPartParser value) {
+ partParser().impl(value);
return this;
}
@@ -702,7 +787,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<HttpPartParser> getPartParser() {
+ Optional<HttpPartParser> getPartParser() {
return optional(partParser).map(x -> x.create());
}
@@ -715,31 +800,43 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The JSON schema generator sub-builder.
*/
- public final JsonSchemaGenerator.Builder jsonSchemaGenerator() {
+ public JsonSchemaGenerator.Builder jsonSchemaGenerator() {
if (jsonSchemaGenerator == null)
jsonSchemaGenerator = createJsonSchemaGenerator(beanStore(), parent, resource());
return jsonSchemaGenerator;
}
/**
- * Applies an operation to the JSON schema generator sub-builder.
+ * Specifies the JSON schema generator for this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.jsonSchemaGenerator().type(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ public Builder jsonSchemaGenerator(Class<? extends JsonSchemaGenerator> value) {
+ jsonSchemaGenerator().type(value);
+ return this;
+ }
+
+ /**
+ * Specifies the JSON schema generator for this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .jsonSchemaGenerator(<jv>x</jv> -> <jv>x</jv>.allowNestedExamples()))
- * .build();
+ * <jv>builder</jv>.jsonSchemaGenerator().impl(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public final Builder jsonSchemaGenerator(Consumer<JsonSchemaGenerator.Builder> operation) {
- operation.accept(jsonSchemaGenerator());
+ public Builder jsonSchemaGenerator(JsonSchemaGenerator value) {
+ jsonSchemaGenerator().impl(value);
return this;
}
@@ -778,7 +875,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final Optional<JsonSchemaGenerator> getJsonSchemaGenerator() {
+ Optional<JsonSchemaGenerator> getJsonSchemaGenerator() {
return optional(jsonSchemaGenerator).map(x -> x.build());
}
@@ -791,31 +888,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The response converter list sub-builder.
*/
- public final RestConverterList.Builder converters() {
+ public RestConverterList.Builder converters() {
if (converters == null)
converters = createConverters(beanStore(), resource());
return converters;
}
/**
- * Applies an operation to the response converter list sub-builder.
+ * Adds one or more converters to use to convert response objects for this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.converters().append(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The new value.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder converters(Class<? extends RestConverter>...value) {
+ converters().append(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more converters to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .converters(<jv>x</jv> -> <jv>x</jv>.add(MyConverter.<jk>class</jk>)))
- * .build();
+ * <jv>builder</jv>.converters().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The new value.
* @return This object.
*/
- public final Builder converters(Consumer<RestConverterList.Builder> operation) {
- operation.accept(converters());
+ public Builder converters(RestConverter...value) {
+ converters().append(value);
return this;
}
@@ -940,31 +1050,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The guard list sub-builder.
*/
- public final RestGuardList.Builder guards() {
+ public RestGuardList.Builder guards() {
if (guards == null)
guards = createGuards(beanStore(), resource());
return guards;
}
/**
- * Applies an operation to the guard list sub-builder.
+ * Adds one or more guards to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.guards().append(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder guards(Class<? extends RestGuard>...value) {
+ guards().append(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more guards to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .guards(<jv>x</jv> -> <jv>x</jv>.add(MyGuard.<jk>class</jk>)))
- * .build();
+ * <jv>builder</jv>.guards().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder guards(Consumer<RestGuardList.Builder> operation) {
- operation.accept(guards());
+ public Builder guards(RestGuard...value) {
+ guards().append(value);
return this;
}
@@ -1033,7 +1156,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final RestGuardList getGuards() {
+ RestGuardList getGuards() {
RestGuardList.Builder b = guards();
Set<String> roleGuard = optional(this.roleGuard).orElseGet(()->set());
@@ -1057,31 +1180,44 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The matcher list sub-builder.
*/
- public final RestMatcherList.Builder matchers() {
+ public RestMatcherList.Builder matchers() {
if (matchers == null)
matchers = createMatchers(beanStore(), resource());
return matchers;
}
/**
- * Applies an operation to the matcher list sub-builder.
+ * Adds one or more matchers to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
+ * Equivalent to calling:
+ * <p class='bjava'>
+ * <jv>builder</jv>.matchers().append(<jv>value</jv>);
+ * </p>
*
- * <h5 class='section'>Example:</h5>
+ * @param value The values to add.
+ * @return This object.
+ */
+ @SafeVarargs
+ public final Builder matchers(Class<? extends RestMatcher>...value) {
+ matchers().append(value);
+ return this;
+ }
+
+ /**
+ * Adds one or more matchers to this operation.
+ *
+ * <p>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .matchers(<jv>x</jv> -> <jv>x</jv>.add(MyMatcher.<jk>class</jk>)))
- * .build();
+ * <jv>builder</jv>.matchers().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder matchers(Consumer<RestMatcherList.Builder> operation) {
- operation.accept(matchers());
+ public Builder matchers(RestMatcher...value) {
+ matchers().append(value);
return this;
}
@@ -1176,7 +1312,7 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
return v.get();
}
- final RestMatcherList getMatchers(RestContext restContext) {
+ RestMatcherList getMatchers(RestContext restContext) {
RestMatcherList.Builder b = matchers();
if (clientVersion != null)
b.append(new ClientVersionMatcher(restContext.getClientVersionHeader(), MethodInfo.of(restMethod)));
@@ -1261,31 +1397,26 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default request headers sub-builder.
*/
- public final HeaderList.Builder defaultRequestHeaders() {
+ public HeaderList.Builder defaultRequestHeaders() {
if (defaultRequestHeaders == null)
defaultRequestHeaders = createDefaultRequestHeaders(beanStore(), parent, resource());
return defaultRequestHeaders;
}
/**
- * Applies an operation to the default request headers sub-builder.
+ * Adds one or more default request headers to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .defaultRequestHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
- * .build();
+ * <jv>builder</jv>.defaultRequestHeaders().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder defaultRequestHeaders(Consumer<HeaderList.Builder> operation) {
- operation.accept(defaultRequestHeaders());
+ public Builder defaultRequestHeaders(org.apache.http.Header...value) {
+ defaultRequestHeaders().append(value);
return this;
}
@@ -1332,31 +1463,26 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default response headers sub-builder.
*/
- public final HeaderList.Builder defaultResponseHeaders() {
+ public HeaderList.Builder defaultResponseHeaders() {
if (defaultResponseHeaders == null)
defaultResponseHeaders = createDefaultResponseHeaders(beanStore(), parent, resource());
return defaultResponseHeaders;
}
/**
- * Applies an operation to the default response headers sub-builder.
+ * Adds one or more default response headers to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .defaultResponseHeaders(<jv>x</jv> -> <jv>x</jv>.remove(<js>"Foo"</js>)))
- * .build();
+ * <jv>builder</jv>.defaultResponseHeaders().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder defaultResponseHeaders(Consumer<HeaderList.Builder> operation) {
- operation.accept(defaultResponseHeaders());
+ public Builder defaultResponseHeaders(org.apache.http.Header...value) {
+ defaultResponseHeaders().append(value);
return this;
}
@@ -1403,31 +1529,26 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default request attributes sub-builder.
*/
- public final NamedAttributeList.Builder defaultRequestAttributes() {
+ public NamedAttributeList.Builder defaultRequestAttributes() {
if (defaultRequestAttributes == null)
defaultRequestAttributes = createDefaultRequestAttributes(beanStore(), parent, resource());
return defaultRequestAttributes;
}
/**
- * Applies an operation to the default request attributes sub-builder.
+ * Adds one or more default request attributes to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .defaultRequestAttributes(<jv>x</jv> -> <jv>x</jv>.add(BasicNamedAttribute.<jsm>of</jsm>(<js>"Foo"</js>, ()-><jsm>getFoo</jsm>()))
- * .build();
+ * <jv>builder</jv>.defaultRequestAttributes().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder defaultRequestAttributes(Consumer<NamedAttributeList.Builder> operation) {
- operation.accept(defaultRequestAttributes());
+ public Builder defaultRequestAttributes(NamedAttribute...value) {
+ defaultRequestAttributes().add(value);
return this;
}
@@ -1474,31 +1595,26 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default request query data sub-builder.
*/
- public final PartList.Builder defaultRequestQueryData() {
+ public PartList.Builder defaultRequestQueryData() {
if (defaultRequestQueryData == null)
defaultRequestQueryData = createDefaultRequestQueryData(beanStore(), parent, resource());
return defaultRequestQueryData;
}
/**
- * Applies an operation to the default request query data sub-builder.
+ * Adds one or more default request query data to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .defaultRequestQueryData(<jv>x</jv> -> <jv>x</jv>.add(BasicPart.<jsm>of</jsm>(<js>"foo"</js>, ()-><jsm>getFoo</jsm>()))
- * .build();
+ * <jv>builder</jv>.defaultRequestQueryData().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder defaultRequestQueryData(Consumer<PartList.Builder> operation) {
- operation.accept(defaultRequestQueryData());
+ public Builder defaultRequestQueryData(NameValuePair...value) {
+ defaultRequestQueryData().append(value);
return this;
}
@@ -1545,31 +1661,26 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
*
* @return The default request form data sub-builder.
*/
- public final PartList.Builder defaultRequestFormData() {
+ public PartList.Builder defaultRequestFormData() {
if (defaultRequestFormData == null)
defaultRequestFormData = createDefaultRequestFormData(beanStore(), parent, resource());
return defaultRequestFormData;
}
/**
- * Applies an operation to the default request form data sub-builder.
+ * Adds one or more default request form data to this operation.
*
* <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the context builder.
- *
- * <h5 class='section'>Example:</h5>
+ * Equivalent to calling:
* <p class='bjava'>
- * RestOpContext <jv>context</jv> = RestOpContext
- * .<jsm>create</jsm>(<jv>method</jv>, <jv>restContext</jv>)
- * .defaultRequestFormData(<jv>x</jv> -> <jv>x</jv>.add(BasicPart.<jsm>of</jsm>(<js>"foo"</js>, ()-><jsm>getFoo</jsm>()))
- * .build();
+ * <jv>builder</jv>.defaultRequestFormData().append(<jv>value</jv>);
* </p>
*
- * @param operation The operation to apply.
+ * @param value The values to add.
* @return This object.
*/
- public final Builder defaultRequestFormData(Consumer<PartList.Builder> operation) {
- operation.accept(defaultRequestFormData());
+ public Builder defaultRequestFormData(NameValuePair...value) {
+ defaultRequestFormData().append(value);
return this;
}
@@ -1667,17 +1778,6 @@ public class RestOpContext extends Context implements Comparable<RestOpContext>
// Properties
//----------------------------------------------------------------------------------------------------
- /**
- * Specifies a {@link BeanStore} to use when resolving constructor arguments.
- *
- * @param beanStore The bean store to use for resolving constructor arguments.
- * @return This object.
- */
- public Builder beanStore(BeanStore beanStore) {
- this.beanStore = beanStore;
- return this;
- }
-
/**
* Client version pattern matcher.
*
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 9550d8c21..1000519ab 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
@@ -19,8 +19,6 @@ import java.lang.annotation.*;
import java.nio.charset.*;
import java.util.*;
-import javax.servlet.*;
-
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.config.*;
@@ -61,25 +59,6 @@ import org.apache.juneau.serializer.*;
@AnnotationGroup(Rest.class)
public @interface Rest {
- /**
- * Override the builder class used for creating the {@link RestContext} bean for this resource.
- *
- * <p>
- * Can be used when you want to override any of the protected methods in the {@link org.apache.juneau.rest.RestContext.Builder} to provide
- * customized behavior.
- *
- * <p>
- * The subclass must contain a public constructor that takes in the following arguments that should be passed to the parent constructor:
- * <ul>
- * <li>{@link Class} - The resource class.
- * <li>{@link RestContext} - The parent context if this is a child of another resource. Can be <jk>null</jk>.
- * <li>{@link ServletConfig} - The servlet config passed in during servlet initialization.
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestContext.Builder> builder() default RestContext.Builder.Void.class;
-
/**
* Disable content URL parameter.
*
@@ -329,20 +308,6 @@ public @interface Rest {
*/
String[] consumes() default {};
- /**
- * REST context class.
- *
- * <p>
- * Allows you to extend the {@link RestContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestContext> contextClass() default RestContext.Void.class;
-
/**
* Class-level response converters.
*
@@ -1127,17 +1092,6 @@ public @interface Rest {
*/
Class<? extends RestOperations> restOperationsClass() default RestOperations.Void.class;
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestContext.Builder#restOpContextClass(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> restOpContextClass() default RestOpContext.Void.class;
-
/**
* Java REST operation method parameter resolvers.
*
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 e939d7c81..501bd8dbe 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
@@ -96,7 +96,6 @@ public class RestAnnotation {
@SuppressWarnings("unchecked")
public static class Builder extends TargetedAnnotationTBuilder {
- Class<? extends RestContext.Builder> builder = RestContext.Builder.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
Class<? extends HttpPartParser> partParser = HttpPartParser.Void.class;
Class<? extends HttpPartSerializer> partSerializer = HttpPartSerializer.Void.class;
@@ -104,13 +103,11 @@ public class RestAnnotation {
Class<? extends StaticFiles> staticFiles = StaticFiles.Void.class;
Class<? extends ResponseProcessor>[] responseProcessors = new Class[0];
Class<? extends CallLogger> callLogger = CallLogger.Void.class;
- Class<? extends RestContext> contextClass = RestContext.Void.class;
Class<? extends RestConverter>[] converters = new Class[0];
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends SwaggerProvider> swaggerProvider = SwaggerProvider.Void.class;
Class<? extends RestOpArg>[] restOpArgs = new Class[0];
Class<? extends BeanStore> beanStore = BeanStore.Void.class;
- Class<? extends RestOpContext> restOpContextClass = RestOpContext.Void.class;
Class<? extends RestChildren> restChildrenClass = RestChildren.Void.class;
Class<? extends RestOperations> restOperationsClass = RestOperations.Void.class;
Class<? extends DebugEnablement> debugEnablement = DebugEnablement.Void.class;
@@ -246,17 +243,6 @@ public class RestAnnotation {
return this;
}
- /**
- * Sets the {@link Rest#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link Rest#converters()} property on this annotation.
*
@@ -521,17 +507,6 @@ public class RestAnnotation {
return this;
}
- /**
- * Sets the {@link Rest#restOpContextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder restOpContextClass(Class<? extends RestOpContext> value) {
- this.restOpContextClass = value;
- return this;
- }
-
/**
* Sets the {@link Rest#restOpArgs()} property on this annotation.
*
@@ -715,7 +690,6 @@ public class RestAnnotation {
private static class Impl extends TargetedAnnotationTImpl implements Rest {
- private final Class<? extends RestContext.Builder> builder;
private final Class<? extends Encoder>[] encoders;
private final Class<? extends HttpPartParser> partParser;
private final Class<? extends HttpPartSerializer> partSerializer;
@@ -723,13 +697,11 @@ public class RestAnnotation {
private final Class<? extends StaticFiles> staticFiles;
private final Class<? extends ResponseProcessor>[] responseProcessors;
private final Class<? extends CallLogger> callLogger;
- private final Class<? extends RestContext> contextClass;
private final Class<? extends RestConverter>[] converters;
private final Class<? extends RestGuard>[] guards;
private final Class<? extends SwaggerProvider> swaggerProvider;
private final Class<? extends RestOpArg>[] restOpArgs;
private final Class<? extends BeanStore> beanStore;
- private final Class<? extends RestOpContext> restOpContextClass;
private final Class<? extends RestChildren> restChildrenClass;
private final Class<? extends RestOperations> restOperationsClass;
private final Class<? extends DebugEnablement> debugEnablement;
@@ -741,7 +713,6 @@ public class RestAnnotation {
Impl(Builder b) {
super(b);
- this.builder = b.builder;
this.disableContentParam = b.disableContentParam;
this.allowedHeaderParams = b.allowedHeaderParams;
this.allowedMethodHeaders = b.allowedMethodHeaders;
@@ -752,7 +723,6 @@ public class RestAnnotation {
this.clientVersionHeader = b.clientVersionHeader;
this.config = b.config;
this.consumes = copyOf(b.consumes);
- this.contextClass = b.contextClass;
this.converters = copyOf(b.converters);
this.debug = b.debug;
this.debugEnablement = b.debugEnablement;
@@ -777,7 +747,6 @@ public class RestAnnotation {
this.renderResponseStackTraces = b.renderResponseStackTraces;
this.responseProcessors = copyOf(b.responseProcessors);
this.restChildrenClass = b.restChildrenClass;
- this.restOpContextClass = b.restOpContextClass;
this.restOperationsClass = b.restOperationsClass;
this.restOpArgs = copyOf(b.restOpArgs);
this.roleGuard = b.roleGuard;
@@ -795,11 +764,6 @@ public class RestAnnotation {
postConstruct();
}
- @Override /* Rest */
- public Class<? extends RestContext.Builder> builder() {
- return builder;
- }
-
@Override /* Rest */
public String disableContentParam() {
return disableContentParam;
@@ -850,11 +814,6 @@ public class RestAnnotation {
return consumes;
}
- @Override /* Rest */
- public Class<? extends RestContext> contextClass() {
- return contextClass;
- }
-
@Override /* Rest */
public Class<? extends RestConverter>[] converters() {
return converters;
@@ -975,11 +934,6 @@ public class RestAnnotation {
return restChildrenClass;
}
- @Override /* Rest */
- public Class<? extends RestOpContext> restOpContextClass() {
- return restOpContextClass;
- }
-
@Override /* Rest */
public Class<? extends RestOpArg>[] restOpArgs() {
return restOpArgs;
@@ -1088,7 +1042,6 @@ public class RestAnnotation {
b.children((Object[])a.children());
b.restOpArgs(a.restOpArgs());
classes(a.encoders()).ifPresent(x -> b.encoders().add(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
string(a.uriContext()).ifPresent(x -> b.uriContext(x));
string(a.uriAuthority()).ifPresent(x -> b.uriAuthority(x));
string(a.uriRelativity()).map(UriRelativity::valueOf).ifPresent(x -> b.uriRelativity(x));
@@ -1100,7 +1053,6 @@ public class RestAnnotation {
string(a.clientVersionHeader()).ifPresent(x -> b.clientVersionHeader(x));
type(a.callLogger()).ifPresent(x -> b.callLogger().type(x));
type(a.swaggerProvider()).ifPresent(x -> b.swaggerProvider(x));
- type(a.restOpContextClass()).ifPresent(x -> b.restOpContextClass(x));
type(a.restChildrenClass()).ifPresent(x -> b.restChildrenClass(x));
type(a.restOperationsClass()).ifPresent(x -> b.restOperationsClass(x));
type(a.debugEnablement()).ifPresent(x -> b.debugEnablement().type(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDelete.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDelete.java
index 146b62668..5f797e052 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDelete.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDelete.java
@@ -109,17 +109,6 @@ public @interface RestDelete {
*/
String clientVersion() default "";
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> contextClass() default RestOpContext.Void.class;
-
/**
* Enable debug mode.
*
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
index 6f9808acc..b20c3a3ab 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation.java
@@ -71,7 +71,6 @@ public class RestDeleteAnnotation {
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends RestMatcher>[] matchers = new Class[0];
- Class<? extends RestOpContext> contextClass = RestOpContext.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
OpSwagger swagger = OpSwaggerAnnotation.DEFAULT;
String clientVersion="", debug="", defaultAccept="", defaultCharset="", rolesDeclared="", roleGuard="", summary="", value="";
@@ -104,17 +103,6 @@ public class RestDeleteAnnotation {
return this;
}
- /**
- * Sets the {@link RestDelete#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestOpContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link RestDelete#debug()} property on this annotation.
*
@@ -327,7 +315,6 @@ public class RestDeleteAnnotation {
private final Class<? extends RestGuard>[] guards;
private final Class<? extends RestMatcher>[] matchers;
- private final Class<? extends RestOpContext> contextClass;
private final Class<? extends Encoder>[] encoders;
private final OpSwagger swagger;
private final String clientVersion, debug, defaultAccept, defaultCharset, rolesDeclared, roleGuard, summary, value;
@@ -336,7 +323,6 @@ public class RestDeleteAnnotation {
Impl(Builder b) {
super(b);
this.clientVersion = b.clientVersion;
- this.contextClass = b.contextClass;
this.debug = b.debug;
this.defaultAccept = b.defaultAccept;
this.defaultCharset = b.defaultCharset;
@@ -362,11 +348,6 @@ public class RestDeleteAnnotation {
return clientVersion;
}
- @Override /* RestDelete */
- public Class<? extends RestOpContext> contextClass() {
- return contextClass;
- }
-
@Override /* RestDelete */
public String debug() {
return debug;
@@ -478,7 +459,6 @@ public class RestDeleteAnnotation {
b.httpMethod("delete");
classes(a.encoders()).ifPresent(x -> b.encoders().set(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
stream(a.defaultRequestHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultRequestHeaders().setDefault(x));
stream(a.defaultResponseHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultResponseHeaders().setDefault(x));
stream(a.defaultRequestAttributes()).map(x -> BasicNamedAttribute.ofPair(x)).forEach(x -> b.defaultRequestAttributes().add(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGet.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGet.java
index bbcf9ffd9..e7a7b0fb1 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGet.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGet.java
@@ -115,17 +115,6 @@ public @interface RestGet {
*/
String clientVersion() default "";
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> contextClass() default RestOpContext.Void.class;
-
/**
* Class-level response converters.
*
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
index d3694c101..8391cb110 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestGetAnnotation.java
@@ -74,7 +74,6 @@ public class RestGetAnnotation {
Class<? extends RestConverter>[] converters = new Class[0];
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends RestMatcher>[] matchers = new Class[0];
- Class<? extends RestOpContext> contextClass = RestOpContext.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
Class<? extends Serializer>[] serializers = new Class[0];
OpSwagger swagger = OpSwaggerAnnotation.DEFAULT;
@@ -108,17 +107,6 @@ public class RestGetAnnotation {
return this;
}
- /**
- * Sets the {@link RestGet#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestOpContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link RestGet#converters()} property on this annotation.
*
@@ -365,7 +353,6 @@ public class RestGetAnnotation {
private final Class<? extends RestConverter>[] converters;
private final Class<? extends RestGuard>[] guards;
private final Class<? extends RestMatcher>[] matchers;
- private final Class<? extends RestOpContext> contextClass;
private final Class<? extends Encoder>[] encoders;
private final Class<? extends Serializer>[] serializers;
private final OpSwagger swagger;
@@ -375,7 +362,6 @@ public class RestGetAnnotation {
Impl(Builder b) {
super(b);
this.clientVersion = b.clientVersion;
- this.contextClass = b.contextClass;
this.converters = copyOf(b.converters);
this.debug = b.debug;
this.defaultAccept = b.defaultAccept;
@@ -404,11 +390,6 @@ public class RestGetAnnotation {
return clientVersion;
}
- @Override /* RestGet */
- public Class<? extends RestOpContext> contextClass() {
- return contextClass;
- }
-
@Override /* RestGet */
public Class<? extends RestConverter>[] converters() {
return converters;
@@ -536,7 +517,6 @@ public class RestGetAnnotation {
classes(a.serializers()).ifPresent(x -> b.serializers().set(x));
classes(a.encoders()).ifPresent(x -> b.encoders().set(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
stream(a.produces()).map(MediaType::of).forEach(x -> b.produces(x));
stream(a.defaultRequestHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultRequestHeaders().setDefault(x));
stream(a.defaultResponseHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultResponseHeaders().setDefault(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
index 7c3549586..94d6a6230 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
@@ -133,17 +133,6 @@ public @interface RestOp {
*/
String[] consumes() default {};
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> contextClass() default RestOpContext.Void.class;
-
/**
* Class-level response converters.
*
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
index d589bad56..50bbd4365 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
@@ -81,7 +81,6 @@ public class RestOpAnnotation {
Class<? extends RestConverter>[] converters = new Class[0];
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends RestMatcher>[] matchers = new Class[0];
- Class<? extends RestOpContext> contextClass = RestOpContext.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
Class<? extends Serializer>[] serializers = new Class[0];
Class<?>[] parsers=new Class<?>[0];
@@ -127,17 +126,6 @@ public class RestOpAnnotation {
return this;
}
- /**
- * Sets the {@link RestOp#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestOpContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link RestOp#converters()} property on this annotation.
*
@@ -439,7 +427,6 @@ public class RestOpAnnotation {
private final Class<? extends RestConverter>[] converters;
private final Class<? extends RestGuard>[] guards;
private final Class<? extends RestMatcher>[] matchers;
- private final Class<? extends RestOpContext> contextClass;
private final Class<? extends Encoder>[] encoders;
private final Class<? extends Serializer>[] serializers;
private final Class<?>[] parsers;
@@ -451,7 +438,6 @@ public class RestOpAnnotation {
super(b);
this.clientVersion = b.clientVersion;
this.consumes = copyOf(b.consumes);
- this.contextClass = b.contextClass;
this.converters = copyOf(b.converters);
this.debug = b.debug;
this.defaultAccept = b.defaultAccept;
@@ -490,11 +476,6 @@ public class RestOpAnnotation {
return consumes;
}
- @Override /* RestOp */
- public Class<? extends RestOpContext> contextClass() {
- return contextClass;
- }
-
@Override /* RestOp */
public Class<? extends RestConverter>[] converters() {
return converters;
@@ -646,7 +627,6 @@ public class RestOpAnnotation {
classes(a.serializers()).ifPresent(x -> b.serializers().set(x));
classes(a.parsers()).ifPresent(x -> b.parsers().set(x));
classes(a.encoders()).ifPresent(x -> b.encoders().set(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
stream(a.produces()).map(MediaType::of).forEach(x -> b.produces(x));
stream(a.consumes()).map(MediaType::of).forEach(x -> b.consumes(x));
stream(a.defaultRequestHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultRequestHeaders().setDefault(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPost.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPost.java
index c32afaa27..92002658b 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPost.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPost.java
@@ -135,17 +135,6 @@ public @interface RestPost {
*/
String[] consumes() default {};
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> contextClass() default RestOpContext.Void.class;
-
/**
* Class-level response converters.
*
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
index f793a29fd..eab3e389a 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPostAnnotation.java
@@ -74,7 +74,6 @@ public class RestPostAnnotation {
Class<? extends RestConverter>[] converters = new Class[0];
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends RestMatcher>[] matchers = new Class[0];
- Class<? extends RestOpContext> contextClass = RestOpContext.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
Class<? extends Serializer>[] serializers = new Class[0];
Class<?>[] parsers=new Class<?>[0];
@@ -120,17 +119,6 @@ public class RestPostAnnotation {
return this;
}
- /**
- * Sets the {@link RestPost#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestOpContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link RestPost#converters()} property on this annotation.
*
@@ -421,7 +409,6 @@ public class RestPostAnnotation {
private final Class<? extends RestConverter>[] converters;
private final Class<? extends RestGuard>[] guards;
private final Class<? extends RestMatcher>[] matchers;
- private final Class<? extends RestOpContext> contextClass;
private final Class<? extends Encoder>[] encoders;
private final Class<? extends Serializer>[] serializers;
private final Class<?>[] parsers;
@@ -433,7 +420,6 @@ public class RestPostAnnotation {
super(b);
this.clientVersion = b.clientVersion;
this.consumes = copyOf(b.consumes);
- this.contextClass = b.contextClass;
this.converters = copyOf(b.converters);
this.debug = b.debug;
this.defaultAccept = b.defaultAccept;
@@ -471,11 +457,6 @@ public class RestPostAnnotation {
return consumes;
}
- @Override /* RestPost */
- public Class<? extends RestOpContext> contextClass() {
- return contextClass;
- }
-
@Override /* RestPost */
public Class<? extends RestConverter>[] converters() {
return converters;
@@ -624,7 +605,6 @@ public class RestPostAnnotation {
classes(a.serializers()).ifPresent(x -> b.serializers().set(x));
classes(a.parsers()).ifPresent(x -> b.parsers().set(x));
classes(a.encoders()).ifPresent(x -> b.encoders().set(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
stream(a.produces()).map(MediaType::of).forEach(x -> b.produces(x));
stream(a.consumes()).map(MediaType::of).forEach(x -> b.consumes(x));
stream(a.defaultRequestHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultRequestHeaders().setDefault(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPut.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPut.java
index 968bc3cf5..00b407d18 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPut.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPut.java
@@ -135,17 +135,6 @@ public @interface RestPut {
*/
String[] consumes() default {};
- /**
- * Allows you to extend the {@link RestOpContext} class to modify how any of the methods are implemented.
- *
- * <ul class='seealso'>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#type(Class)}
- * </ul>
- *
- * @return The annotation value.
- */
- Class<? extends RestOpContext> contextClass() default RestOpContext.Void.class;
-
/**
* Class-level response converters.
*
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
index 3131ef52f..88c00d075 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestPutAnnotation.java
@@ -74,7 +74,6 @@ public class RestPutAnnotation {
Class<? extends RestConverter>[] converters = new Class[0];
Class<? extends RestGuard>[] guards = new Class[0];
Class<? extends RestMatcher>[] matchers = new Class[0];
- Class<? extends RestOpContext> contextClass = RestOpContext.Void.class;
Class<? extends Encoder>[] encoders = new Class[0];
Class<? extends Serializer>[] serializers = new Class[0];
Class<?>[] parsers=new Class<?>[0];
@@ -120,17 +119,6 @@ public class RestPutAnnotation {
return this;
}
- /**
- * Sets the {@link RestPut#contextClass()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder contextClass(Class<? extends RestOpContext> value) {
- this.contextClass = value;
- return this;
- }
-
/**
* Sets the {@link RestPut#converters()} property on this annotation.
*
@@ -421,7 +409,6 @@ public class RestPutAnnotation {
private final Class<? extends RestConverter>[] converters;
private final Class<? extends RestGuard>[] guards;
private final Class<? extends RestMatcher>[] matchers;
- private final Class<? extends RestOpContext> contextClass;
private final Class<? extends Encoder>[] encoders;
private final Class<? extends Serializer>[] serializers;
private final Class<?>[] parsers;
@@ -433,7 +420,6 @@ public class RestPutAnnotation {
super(b);
this.clientVersion = b.clientVersion;
this.consumes = copyOf(b.consumes);
- this.contextClass = b.contextClass;
this.converters = copyOf(b.converters);
this.debug = b.debug;
this.defaultAccept = b.defaultAccept;
@@ -471,11 +457,6 @@ public class RestPutAnnotation {
return consumes;
}
- @Override /* RestPut */
- public Class<? extends RestOpContext> contextClass() {
- return contextClass;
- }
-
@Override /* RestPut */
public Class<? extends RestConverter>[] converters() {
return converters;
@@ -624,7 +605,6 @@ public class RestPutAnnotation {
classes(a.serializers()).ifPresent(x -> b.serializers().set(x));
classes(a.parsers()).ifPresent(x -> b.parsers().set(x));
classes(a.encoders()).ifPresent(x -> b.encoders().set(x));
- type(a.contextClass()).ifPresent(x -> b.type(x));
stream(a.produces()).map(MediaType::of).forEach(x -> b.produces(x));
stream(a.consumes()).map(MediaType::of).forEach(x -> b.consumes(x));
stream(a.defaultRequestHeaders()).map(x -> stringHeader(x)).forEach(x -> b.defaultRequestHeaders().setDefault(x));
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/config/DefaultConfig.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/config/DefaultConfig.java
index 30f5b7871..8f9e0c2f6 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/config/DefaultConfig.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/config/DefaultConfig.java
@@ -125,9 +125,7 @@ import org.apache.juneau.oapi.*;
swaggerProvider=SwaggerProvider.Void.class, // Defaults to BasicSwaggerProvider.
// Overridable context classes.
- contextClass=RestContext.class,
restChildrenClass=RestChildren.class,
- restOpContextClass=RestOpContext.class,
restOperationsClass=RestOperations.class
)
@BeanConfig(
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java
index 7acc2b1e0..2b548bf34 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java
@@ -54,7 +54,6 @@ public class RestAnnotation_Test {
.clientVersionHeader("clientVersionHeader")
.config("config")
.consumes("consumes")
- .contextClass(RestContext.class)
.converters(RestConverter.class)
.debug("debug")
.debugEnablement(DebugEnablement.class)
@@ -81,7 +80,6 @@ public class RestAnnotation_Test {
.renderResponseStackTraces("renderResponseStackTraces")
.responseProcessors(ResponseProcessor.class)
.restChildrenClass(RestChildren.class)
- .restOpContextClass(RestOpContext.class)
.restOpArgs(RestOpArg.class)
.restOperationsClass(RestOperations.class)
.roleGuard("roleGuard")
@@ -109,7 +107,6 @@ public class RestAnnotation_Test {
.clientVersionHeader("clientVersionHeader")
.config("config")
.consumes("consumes")
- .contextClass(RestContext.class)
.converters(RestConverter.class)
.debug("debug")
.debugEnablement(DebugEnablement.class)
@@ -136,7 +133,6 @@ public class RestAnnotation_Test {
.renderResponseStackTraces("renderResponseStackTraces")
.responseProcessors(ResponseProcessor.class)
.restChildrenClass(RestChildren.class)
- .restOpContextClass(RestOpContext.class)
.restOpArgs(RestOpArg.class)
.restOperationsClass(RestOperations.class)
.roleGuard("roleGuard")
@@ -161,13 +157,11 @@ public class RestAnnotation_Test {
+ "allowedMethodHeaders:'allowedMethodHeaders',"
+ "allowedMethodParams:'allowedMethodParams',"
+ "beanStore:'org.apache.juneau.cp.BeanStore',"
- + "builder:'org.apache.juneau.rest.RestContext$Builder$Void',"
+ "callLogger:'org.apache.juneau.rest.logger.CallLogger',"
+ "children:['"+CNAME+"'],"
+ "clientVersionHeader:'clientVersionHeader',"
+ "config:'config',"
+ "consumes:['consumes'],"
- + "contextClass:'org.apache.juneau.rest.RestContext',"
+ "converters:['org.apache.juneau.rest.converter.RestConverter'],"
+ "debug:'debug',"
+ "debugEnablement:'org.apache.juneau.rest.debug.DebugEnablement',"
@@ -196,7 +190,6 @@ public class RestAnnotation_Test {
+ "responseProcessors:['org.apache.juneau.rest.processor.ResponseProcessor'],"
+ "restChildrenClass:'org.apache.juneau.rest.RestChildren',"
+ "restOpArgs:['org.apache.juneau.rest.arg.RestOpArg'],"
- + "restOpContextClass:'org.apache.juneau.rest.RestOpContext',"
+ "restOperationsClass:'org.apache.juneau.rest.RestOperations',"
+ "roleGuard:'roleGuard',"
+ "rolesDeclared:'rolesDeclared',"
@@ -268,7 +261,6 @@ public class RestAnnotation_Test {
clientVersionHeader="clientVersionHeader",
config="config",
consumes="consumes",
- contextClass=RestContext.class,
converters=RestConverter.class,
debug="debug",
debugEnablement=DebugEnablement.class,
@@ -295,7 +287,6 @@ public class RestAnnotation_Test {
renderResponseStackTraces="renderResponseStackTraces",
responseProcessors=ResponseProcessor.class,
restChildrenClass=RestChildren.class,
- restOpContextClass=RestOpContext.class,
restOpArgs=RestOpArg.class,
restOperationsClass=RestOperations.class,
roleGuard="roleGuard",
@@ -325,7 +316,6 @@ public class RestAnnotation_Test {
clientVersionHeader="clientVersionHeader",
config="config",
consumes="consumes",
- contextClass=RestContext.class,
converters=RestConverter.class,
debug="debug",
debugEnablement=DebugEnablement.class,
@@ -352,7 +342,6 @@ public class RestAnnotation_Test {
renderResponseStackTraces="renderResponseStackTraces",
responseProcessors=ResponseProcessor.class,
restChildrenClass=RestChildren.class,
- restOpContextClass=RestOpContext.class,
restOpArgs=RestOpArg.class,
restOperationsClass=RestOperations.class,
roleGuard="roleGuard",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation_Test.java
index b156e0c74..5e960b3f8 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestDeleteAnnotation_Test.java
@@ -18,7 +18,6 @@ import static org.junit.runners.MethodSorters.*;
import org.apache.juneau.*;
import org.apache.juneau.encoders.*;
-import org.apache.juneau.rest.*;
import org.apache.juneau.rest.guard.*;
import org.apache.juneau.rest.matcher.*;
import org.junit.*;
@@ -35,7 +34,6 @@ public class RestDeleteAnnotation_Test {
RestDelete a1 = RestDeleteAnnotation.create()
.clientVersion("clientVersion")
- .contextClass(RestOpContext.class)
.debug("debug")
.defaultAccept("defaultAccept")
.defaultCharset("defaultCharset")
@@ -58,7 +56,6 @@ public class RestDeleteAnnotation_Test {
RestDelete a2 = RestDeleteAnnotation.create()
.clientVersion("clientVersion")
- .contextClass(RestOpContext.class)
.debug("debug")
.defaultAccept("defaultAccept")
.defaultCharset("defaultCharset")
@@ -84,7 +81,6 @@ public class RestDeleteAnnotation_Test {
assertObject(a1).asJson().is(""
+ "{"
+ "clientVersion:'clientVersion',"
- + "contextClass:'org.apache.juneau.rest.RestOpContext',"
+ "debug:'debug',"
+ "defaultAccept:'defaultAccept',"
+ "defaultCharset:'defaultCharset',"
@@ -152,7 +148,6 @@ public class RestDeleteAnnotation_Test {
@RestDelete(
clientVersion="clientVersion",
- contextClass=RestOpContext.class,
debug="debug",
defaultAccept="defaultAccept",
defaultCharset="defaultCharset",
@@ -176,7 +171,6 @@ public class RestDeleteAnnotation_Test {
@RestDelete(
clientVersion="clientVersion",
- contextClass=RestOpContext.class,
debug="debug",
defaultAccept="defaultAccept",
defaultCharset="defaultCharset",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestGetAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestGetAnnotation_Test.java
index 3893433a6..77de4ab13 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestGetAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestGetAnnotation_Test.java
@@ -18,7 +18,6 @@ import static org.junit.runners.MethodSorters.*;
import org.apache.juneau.*;
import org.apache.juneau.encoders.*;
-import org.apache.juneau.rest.*;
import org.apache.juneau.rest.converter.*;
import org.apache.juneau.rest.guard.*;
import org.apache.juneau.rest.matcher.*;
@@ -37,7 +36,6 @@ public class RestGetAnnotation_Test {
RestGet a1 = RestGetAnnotation.create()
.clientVersion("clientVersion")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -63,7 +61,6 @@ public class RestGetAnnotation_Test {
RestGet a2 = RestGetAnnotation.create()
.clientVersion("clientVersion")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -92,7 +89,6 @@ public class RestGetAnnotation_Test {
assertObject(a1).asJson().is(""
+ "{"
+ "clientVersion:'clientVersion',"
- + "contextClass:'org.apache.juneau.rest.RestOpContext',"
+ "converters:['org.apache.juneau.rest.converter.RestConverter'],"
+ "debug:'debug',"
+ "defaultAccept:'defaultAccept',"
@@ -163,7 +159,6 @@ public class RestGetAnnotation_Test {
@RestGet(
clientVersion="clientVersion",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
@@ -190,7 +185,6 @@ public class RestGetAnnotation_Test {
@RestGet(
clientVersion="clientVersion",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
index 4ae931567..d7fe92c1e 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
@@ -19,7 +19,6 @@ import static org.junit.runners.MethodSorters.*;
import org.apache.juneau.*;
import org.apache.juneau.encoders.*;
import org.apache.juneau.parser.*;
-import org.apache.juneau.rest.*;
import org.apache.juneau.rest.converter.*;
import org.apache.juneau.rest.guard.*;
import org.apache.juneau.rest.matcher.*;
@@ -39,7 +38,6 @@ public class RestOpAnnotation_Test {
RestOp a1 = RestOpAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -71,7 +69,6 @@ public class RestOpAnnotation_Test {
RestOp a2 = RestOpAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -106,7 +103,6 @@ public class RestOpAnnotation_Test {
+ "{"
+ "clientVersion:'clientVersion',"
+ "consumes:['consumes'],"
- + "contextClass:'org.apache.juneau.rest.RestOpContext',"
+ "converters:['org.apache.juneau.rest.converter.RestConverter'],"
+ "debug:'debug',"
+ "defaultAccept:'defaultAccept',"
@@ -183,7 +179,6 @@ public class RestOpAnnotation_Test {
@RestOp(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
@@ -216,7 +211,6 @@ public class RestOpAnnotation_Test {
@RestOp(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPostAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPostAnnotation_Test.java
index ef9057b70..80183f87d 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPostAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPostAnnotation_Test.java
@@ -19,7 +19,6 @@ import static org.junit.runners.MethodSorters.*;
import org.apache.juneau.*;
import org.apache.juneau.encoders.*;
import org.apache.juneau.parser.*;
-import org.apache.juneau.rest.*;
import org.apache.juneau.rest.converter.*;
import org.apache.juneau.rest.guard.*;
import org.apache.juneau.rest.matcher.*;
@@ -39,7 +38,6 @@ public class RestPostAnnotation_Test {
RestPost a1 = RestPostAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -70,7 +68,6 @@ public class RestPostAnnotation_Test {
RestPost a2 = RestPostAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -104,7 +101,6 @@ public class RestPostAnnotation_Test {
+ "{"
+ "clientVersion:'clientVersion',"
+ "consumes:['consumes'],"
- + "contextClass:'org.apache.juneau.rest.RestOpContext',"
+ "converters:['org.apache.juneau.rest.converter.RestConverter'],"
+ "debug:'debug',"
+ "defaultAccept:'defaultAccept',"
@@ -180,7 +176,6 @@ public class RestPostAnnotation_Test {
@RestPost(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
@@ -212,7 +207,6 @@ public class RestPostAnnotation_Test {
@RestPost(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPutAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPutAnnotation_Test.java
index 483c363a6..62a017f19 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPutAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestPutAnnotation_Test.java
@@ -19,7 +19,6 @@ import static org.junit.runners.MethodSorters.*;
import org.apache.juneau.*;
import org.apache.juneau.encoders.*;
import org.apache.juneau.parser.*;
-import org.apache.juneau.rest.*;
import org.apache.juneau.rest.converter.*;
import org.apache.juneau.rest.guard.*;
import org.apache.juneau.rest.matcher.*;
@@ -39,7 +38,6 @@ public class RestPutAnnotation_Test {
RestPut a1 = RestPutAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -70,7 +68,6 @@ public class RestPutAnnotation_Test {
RestPut a2 = RestPutAnnotation.create()
.clientVersion("clientVersion")
.consumes("consumes")
- .contextClass(RestOpContext.class)
.converters(RestConverter.class)
.debug("debug")
.defaultAccept("defaultAccept")
@@ -104,7 +101,6 @@ public class RestPutAnnotation_Test {
+ "{"
+ "clientVersion:'clientVersion',"
+ "consumes:['consumes'],"
- + "contextClass:'org.apache.juneau.rest.RestOpContext',"
+ "converters:['org.apache.juneau.rest.converter.RestConverter'],"
+ "debug:'debug',"
+ "defaultAccept:'defaultAccept',"
@@ -180,7 +176,6 @@ public class RestPutAnnotation_Test {
@RestPut(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
@@ -212,7 +207,6 @@ public class RestPutAnnotation_Test {
@RestPut(
clientVersion="clientVersion",
consumes="consumes",
- contextClass=RestOpContext.class,
converters=RestConverter.class,
debug="debug",
defaultAccept="defaultAccept",
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java
deleted file mode 100644
index 4fb6bc0e6..000000000
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java
+++ /dev/null
@@ -1,104 +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.annotation;
-
-import static org.apache.juneau.assertions.Assertions.*;
-import static org.junit.runners.MethodSorters.*;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.mock.*;
-import org.junit.*;
-
-@FixMethodOrder(NAME_ASCENDING)
-public class Rest_Context_Test {
-
- public static class X1 extends RestContext {
- public X1(RestContext.Builder builder) throws Exception {
- super(builder);
- }
- }
-
- @Rest
- public static class A1 {
- @RestGet
- public String get(RestContext context) {
- return context.getClass().getSimpleName();
- }
- }
-
- @Test
- public void a01_default() throws Exception {
- MockRestClient a1 = client(A1.class);
- a1.get().run().assertContent().is("RestContext");
- }
-
- @Rest(contextClass=X1.class)
- public static class A2 extends A1 {}
-
- @Test
- public void a02_custom() throws Exception {
- MockRestClient a2 = client(A2.class);
- a2.get().run().assertContent().is("X1");
- }
-
- @Rest
- public static class A3 extends A2 {}
-
- @Test
- public void a03_notOverriddenByChild() throws Exception {
- MockRestClient a3 = client(A3.class);
- a3.get().run().assertContent().is("X1");
- }
-
- @Rest
- public static class A4 extends A1 {
- @RestInit
- public void init(RestContext.Builder builder) throws Exception {
- builder.type(X1.class);
- }
- }
-
- @Test
- public void a04_definedInBuilder() throws Exception {
- MockRestClient a4 = client(A4.class);
- a4.get().run().assertContent().is("X1");
- }
-
-
- public static class X2 extends RestContext {
- public X2() throws Exception {
- super(null);
- }
- }
-
- @Rest(contextClass=X2.class)
- public static class A5 {
- @RestGet
- public String get(RestContext context) {
- return context.getClass().getSimpleName();
- }
- }
-
- @Test
- public void a05_invalidConstructor() throws Exception {
- assertThrown(()->client(A5.class)).asMessages().isContains("Could not instantiate RestContext.");
- }
-
- //------------------------------------------------------------------------------------------------------------------
- // Helper methods
- //------------------------------------------------------------------------------------------------------------------
-
- private static MockRestClient client(Class<?> c) {
- return MockRestClient.create(c).build();
- }
-}