comparison Lib/IMPL/Web/OutOfRangeException.pm @ 322:cca158327c47

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