class Tilia::Dav::Exception::Locked

Locked

The 423 is thrown when a client tried to access a resource that was locked, without supplying a valid lock token

Attributes

lock[RW]

Lock information

@var SabreDAVLocksLockInfo

Public Class Methods

new(lock = nil) click to toggle source

Creates the exception

A LockInfo object should be passed if the user should be informed which lock actually has the file locked.

@param DAVLocksLockInfo lock

# File lib/tilia/dav/exception/locked.rb, line 20
def initialize(lock = nil)
  self.lock = lock
end

Public Instance Methods

http_code() click to toggle source

Returns the HTTP statuscode for this exception

@return int

# File lib/tilia/dav/exception/locked.rb, line 27
def http_code
  423
end
serialize(_server, error_node) click to toggle source

This method allows the exception to include additional information into the WebDAV error response

@param DAVServer server @param DOMElement error_node @return void

# File lib/tilia/dav/exception/locked.rb, line 36
def serialize(_server, error_node)
  if lock
    error = LibXML::XML::Node.new('d:lock-token-submitted')
    error_node << error

    href = LibXML::XML::Node.new('d:href', lock.uri)
    error << href
  end
end