Skip to content

Commit

Permalink
fixup! Add annotation support for HX-Replace-Url
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaggi committed May 1, 2024
1 parent 8777ed8 commit 6ca6c3b
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
import java.lang.annotation.Target;

/**
* Annotation to replace the current URL in the location bar.
* Annotation to replace the current URL in the browser
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">location history</a>.
* <p>
* The possible values are:
* <ul>
* <li>{@link HtmxValue#TRUE}, which replaces the current URL with the fetched URL in the history.</li>
* <li>{@link HtmxValue#FALSE}, which prevents the browser’s current URL from being updated.</li>
* <li>A URL to replace the current URL in the location bar. This may be relative or absolute, as per
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState">history.replaceState()</a>,
* but must have the same origin as the current URL.</li>
* </ul>
*
* @see <a href="https://htmx.org/headers/hx-replace-url/">HX-Replace-Url</a>
*/
Expand All @@ -15,11 +25,7 @@
public @interface HxReplaceUrl {

/**
* The URL to replace the current URL in the location bar.
* This may be relative or absolute, as per
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState">history.replaceState()</a>,
* but must have the same origin as the current URL.
* Or {@link HtmxValue#FALSE} which prevents the browser’s current URL from being updated.
* The value for the {@code HX-Replace-Url} response header.
*/
String value();

Expand Down

0 comments on commit 6ca6c3b

Please sign in to comment.