본문 바로가기
spring

[Spring] HttpStatus.LOCKED : 423 Client Error

by moonsiri 2022. 6. 3.
728x90
반응형

HTTP Status Code는 클라이언트가 보낸 HTTP 요청에 대한 서버의 응답을 코드로 표현한 것으로, 해당 코드로 요청의 성공, 실패, 실패 요인 등을 알 수 있습니다. HTTP 상태 코드 중 LOCKED 상태 코드에 대해 알아보겠습니다.

Locked라는 단어만으로 단순히 잠금상태로 판단하고 계정 잠금 등에 사용하면 안 됩니다. 423 상태 코드는 메서드의 소스 또는 대상 리소스가 잠겨 있음을 의미합니다. 이 응답에는 'lock-token-submitted' 또는 'non-conflict-lock'과 같은 적절한 전제 조건 또는 사후 조건 코드가 포함되어야 합니다.

423 Locked

  The 423 (Locked) status code means the source or destination resource of a method is locked.

  This response SHOULD contain an appropriate precondition or postcondition code, such as 'lock-token-submitted' or 'no-conflicting-lock'.

 

그리고 423은 WebDAV의 상태코드입니다.

WebDAV는 HTTP/1.1 프로토콜의 확장으로 WWW 서버에 저장된 문서와 파일을 편집하고 관리하는 사용자들 사이에 협업을 손쉽게 만들어 줍니다. 쉽게 말하면 FTP나 SMB처럼 파일 업로드, 다운로드 기능을 HTTP를 통해 웹서버에서 지원해준다는 이야기입니다.

WebDAV의 핵심 기능 중 하나는 사용자가 특정 파일과 디렉터리를 '잠금'하여 다른 사용자가 편집할 수 없도록 하는 것인데, 해당 잠금 상태 코드가 423 상태 코드입니다.

 

 

Example - Response with precondition code

   >>Response

      HTTP/1.1 423 Locked
      Content-Type: application/xml; charset="utf-8"
      Content-Length: xxxx

      <?xml version="1.0" encoding="utf-8" ?>
      <D:error xmlns:D="DAV:">
        <D:lock-token-submitted>
          <D:href>/workspace/webdav/</D:href>
        </D:lock-token-submitted>
      </D:error>

In this example, a client unaware of a depth-infinity lock on the parent collection "/workspace/webdav/" attempted to modify the collection member "/workspace/webdav/proposal.doc".

Some other useful preconditions and postconditions have been defined in other specifications extending WebDAV, such as [RFC3744] (see particularly Section 7.1.1), [RFC3253], and [RFC3648].

All these elements are in the "DAV:" namespace.  If not specified otherwise, the content for each condition's XML element is defined to be empty.

 

 

[Reference]

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/HttpStatus.html

https://datatracker.ietf.org/doc/html/rfc4918#section-11.3

https://datatracker.ietf.org/doc/html/rfc4918#section-9.10

https://www.holisticseo.digital/technical-seo/status-code/400s/423/

https://evertpot.com/http/423-locked

728x90
반응형

댓글