Skip to content

Commit

Permalink
[1183] - rename Entity annotation to Body
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Anderson <[email protected]>
  • Loading branch information
WhiteCat22 committed Oct 19, 2023
1 parent 7595659 commit 284012b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jaxrs-api/src/main/java/jakarta/ws/rs/BeanParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* <p>
* The JAX-RS runtime will instantiate the object and inject all it's fields and properties annotated with either one of
* the {@code @XxxParam} annotation ({@link PathParam &#64;PathParam}, {@link FormParam &#64;FormParam} ...) or the
* {@link Entity &#64;Entity} annotation. For the POJO classes same instantiation and injection rules
* {@link Body &#64;Body} annotation. For the POJO classes same instantiation and injection rules
* apply as in case of instantiation and injection of request-scoped root resource classes.
* </p>
* For example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -23,13 +23,13 @@
import java.lang.annotation.Target;

/**
* <p>Annotation that identifies the entity parameter.</p>
* <p>Annotation that identifies the body parameter.</p>
*
* @author Santiago Pericas-Geertsen
* @since 4.0
*/
@Target({ ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Entity {
public @interface Body {
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ Let us illustrate these concepts via an example:
@Path("/async/longRunning")
public class MyResource {
@GET
public void longRunningOp(@Suspended final AsyncResponse ar) {
@POST
public void longRunningOp(final AsyncResponse ar, @Body String message) {
executor.submit(
new Runnable() {
public void run() {
executeLongRunningOp();
...
ar.resume("Hello async world!");
}
});
Expand All @@ -44,9 +45,10 @@ public class MyResource {
----

A resource method that elects to produce a response asynchronously must
inject as a method parameter an instance of the class `AsyncResponse`
using the special annotation `@Suspended`. In the example above, the
method `longRunningOp` is called upon receiving a `GET` request. Rather
inject as a method parameter an instance of the class `AsyncResponse`. In
addition, if the request contains a body, the method parameter associated
with the body must be annotated with `@Body`. In the example above, the
method `longRunningOp` is called upon receiving a `POST` request. Rather
than producing a response immediately, this method forks a (non-request)
thread to execute a long running operation and returns immediately. Once
the execution of the long running operation is complete, the connection
Expand Down

0 comments on commit 284012b

Please sign in to comment.