Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

BC Java - Assignment 10 - Spring Boot

Requirements

Question 1: Path + Query

Question 2: POST + Query + Body

Question 3: Header + Path

Question 4: Query Param có default

Question 5: Nhận danh sách Query

Question 6: Query Map động

Question 7: Form URL Encoded

Question 8: Multipart + nhiều tham số

  • Requirement:
    • API:
      • POST /documents
      • Nhận:
        • file
        • title
        • description
        • tags (list)
    • Dùng MultipartFile + @RequestParam
  • Solution: Question 8
  • URL: http://localhost:8080/q8/documents
    • Choice "Body" > "form-data"
    • Enter "title", "description", "tags" (String)
    • Enter "file" (File) and select a file

Question 9: PUT cập nhật từng phần

  • Requirement:
    • API:

      • PUT /users/{id}
        • Body:

          {
            "email": "new@email.com"
          }
    • Dùng @PutMapping + @RequestBody + @PathVariable

  • Solution: Question 9
  • URL: PUT http://localhost:8080/q9/users/1
    • Body:

      {
        "email": "new@email.com"
      }

Question 10: DELETE + Header xác thực

  • Requirement:
    • API:
      • DELETE /posts/{id}
        • Header: Authorization: Bearer xxx
    • Dùng @DeleteMapping + @RequestHeader
  • Solution: Question 10
  • URL: http://localhost:8080/q10/posts/1
    • Case success: Authorization: Bearer abc
    • Case fail: Authorization: Bearerabc or miss Authorization

Prerequisites

Project Structure

Environment

  • IDE: IntelliJ
  • Java 21

Author

Khang Nguyen

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages