Exception: Rackful::HTTPStatus Abstract
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Rackful::HTTPStatus
- Includes:
- Resource
- Defined in:
- gems/rackful-0.1.1/lib/rackful_http_status.rb,
gems/rackful-0.1.1.orig/lib/rackful_http_status.rb
Overview
This class is abstract.
Exception which represents an HTTP Status response.
Direct Known Subclasses
HTTP201Created, HTTP202Accepted, HTTP301MovedPermanently, HTTP303SeeOther, HTTP304NotModified, HTTP307TemporaryRedirect, HTTP405MethodNotAllowed, HTTP406NotAcceptable, HTTP412PreconditionFailed, HTTP415UnsupportedMediaType, HTTPSimpleStatus
Defined Under Namespace
Classes: XHTML
Instance Attribute Summary (collapse)
- - (void) headers readonly
- - (void) status readonly
- - (void) to_rackful readonly
Attributes included from Resource
#get_etag, #get_last_modified, #path
Instance Method Summary (collapse)
-
- (HTTPStatus) initialize(status, message = nil, info = {})
constructor
A new instance of HTTPStatus.
Methods included from Resource
#default_headers, #destroy, #do_METHOD, #empty?, #http_DELETE, #http_GET, #http_HEAD, #http_OPTIONS, #http_PUT, #http_method, #http_methods, included, #requested?, #serializer, #title, #to_struct
Constructor Details
- (HTTPStatus) initialize(status, message = nil, info = {})
A new instance of HTTPStatus
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'gems/rackful-0.1.1/lib/rackful_http_status.rb', line 28 def initialize status, = nil, info = {} self.path = Request.current.path @status = status_code status raise "Wrong status: #{status}" if 0 == @status ||= '' @headers = {} @to_rackful = {} info.each do |k, v| if k.kind_of? Symbol then @to_rackful[k] = v else @headers[k] = v end end @to_rackful = nil if @to_rackful.empty? begin REXML::Document.new \ '<?xml version="1.0" encoding="UTF-8" ?>' + "<div>#{}</div>" rescue = Rack::Utils.escape_html() end super if 500 <= @status errors = Request.current.env['rack.errors'] errors.puts self.inspect errors.puts "Headers: #{@headers.inspect}" errors.puts "Info: #{@to_rackful.inspect}" end end |
Instance Attribute Details
- (void) headers (readonly)
20 21 22 |
# File 'gems/rackful-0.1.1/lib/rackful_http_status.rb', line 20 def headers @headers end |
- (void) status (readonly)
20 21 22 |
# File 'gems/rackful-0.1.1/lib/rackful_http_status.rb', line 20 def status @status end |
- (void) to_rackful (readonly)
20 21 22 |
# File 'gems/rackful-0.1.1/lib/rackful_http_status.rb', line 20 def to_rackful @to_rackful end |