This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 8715427 Remove redundancy in HttpPart annotations.
8715427 is described below
commit 8715427645ac4e72221de2719e12997c2b806a97
Author: JamesBognar <[email protected]>
AuthorDate: Fri Nov 26 16:38:44 2021 -0500
Remove redundancy in HttpPart annotations.
---
.../apache/juneau/http/annotation/Response.java | 26 ---------------
.../juneau/http/annotation/ResponseAnnotation.java | 37 ----------------------
.../juneau/http/annotation/ResponseCode.java | 6 ++++
.../http/annotation/ResponseCodeAnnotation.java | 22 +++++++++++++
.../org/apache/juneau/http/response/Accepted.java | 4 ++-
.../juneau/http/response/AlreadyReported.java | 4 ++-
.../apache/juneau/http/response/BadRequest.java | 4 ++-
.../org/apache/juneau/http/response/Conflict.java | 4 ++-
.../org/apache/juneau/http/response/Continue.java | 4 ++-
.../org/apache/juneau/http/response/Created.java | 4 ++-
.../apache/juneau/http/response/EarlyHints.java | 4 ++-
.../juneau/http/response/ExpectationFailed.java | 4 ++-
.../juneau/http/response/FailedDependency.java | 4 ++-
.../org/apache/juneau/http/response/Forbidden.java | 4 ++-
.../org/apache/juneau/http/response/Found.java | 4 ++-
.../java/org/apache/juneau/http/response/Gone.java | 4 ++-
.../http/response/HttpVersionNotSupported.java | 4 ++-
.../org/apache/juneau/http/response/IMUsed.java | 4 ++-
.../juneau/http/response/InsufficientStorage.java | 4 ++-
.../juneau/http/response/InternalServerError.java | 4 ++-
.../juneau/http/response/LengthRequired.java | 4 ++-
.../org/apache/juneau/http/response/Locked.java | 4 ++-
.../apache/juneau/http/response/LoopDetected.java | 4 ++-
.../juneau/http/response/MethodNotAllowed.java | 4 ++-
.../juneau/http/response/MisdirectedRequest.java | 4 ++-
.../juneau/http/response/MovedPermanently.java | 4 ++-
.../apache/juneau/http/response/MultiStatus.java | 4 ++-
.../juneau/http/response/MultipleChoices.java | 4 ++-
.../response/NetworkAuthenticationRequired.java | 4 ++-
.../org/apache/juneau/http/response/NoContent.java | 4 ++-
.../http/response/NonAuthoritiveInformation.java | 4 ++-
.../apache/juneau/http/response/NotAcceptable.java | 4 ++-
.../apache/juneau/http/response/NotExtended.java | 4 ++-
.../org/apache/juneau/http/response/NotFound.java | 4 ++-
.../juneau/http/response/NotImplemented.java | 4 ++-
.../apache/juneau/http/response/NotModified.java | 4 ++-
.../java/org/apache/juneau/http/response/Ok.java | 4 ++-
.../juneau/http/response/PartialContent.java | 4 ++-
.../juneau/http/response/PayloadTooLarge.java | 4 ++-
.../juneau/http/response/PermanentRedirect.java | 4 ++-
.../juneau/http/response/PreconditionFailed.java | 4 ++-
.../juneau/http/response/PreconditionRequired.java | 4 ++-
.../apache/juneau/http/response/Processing.java | 4 ++-
.../juneau/http/response/RangeNotSatisfiable.java | 4 ++-
.../http/response/RequestHeaderFieldsTooLarge.java | 4 ++-
.../apache/juneau/http/response/ResetContent.java | 4 ++-
.../org/apache/juneau/http/response/SeeOther.java | 4 ++-
.../juneau/http/response/ServiceUnavailable.java | 4 ++-
.../juneau/http/response/SwitchingProtocols.java | 4 ++-
.../juneau/http/response/TemporaryRedirect.java | 4 ++-
.../juneau/http/response/TooManyRequests.java | 4 ++-
.../apache/juneau/http/response/Unauthorized.java | 4 ++-
.../http/response/UnavailableForLegalReasons.java | 4 ++-
.../juneau/http/response/UnprocessableEntity.java | 4 ++-
.../juneau/http/response/UnsupportedMediaType.java | 4 ++-
.../juneau/http/response/UpgradeRequired.java | 4 ++-
.../apache/juneau/http/response/UriTooLong.java | 4 ++-
.../org/apache/juneau/http/response/UseProxy.java | 4 ++-
.../http/response/VariantAlsoNegotiates.java | 4 ++-
.../org/apache/juneau/httppart/HttpPartSchema.java | 12 +++++--
.../juneau/httppart/bean/ResponseBeanMeta.java | 22 +++++++------
.../juneau/rest/BasicSwaggerProviderSession.java | 15 +++++----
.../java/org/apache/juneau/rest/RestContext.java | 10 +++---
.../http/annotation/AnnotationUtils_Test.java | 2 --
.../http/annotation/ResponseAnnotation_Test.java | 16 ++--------
.../annotation/ResponseStatusAnnotation_Test.java | 11 +++++--
.../java/org/apache/juneau/rest/Swagger_Test.java | 24 +++++++-------
.../juneau/rest/annotation/Response_Test.java | 4 +--
.../rest/annotation/Swagger_Response_Test.java | 8 ++---
69 files changed, 257 insertions(+), 178 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Response.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Response.java
index c8c14a2..71d4031 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Response.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Response.java
@@ -53,13 +53,6 @@ import org.apache.juneau.oapi.*;
public @interface Response {
/**
- * The HTTP response code.
- *
- * The default value is <c>500</c> for exceptions and <c>200</c> for
return types.
- */
- int[] code() default {};
-
- /**
* Serialized examples of the body of a response.
*
* <p>
@@ -157,23 +150,4 @@ public @interface Response {
* Overrides for this part the part serializer defined on the REST
resource which by default is {@link OpenApiSerializer}.
*/
Class<? extends HttpPartSerializer> serializer() default
HttpPartSerializer.Null.class;
-
- /**
- * A synonym for {@link #code()}.
- *
- * <p>
- * Allows you to use shortened notation if you're only specifying the
code.
- *
- * <p>
- * The following are completely equivalent ways of defining the
response code:
- * <p class='bcode w800'>
- * <ja>@Response</ja>(code=404)
- * <jk>public class</jk> NotFound <jk>extends</jk> RestException
{...}
- * </p>
- * <p class='bcode w800'>
- * <ja>@Response</ja>(404)
- * <jk>public class</jk> NotFound <jk>extends</jk> RestException
{...}
- * </p>
- */
- int[] value() default {};
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
index 23dbbc3..886aa11 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseAnnotation.java
@@ -18,7 +18,6 @@ import static org.apache.juneau.internal.ArrayUtils.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
-import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -92,7 +91,6 @@ public class ResponseAnnotation {
Class<? extends HttpPartParser> parser =
HttpPartParser.Null.class;
Class<? extends HttpPartSerializer> serializer =
HttpPartSerializer.Null.class;
- int[] code={}, value={};
ResponseHeader[] headers={};
Schema schema = SchemaAnnotation.DEFAULT;
String[] examples={};
@@ -114,17 +112,6 @@ public class ResponseAnnotation {
}
/**
- * Sets the {@link Response#code} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder code(int...value) {
- this.code = value;
- return this;
- }
-
- /**
* Sets the {@link Response#examples} property on this
annotation.
*
* @param value The new value for this property.
@@ -179,17 +166,6 @@ public class ResponseAnnotation {
return this;
}
- /**
- * Sets the {@link Response#value} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object.
- */
- public Builder value(int...value) {
- this.value = value;
- return this;
- }
-
// <FluentSetters>
@Override /* GENERATED - TargetedAnnotationBuilder */
@@ -227,29 +203,21 @@ public class ResponseAnnotation {
private final Class<? extends HttpPartParser> parser;
private final Class<? extends HttpPartSerializer> serializer;
- private final int[] code, value;
private final ResponseHeader[] headers;
private final Schema schema;
private final String[] examples;
Impl(Builder b) {
super(b);
- this.code = Arrays.copyOf(b.code, b.code.length);
this.examples = copyOf(b.examples);
this.headers = copyOf(b.headers);
this.parser = b.parser;
this.schema = b.schema;
this.serializer = b.serializer;
- this.value = Arrays.copyOf(b.value, b.value.length);
postConstruct();
}
@Override /* Response */
- public int[] code() {
- return code;
- }
-
- @Override /* Response */
public String[] examples() {
return examples;
}
@@ -273,11 +241,6 @@ public class ResponseAnnotation {
public Class<? extends HttpPartSerializer> serializer() {
return serializer;
}
-
- @Override /* Response */
- public int[] value() {
- return value;
- }
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCode.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCode.java
index 944cea0..ec98a65 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCode.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCode.java
@@ -124,4 +124,10 @@ public @interface ResponseCode {
*/
Class<?>[] onClass() default {};
+ /**
+ * The HTTP response codes.
+ *
+ * The default value is <c>500</c> for exceptions and <c>200</c> for
return types.
+ */
+ int[] value() default {};
}
\ No newline at end of file
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCodeAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCodeAnnotation.java
index 77031b4..04ee1ea 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCodeAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/ResponseCodeAnnotation.java
@@ -16,6 +16,7 @@ import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
+import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -76,6 +77,8 @@ public class ResponseCodeAnnotation {
*/
public static class Builder extends TargetedAnnotationTMBuilder {
+ int value[] = {};
+
/**
* Constructor.
*/
@@ -92,6 +95,17 @@ public class ResponseCodeAnnotation {
return new Impl(this);
}
+ /**
+ * Sets the {@link ResponseCode#value} property on this
annotation.
+ *
+ * @param value The new value for this property.
+ * @return This object.
+ */
+ public Builder value(int...value) {
+ this.value = value;
+ return this;
+ }
+
// <FluentSetters>
@Override /* GENERATED - TargetedAnnotationBuilder */
@@ -127,10 +141,18 @@ public class ResponseCodeAnnotation {
private static class Impl extends TargetedAnnotationTImpl implements
ResponseCode {
+ private final int[] value;
+
Impl(Builder b) {
super(b);
+ this.value = Arrays.copyOf(b.value, b.value.length);
postConstruct();
}
+
+ @Override /* Response */
+ public int[] value() {
+ return value;
+ }
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Accepted.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Accepted.java
index fa4bdaa..3f14a58 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Accepted.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Accepted.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The request has been accepted for processing, but the processing has not
been completed.
* The request might or might not be eventually acted upon, and may be
disallowed when processing occurs.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Accepted extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/AlreadyReported.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/AlreadyReported.java
index 2ccefe4..e8aba24 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/AlreadyReported.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/AlreadyReported.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The members of a DAV binding have already been enumerated in a preceding
part of the (multistatus) response, and are not being included again.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class AlreadyReported extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/BadRequest.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/BadRequest.java
index 5f29532..8009c8a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/BadRequest.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/BadRequest.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server cannot or will not process the request due to an apparent client
error (e.g., malformed request syntax, size too large, invalid request message
framing, or deceptive request routing).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class BadRequest extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Conflict.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Conflict.java
index 48a0810..cfbe550 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Conflict.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Conflict.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* Indicates that the request could not be processed because of conflict in
the request, such as an edit conflict between multiple simultaneous updates.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Conflict extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Continue.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Continue.java
index e24682a..162e9bc 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Continue.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Continue.java
@@ -28,7 +28,9 @@ import org.apache.juneau.http.annotation.*;
* If the client receives an error code such as 403 (Forbidden) or 405 (Method
Not Allowed) then it shouldn't send the request's body.
* The response 417 Expectation Failed indicates that the request should be
repeated without the Expect header as it indicates that the server doesn't
support expectations (this is the case, for example, of HTTP/1.0 servers).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Continue extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Created.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Created.java
index 80eed7b..f0c1ed6 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Created.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Created.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request has been fulfilled, resulting in the creation of a new resource.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Created extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/EarlyHints.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/EarlyHints.java
index ed4ebd6..742f63a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/EarlyHints.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/EarlyHints.java
@@ -23,7 +23,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* Used to return some response headers before final HTTP message.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class EarlyHints extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ExpectationFailed.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ExpectationFailed.java
index a9bcc21..4614078 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ExpectationFailed.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ExpectationFailed.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server cannot meet the requirements of the Expect request-header field.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class ExpectationFailed extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/FailedDependency.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/FailedDependency.java
index 1621a4d..6b15280 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/FailedDependency.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/FailedDependency.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request failed because it depended on another request and that request
failed (e.g., a PROPPATCH).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class FailedDependency extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Forbidden.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Forbidden.java
index de9a940..67d6c52 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Forbidden.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Forbidden.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The request was valid, but the server is refusing action.
* <br>The user might not have the necessary permissions for a resource, or
may need an account of some sort.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Forbidden extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Found.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Found.java
index edae491..4d039f5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Found.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Found.java
@@ -28,7 +28,9 @@ import org.apache.juneau.http.annotation.*;
* Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between
the two behaviours.
* However, some Web applications and frameworks use the 302 status code as if
it were the 303.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Found extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Gone.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Gone.java
index e84ae56..db6f8b3 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Gone.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Gone.java
@@ -30,7 +30,9 @@ import org.apache.juneau.http.annotation.*;
* <br>Clients such as search engines should remove the resource from their
indices.
* <br>Most use cases do not require clients and search engines to purge the
resource, and a <js>"404 Not Found"</js> may be used instead.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Gone extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/HttpVersionNotSupported.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/HttpVersionNotSupported.java
index 4ba9f05..69b8f9c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/HttpVersionNotSupported.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/HttpVersionNotSupported.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server does not support the HTTP protocol version used in the request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class HttpVersionNotSupported extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/IMUsed.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/IMUsed.java
index 084cca4..97b92b2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/IMUsed.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/IMUsed.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server has fulfilled a request for the resource, and the response is a
representation of the result of one or more instance-manipulations applied to
the current instance.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class IMUsed extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InsufficientStorage.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InsufficientStorage.java
index 5ee9f14..b859a3c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InsufficientStorage.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InsufficientStorage.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server is unable to store the representation needed to complete the
request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class InsufficientStorage extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InternalServerError.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InternalServerError.java
index 6e615ea..4132e99 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InternalServerError.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/InternalServerError.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* A generic error message, given when an unexpected condition was encountered
and no more specific message is suitable.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class InternalServerError extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LengthRequired.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LengthRequired.java
index f6426d5..4da1c89 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LengthRequired.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LengthRequired.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request did not specify the length of its content, which is required by
the requested resource.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class LengthRequired extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Locked.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Locked.java
index dfa8dd9..c606515 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Locked.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Locked.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The resource that is being accessed is locked.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Locked extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LoopDetected.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LoopDetected.java
index e301bd0..81bef72 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LoopDetected.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/LoopDetected.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server detected an infinite loop while processing the request (sent in
lieu of 208 Already Reported).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class LoopDetected extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MethodNotAllowed.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MethodNotAllowed.java
index b6c5fff..9ae2560 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MethodNotAllowed.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MethodNotAllowed.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* A request method is not supported for the requested resource; for example,
a GET request on a form that requires data to be presented via POST, or a PUT
request on a read-only resource.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class MethodNotAllowed extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MisdirectedRequest.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MisdirectedRequest.java
index 1877743..ea01b5f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MisdirectedRequest.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MisdirectedRequest.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request was directed at a server that is not able to produce a response
(for example because of connection reuse).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class MisdirectedRequest extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MovedPermanently.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MovedPermanently.java
index 8e1ec82..cc61d81 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MovedPermanently.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MovedPermanently.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* This and all future requests should be directed to the given URI.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class MovedPermanently extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultiStatus.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultiStatus.java
index 6716bc8..99be41c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultiStatus.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultiStatus.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The message body that follows is by default an XML message and can contain
a number of separate response codes, depending on how many sub-requests were
made.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class MultiStatus extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultipleChoices.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultipleChoices.java
index 5449ac8..3218750 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultipleChoices.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/MultipleChoices.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* Indicates multiple options for the resource from which the client may
choose (via agent-driven content negotiation).
* For example, this code could be used to present multiple video format
options, to list files with different filename extensions, or to suggest
word-sense disambiguation.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class MultipleChoices extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NetworkAuthenticationRequired.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NetworkAuthenticationRequired.java
index 566948a..97bcb6c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NetworkAuthenticationRequired.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NetworkAuthenticationRequired.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The client needs to authenticate to gain network access.
* <br>Intended for use by intercepting proxies used to control access to the
network (e.g., "captive portals" used to require agreement to Terms of Service
before granting full Internet access via a Wi-Fi hotspot).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NetworkAuthenticationRequired extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NoContent.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NoContent.java
index 7c73ffd..7ae0880 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NoContent.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NoContent.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server successfully processed the request and is not returning any
content.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NoContent extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NonAuthoritiveInformation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NonAuthoritiveInformation.java
index c3a4af9..ef0d358 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NonAuthoritiveInformation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NonAuthoritiveInformation.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server is a transforming proxy (e.g. a Web accelerator) that received a
200 OK from its origin, but is returning a modified version of the origin's
response.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NonAuthoritiveInformation extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotAcceptable.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotAcceptable.java
index d1cd124..08e3205 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotAcceptable.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotAcceptable.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <br>
* The requested resource is capable of generating only content not acceptable
according to the Accept headers sent in the request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NotAcceptable extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotExtended.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotExtended.java
index 108a783..c25f44a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotExtended.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotExtended.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* Further extensions to the request are required for the server to fulfill it.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NotExtended extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotFound.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotFound.java
index d4fc002..eeb82e5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotFound.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotFound.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The requested resource could not be found but may be available in the
future.
* <br>Subsequent requests by the client are permissible.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NotFound extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotImplemented.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotImplemented.java
index 425895c..e5d2d6e 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotImplemented.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotImplemented.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The server either does not recognize the request method, or it lacks the
ability to fulfill the request.
* <br>Usually this implies future availability (e.g., a new feature of a
web-service API).
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NotImplemented extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotModified.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotModified.java
index 39e5aab..ade706d 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotModified.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/NotModified.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* Indicates that the resource has not been modified since the version
specified by the request headers If-Modified-Since or If-None-Match.
* In such case, there is no need to retransmit the resource since the client
still has a previously-downloaded copy.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class NotModified extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Ok.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Ok.java
index 859f921..17788dc 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Ok.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Ok.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* In a GET request, the response will contain an entity corresponding to the
requested resource.
* In a POST request, the response will contain an entity describing or
containing the result of the action.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Ok extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PartialContent.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PartialContent.java
index 8c0de75..58adaec 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PartialContent.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PartialContent.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The server is delivering only part of the resource (byte serving) due to a
range header sent by the client.
* The range header is used by HTTP clients to enable resuming of interrupted
downloads, or split a download into multiple simultaneous streams.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class PartialContent extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PayloadTooLarge.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PayloadTooLarge.java
index c87d5af..b1481b1 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PayloadTooLarge.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PayloadTooLarge.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request is larger than the server is willing or able to process.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class PayloadTooLarge extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PermanentRedirect.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PermanentRedirect.java
index 0cab361..a0a0410 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PermanentRedirect.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PermanentRedirect.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The request and all future requests should be repeated using another URI.
307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP
method to change.
* So, for example, submitting a form to a permanently redirected resource may
continue smoothly.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class PermanentRedirect extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionFailed.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionFailed.java
index 8d75f7e..0fc6586 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionFailed.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionFailed.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server does not meet one of the preconditions that the requester put on
the request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class PreconditionFailed extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionRequired.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionRequired.java
index 3d9297e..73da0a3 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionRequired.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/PreconditionRequired.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The origin server requires the request to be conditional.
* <br>Intended to prevent the 'lost update' problem, where a client GETs a
resource's state, modifies it, and PUTs it back to the server, when meanwhile a
third party has modified the state on the server, leading to a conflict.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class PreconditionRequired extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Processing.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Processing.java
index 4ee462b..b374c1e 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Processing.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Processing.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* This code indicates that the server has received and is processing the
request, but no response is available yet.
* This prevents the client from timing out and assuming the request was lost.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Processing extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RangeNotSatisfiable.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RangeNotSatisfiable.java
index 533b141..a929946 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RangeNotSatisfiable.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RangeNotSatisfiable.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The client has asked for a portion of the file (byte serving), but the
server cannot supply that portion.
* <br>For example, if the client asked for a part of the file that lies
beyond the end of the file.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class RangeNotSatisfiable extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RequestHeaderFieldsTooLarge.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RequestHeaderFieldsTooLarge.java
index c1d9fef..7b2b180 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RequestHeaderFieldsTooLarge.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/RequestHeaderFieldsTooLarge.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The server is unwilling to process the request because either an individual
header field, or all the header fields collectively, are too large.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class RequestHeaderFieldsTooLarge extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ResetContent.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ResetContent.java
index 5e02882..8269074 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ResetContent.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ResetContent.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The server successfully processed the request, but is not returning any
content.
* Unlike a 204 response, this response requires that the requester reset the
document view.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class ResetContent extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
index e83e9f3..9e65d01 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The response to the request can be found under another URI using the GET
method.
* When received in response to a POST (or PUT/DELETE), the client should
presume that the server has received the data and should issue a new GET
request to the given URI.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class SeeOther extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ServiceUnavailable.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ServiceUnavailable.java
index cc529b9..fa78404 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ServiceUnavailable.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/ServiceUnavailable.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The server is currently unavailable (because it is overloaded or down for
maintenance).
* <br>Generally, this is a temporary state.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class ServiceUnavailable extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SwitchingProtocols.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SwitchingProtocols.java
index 33e263b..8488b03 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SwitchingProtocols.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SwitchingProtocols.java
@@ -24,7 +24,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The requester has asked the server to switch protocols and the server has
agreed to do so.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class SwitchingProtocols extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TemporaryRedirect.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TemporaryRedirect.java
index 2e30008..db51a24 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TemporaryRedirect.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TemporaryRedirect.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* In contrast to how 302 was historically implemented, the request method is
not allowed to be changed when reissuing the original request.
* For example, a POST request should be repeated using another POST request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class TemporaryRedirect extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TooManyRequests.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TooManyRequests.java
index eb1b9da..f00d4b4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TooManyRequests.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/TooManyRequests.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The user has sent too many requests in a given amount of time.
* <br>Intended for use with rate-limiting schemes.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class TooManyRequests extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Unauthorized.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Unauthorized.java
index 6e01aca..1464553 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Unauthorized.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/Unauthorized.java
@@ -29,7 +29,9 @@ import org.apache.juneau.http.annotation.*;
* <br>401 semantically means "unauthenticated",i.e. the user does not have
the necessary credentials.
* <br>Note: Some sites issue HTTP 401 when an IP address is banned from the
website (usually the website domain) and that specific address is refused
permission to access a website.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class Unauthorized extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnavailableForLegalReasons.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnavailableForLegalReasons.java
index 1e2371a..0a6d752 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnavailableForLegalReasons.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnavailableForLegalReasons.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* A server operator has received a legal demand to deny access to a resource
or to a set of resources that includes the requested resource.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UnavailableForLegalReasons extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnprocessableEntity.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnprocessableEntity.java
index 024b57e..8420f8c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnprocessableEntity.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnprocessableEntity.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The request was well-formed but was unable to be followed due to semantic
errors.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UnprocessableEntity extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnsupportedMediaType.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnsupportedMediaType.java
index a73d699..e079077 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnsupportedMediaType.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UnsupportedMediaType.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The request entity has a media type which the server or resource does not
support.
* <br>For example, the client uploads an image as image/svg+xml, but the
server requires that images use a different format.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UnsupportedMediaType extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UpgradeRequired.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UpgradeRequired.java
index 67cb2a7..196fc84 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UpgradeRequired.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UpgradeRequired.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* The client should switch to a different protocol such as TLS/1.0, given in
the Upgrade header field.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UpgradeRequired extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UriTooLong.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UriTooLong.java
index 7f6fc74..f660cc5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UriTooLong.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UriTooLong.java
@@ -27,7 +27,9 @@ import org.apache.juneau.http.annotation.*;
* The URI provided was too long for the server to process.
* <br>Often the result of too much data being encoded as a query-string of a
GET request, in which case it should be converted to a POST request.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UriTooLong extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UseProxy.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UseProxy.java
index 80654e3..0083d8f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UseProxy.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/UseProxy.java
@@ -25,7 +25,9 @@ import org.apache.juneau.http.annotation.*;
* The requested resource is available only through a proxy, the address for
which is provided in the response.
* Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly
handle responses with this status code, primarily for security reasons.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class UseProxy extends BasicHttpResponse {
/** HTTP status code */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/VariantAlsoNegotiates.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/VariantAlsoNegotiates.java
index 293a410..1614af3 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/VariantAlsoNegotiates.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/VariantAlsoNegotiates.java
@@ -26,7 +26,9 @@ import org.apache.juneau.http.annotation.*;
* <p>
* Transparent content negotiation for the request results in a circular
reference.
*/
-@Response(code=STATUS_CODE) @Schema(description=REASON_PHRASE)
+@Response
+@ResponseCode(STATUS_CODE)
+@Schema(description=REASON_PHRASE)
public class VariantAlsoNegotiates extends BasicHttpException {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
index e481d7f..cc90cb1 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
@@ -720,6 +720,8 @@ public class HttpPartSchema {
apply((Path)a);
else if (a instanceof Response)
apply((Response)a);
+ else if (a instanceof ResponseCode)
+ apply((ResponseCode)a);
else if (a instanceof ResponseHeader)
apply((ResponseHeader)a);
else if (a instanceof HasQuery)
@@ -796,11 +798,15 @@ public class HttpPartSchema {
Builder apply(Response a) {
allowEmptyValue(true);
apply(a.schema());
- codes(a.code());
- codes(a.value());
parser(a.parser());
required(false);
- serializer(a.serializer()); return
this;
+ serializer(a.serializer());
+ return this;
+ }
+
+ Builder apply(ResponseCode a) {
+ codes(a.value());
+ return this;
}
Builder apply(Items a) {
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
index 0248737..c7ffc8b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
@@ -50,8 +50,8 @@ public class ResponseBeanMeta {
return null;
Builder b = new Builder(annotations);
b.apply(ci.innerType());
- for (Response r : ci.getAnnotations(Response.class))
- b.apply(r);
+ ci.getAnnotations(Response.class).forEach(x -> b.apply(x));
+ ci.getAnnotations(ResponseCode.class).forEach(x -> b.apply(x));
return b.build();
}
@@ -67,8 +67,8 @@ public class ResponseBeanMeta {
return null;
Builder b = new Builder(annotations);
b.apply(m.getReturnType().unwrap(Value.class,
Optional.class).innerType());
- for (Response r : m.getAnnotations(Response.class))
- b.apply(r);
+ m.getAnnotations(Response.class).forEach(x -> b.apply(x));
+ m.getAnnotations(ResponseCode.class).forEach(x -> b.apply(x));
return b.build();
}
@@ -84,8 +84,8 @@ public class ResponseBeanMeta {
return null;
Builder b = new Builder(annotations);
b.apply(mpi.getParameterType().unwrap(Value.class,
Optional.class).innerType());
- for (Response r : mpi.getAnnotations(Response.class))
- b.apply(r);
+ mpi.getAnnotations(Response.class).forEach(x -> b.apply(x));
+ mpi.getAnnotations(ResponseCode.class).forEach(x -> b.apply(x));
return b.build();
}
@@ -180,11 +180,15 @@ public class ResponseBeanMeta {
partSerializer = a.serializer();
if (a.parser() != HttpPartParser.Null.class)
partParser = a.parser();
+ schema.apply(a.schema());
+ }
+ return this;
+ }
+
+ Builder apply(ResponseCode a) {
+ if (a != null) {
if (a.value().length > 0)
code = a.value()[0];
- if (a.code().length > 0)
- code = a.code()[0];
- schema.apply(a.schema());
}
return this;
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicSwaggerProviderSession.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicSwaggerProviderSession.java
index ad13bb1..5a0990f 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicSwaggerProviderSession.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicSwaggerProviderSession.java
@@ -371,7 +371,8 @@ public class BasicSwaggerProviderSession {
for (ClassInfo eci : mi.getExceptionTypes()) {
if (eci.hasAnnotation(Response.class)) {
List<Response> la =
eci.getAnnotations(Response.class);
- Set<Integer> codes = getCodes(la, 500);
+ List<ResponseCode> la2 =
eci.getAnnotations(ResponseCode.class);
+ Set<Integer> codes = getCodes(la2, 500);
for (Response a : la) {
for (Integer code : codes) {
OMap om =
responses.getMap(String.valueOf(code), true);
@@ -401,7 +402,8 @@ public class BasicSwaggerProviderSession {
if (mi.hasAnnotation(Response.class) ||
mi.getReturnType().unwrap(Value.class,Optional.class).hasAnnotation(Response.class))
{
List<Response> la =
mi.getAnnotations(Response.class);
- Set<Integer> codes = getCodes(la, 200);
+ List<ResponseCode> la2 =
mi.getAnnotations(ResponseCode.class);
+ Set<Integer> codes = getCodes(la2, 200);
for (Response a : la) {
for (Integer code : codes) {
OMap om =
responses.getMap(String.valueOf(code), true);
@@ -464,7 +466,8 @@ public class BasicSwaggerProviderSession {
} else if (mpi.hasAnnotation(Response.class) ||
pt.hasAnnotation(Response.class)) {
List<Response> la =
AList.of(mpi.getAnnotations(Response.class)).a(pt.getAnnotations(Response.class));
- Set<Integer> codes = getCodes(la, 200);
+ List<ResponseCode> la2 =
AList.of(mpi.getAnnotations(ResponseCode.class)).a(pt.getAnnotations(ResponseCode.class));
+ Set<Integer> codes = getCodes(la2, 200);
Type type =
Value.unwrap(mpi.getParameterType().innerType());
for (Response a : la) {
for (Integer code : codes) {
@@ -1088,13 +1091,11 @@ public class BasicSwaggerProviderSession {
return "";
}
- private static Set<Integer> getCodes(List<Response> la, Integer def) {
+ private static Set<Integer> getCodes(List<ResponseCode> la, Integer
def) {
Set<Integer> codes = new TreeSet<>();
- for (Response a : la) {
+ for (ResponseCode a : la) {
for (int i : a.value())
codes.add(i);
- for (int i : a.code())
- codes.add(i);
}
if (codes.isEmpty() && def != null)
codes.add(def);
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 d101697..dabcb60 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
@@ -46,7 +46,7 @@ import java.util.stream.*;
import javax.servlet.*;
import javax.servlet.http.*;
-import org.apache.http.*;
+import org.apache.http.Header;
import org.apache.juneau.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.config.*;
@@ -56,7 +56,6 @@ import org.apache.juneau.dto.swagger.Swagger;
import org.apache.juneau.encoders.*;
import org.apache.juneau.html.*;
import org.apache.juneau.html.annotation.*;
-import org.apache.juneau.http.annotation.Response;
import org.apache.juneau.httppart.*;
import org.apache.juneau.httppart.bean.*;
import org.apache.juneau.internal.*;
@@ -70,6 +69,7 @@ import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.rest.args.*;
import org.apache.juneau.rest.logging.*;
import org.apache.juneau.rest.processors.*;
+import org.apache.juneau.http.annotation.*;
import org.apache.juneau.http.header.*;
import org.apache.juneau.http.response.*;
import org.apache.juneau.rest.util.*;
@@ -7090,10 +7090,10 @@ public class RestContext extends Context {
int code = 500;
ClassInfo ci = ClassInfo.ofc(e);
- Response r = ci.getLastAnnotation(Response.class);
+ ResponseCode r = ci.getLastAnnotation(ResponseCode.class);
if (r != null)
- if (r.code().length > 0)
- code = r.code()[0];
+ if (r.value().length > 0)
+ code = r.value()[0];
BasicHttpException e2 = (e instanceof BasicHttpException ?
(BasicHttpException)e :
BasicHttpException.create(BasicHttpException.class).causedBy(e).statusCode(code).build());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/AnnotationUtils_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/AnnotationUtils_Test.java
index 8252335..c76e2e1 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/AnnotationUtils_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/AnnotationUtils_Test.java
@@ -199,13 +199,11 @@ public class AnnotationUtils_Test {
assertTrue(ResponseAnnotation.empty(response().build()));
assertTrue(ResponseAnnotation.empty((Response)null));
-
assertFalse(ResponseAnnotation.empty(response().code(a(0)).build()));
assertFalse(ResponseAnnotation.empty(response().examples(a("foo")).build()));
assertFalse(ResponseAnnotation.empty(response().headers(new
ResponseHeader[]{responseHeader().name("foo").build()}).build()));
assertFalse(ResponseAnnotation.empty(response().parser(OpenApiParser.class).build()));
assertFalse(ResponseAnnotation.empty(response().schema(schema().$ref("foo").build()).build()));
assertFalse(ResponseAnnotation.empty(response().serializer(OpenApiSerializer.class).build()));
-
assertFalse(ResponseAnnotation.empty(response().value(a(0)).build()));
}
@Test
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseAnnotation_Test.java
index db2043a..ed32407 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseAnnotation_Test.java
@@ -32,7 +32,6 @@ public class ResponseAnnotation_Test {
//------------------------------------------------------------------------------------------------------------------
Response a1 = ResponseAnnotation.create()
- .code(1)
.examples("examples")
.headers(ResponseHeaderAnnotation.DEFAULT)
.on("on")
@@ -40,11 +39,9 @@ public class ResponseAnnotation_Test {
.parser(OpenApiParser.class)
.schema(SchemaAnnotation.DEFAULT)
.serializer(OpenApiSerializer.class)
- .value(2)
.build();
Response a2 = ResponseAnnotation.create()
- .code(1)
.examples("examples")
.headers(ResponseHeaderAnnotation.DEFAULT)
.on("on")
@@ -52,22 +49,19 @@ public class ResponseAnnotation_Test {
.parser(OpenApiParser.class)
.schema(SchemaAnnotation.DEFAULT)
.serializer(OpenApiSerializer.class)
- .value(2)
.build();
@Test
public void a01_basic() {
assertObject(a1).asJson().matches(""
+ "{"
- + "code:[1],"
+ "examples:['examples'],"
+ "headers:[*],"
+ "on:['on'],"
+ "onClass:['"+CNAME+"$X1'],"
+
"parser:'org.apache.juneau.oapi.OpenApiParser',"
+ "schema:{*,"
- +
"serializer:'org.apache.juneau.oapi.OpenApiSerializer',"
- + "value:[2]"
+ +
"serializer:'org.apache.juneau.oapi.OpenApiSerializer'"
+ "}"
);
}
@@ -118,29 +112,25 @@ public class ResponseAnnotation_Test {
//------------------------------------------------------------------------------------------------------------------
@Response(
- code=1,
examples="examples",
headers=@ResponseHeader,
on="on",
onClass=X1.class,
parser=OpenApiParser.class,
schema=@Schema,
- serializer=OpenApiSerializer.class,
- value=2
+ serializer=OpenApiSerializer.class
)
public static class D1 {}
Response d1 = D1.class.getAnnotationsByType(Response.class)[0];
@Response(
- code=1,
examples="examples",
headers=@ResponseHeader,
on="on",
onClass=X1.class,
parser=OpenApiParser.class,
schema=@Schema,
- serializer=OpenApiSerializer.class,
- value=2
+ serializer=OpenApiSerializer.class
)
public static class D2 {}
Response d2 = D2.class.getAnnotationsByType(Response.class)[0];
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseStatusAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseStatusAnnotation_Test.java
index 43a8f58..1d42852 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseStatusAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/annotation/ResponseStatusAnnotation_Test.java
@@ -33,11 +33,13 @@ public class ResponseStatusAnnotation_Test {
ResponseCode a1 = ResponseCodeAnnotation.create()
.on("on")
.onClass(X1.class)
+ .value(1)
.build();
ResponseCode a2 = ResponseCodeAnnotation.create()
.on("on")
.onClass(X1.class)
+ .value(1)
.build();
@Test
@@ -45,7 +47,8 @@ public class ResponseStatusAnnotation_Test {
assertObject(a1).asJson().is(""
+ "{"
+ "on:['on'],"
- + "onClass:['"+CNAME+"$X1']"
+ + "onClass:['"+CNAME+"$X1'],"
+ + "value:[1]"
+ "}"
);
}
@@ -97,14 +100,16 @@ public class ResponseStatusAnnotation_Test {
@ResponseCode(
on="on",
- onClass=X1.class
+ onClass=X1.class,
+ value=1
)
public static class D1 {}
ResponseCode d1 = D1.class.getAnnotationsByType(ResponseCode.class)[0];
@ResponseCode(
on="on",
- onClass=X1.class
+ onClass=X1.class,
+ value=1
)
public static class D2 {}
ResponseCode d2 = D2.class.getAnnotationsByType(ResponseCode.class)[0];
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
index 40b20f7..f6e6650 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java
@@ -1670,7 +1670,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public O1c a() { return null;}
}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class O1c {
public String a;
}
@@ -1720,7 +1720,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public O4c a() {return null;}
}
- @Response(code=100) @Schema(description="c-100-description")
+ @Response @ResponseCode(100) @Schema(description="c-100-description")
public static class O4c {}
@Test
@@ -1744,7 +1744,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public O5c a() {return null;}
}
- @Response(code=100) @Schema(description="$L{foo}")
+ @Response @ResponseCode(100) @Schema(description="$L{foo}")
public static class O5c {}
@Test
@@ -1772,7 +1772,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public P1c a() {return null;}
}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class P1c {
public String a;
}
@@ -1826,7 +1826,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public P4c a() {return null;}
}
-
@Response(code=100,headers=@ResponseHeader(name="X-Foo",schema=@Schema(description="d-description",type="integer",format="int32")))
+
@Response(headers=@ResponseHeader(name="X-Foo",schema=@Schema(description="d-description",type="integer",format="int32")))
@ResponseCode(100)
public static class P4c {}
@Test
@@ -1850,7 +1850,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public P5c a() {return null;}
}
-
@Response(code=100,headers=@ResponseHeader(name="X-Foo",schema=@Schema(description="$L{foo}",type="integer",format="int32")))
+
@Response(headers=@ResponseHeader(name="X-Foo",schema=@Schema(description="$L{foo}",type="integer",format="int32")))
@ResponseCode(100)
public static class P5c {}
@Test
@@ -1878,7 +1878,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public R1c a() {return null;}
}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class R1c {
public String a;
}
@@ -1928,7 +1928,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public R4c a() {return null;}
}
- @Response(code=100,examples="{foo:{bar:'d'}}")
+ @Response(examples="{foo:{bar:'d'}}") @ResponseCode(100)
public static class R4c {}
@Test
@@ -1952,7 +1952,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public R5c a() {return null;}
}
- @Response(code=100,examples="{foo:{bar:'$L{foo}'}}")
+ @Response(examples="{foo:{bar:'$L{foo}'}}") @ResponseCode(100)
public static class R5c {}
@Test
@@ -1980,7 +1980,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public S1c a() {return null;}
}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class S1c extends X {}
@Test
@@ -2028,7 +2028,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public S4c a() {return null;}
}
- @Response(code=100,schema=@Schema($ref="d"))
+ @Response(schema=@Schema($ref="d")) @ResponseCode(100)
public static class S4c extends X {}
@Test
@@ -2052,7 +2052,7 @@ public class Swagger_Test {
@RestGet(path="/path/{foo}/responses/100")
public S5c a() {return null;}
}
- @Response(code=100,schema=@Schema($ref="l-foo"))
+ @Response(schema=@Schema($ref="l-foo")) @ResponseCode(100)
public static class S5c extends X {}
@Test
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Response_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Response_Test.java
index 6e97f20..75170ad 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Response_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Response_Test.java
@@ -45,13 +45,13 @@ public class Response_Test {
}
}
- @Response(code=201)
+ @Response @ResponseCode(201)
public static class A1 {
@Override
public String toString() {return "foo";}
}
- @Response(code=501)
+ @Response @ResponseCode(501)
public static class A2 extends Exception {
@Override
public String toString() {return "foo";}
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Swagger_Response_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Swagger_Response_Test.java
index 27aa62b..304f405 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Swagger_Response_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Swagger_Response_Test.java
@@ -74,14 +74,14 @@ public class Swagger_Response_Test {
@RestOp
public A3 f() {return null;}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class A4 {}
@RestOp
public void g(Value<A4> r) {}
@RestOp
public A4 h() {return null;}
- @Response(100)
+ @Response @ResponseCode(100)
public static class A5 {}
@RestOp
public void i(Value<A5> r) {}
@@ -289,12 +289,12 @@ public class Swagger_Response_Test {
@RestPost
public void c() throws D3 {}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class D4 extends Throwable {}
@RestDelete
public void d() throws D4 {}
- @Response(code=100)
+ @Response @ResponseCode(100)
public static class D5 extends Throwable {}
@RestOp
public void e() throws D5 {}