From the course: HTMX with Thymeleaf in Spring Boot

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Demonstrate hx-post and hx-delete with Spring Security

Demonstrate hx-post and hx-delete with Spring Security - Spring Boot Tutorial

From the course: HTMX with Thymeleaf in Spring Boot

Demonstrate hx-post and hx-delete with Spring Security

- [Instructor] With 03-09_begin/records-management open in IntelliJ, let's continue to talk through and consider briefly some common HTTP verbs available with htmx. We've already been using hx-get quite often. In fact, if we look at the header.html under Resources, Templates, Fragments, header.html, we'll see around line 57 in the anchor tag that it has both a th:href and a th:hx-get. Both implicitly use HTTP GET by default. The th:hx-get uses htmx to make an AJAX call to load the content. As mentioned previously, this is considered a safe method in that there should be no side effect of modifying data behind the scenes. Because hx-get does not modify data, Spring Security waives some of the security requirements concerning CORS. Spring Security does not waive security requirements concerning PATCH, POST, PUT, and DELETE requests. Let's take a look at the editable-email-form.html located under Person, Modify. Even though here there is no CSRF token specified, Thymeleaf will insert a…

Contents