Skip to content

Commit

Permalink
Add documentation for @Cache and @nocache
Browse files Browse the repository at this point in the history
Follows up on #17644
  • Loading branch information
geoand committed Jun 3, 2021
1 parent 577f3ac commit 8dcaf6f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/src/main/asciidoc/resteasy-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,15 @@ public class Endpoint {
}
----

=== Controlling HTTP Caching features

RESTEasy Reactive provides the `@org.jboss.resteasy.reactive.Cache` and `@org.jboss.resteasy.reactive.NoCache` to facilitate hangling HTTP caching semantics, i.e. setting the 'Cache-Control' HTTP header.

These annotations can be placed either on a Resource Method or a Resource Class (in which case it applies to all Resource Methods of the class that do *not* contain the same annotation) and allow users
to return domain objects and not have to deal with building up the `Cache-Control` HTTP header explicitly.

While `@Cache` builds a complex `Cache-Control` header, `@NoCache` is a simplified notation to say that you don't want anything cached; i.e. `Cache-Control: nocache`.

=== Accessing context objects

[[context-objects]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Allows setting the {@code Cache-Control} header automatically.
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Cache {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Allows setting the @{code Cache-Control} response header of "nocache"
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface NoCache {
Expand Down

0 comments on commit 8dcaf6f

Please sign in to comment.