annotate lib/IMPL/Web/OutOfRangeException.pm @ 423:60c2892a577c ref20150831

working on base class system
author cin
date Mon, 02 Apr 2018 07:35:23 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Web::OutOfRangeException;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4 use IMPL::declare {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 base => {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 'IMPL::Web::Exception' => '@_'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 },
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 sub CTOR {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 my ($this,$range) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 #TODO: validate args
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 $this->headers({
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 content_range => { $range->{units} . ' */' . $range->{length} }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 });
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 use IMPL::Resources::Strings {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 message => 'The specified range is invalid'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 sub status {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 "416 Requested Range Not Satisfiable"
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 1;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 __END__
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
31
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32 =pod
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
34 =head1 NAME
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
35
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 C<IMPL::Web::OutOfRangeException> A server SHOULD return a response with this
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
37 status code if a request included a Range request-header field (section 14.35),
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 and none of the range-specifier values in this field overlap the current extent
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39 of the selected resource, and the request did not include an If-Range
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40 request-header field. (For byte-ranges, this means that the first- byte-pos of
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
41 all of the byte-range-spec values were greater than the current length of the
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
42 selected resource.)
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
43
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
44 =head1 DESCRIPTION
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
45
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
46 When this status code is returned for a byte-range request, the response SHOULD
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
47 include a Content-Range entity-header field specifying the current length of the
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
48 selected resource (see section 14.16). This response MUST NOT use the
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
49 multipart/byteranges content- type.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
50
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
51 =cut