Class: EPIC::Handles
- Inherits:
-
Collection
- Object
- Resource
- Collection
- EPIC::Handles
- Defined in:
- src/epic_handles.rb
Constant Summary
Constant Summary
Constants inherited from Resource
Resource::GLOBAL_LOCK_HASH, Resource::GLOBAL_LOCK_MUTEX
Instance Attribute Summary
Attributes included from Rackful::Resource
#get_etag, #get_last_modified, #path
Instance Method Summary (collapse)
-
- (void) do_POST(request, response)
Handles an HTTP/1.1 PUT request.
-
- (void) each
TODO: better implementation (server-side data retention) for streaming responses.
- - (void) prefix
Methods inherited from Collection
#recurse?, #to_rackful, #xhtml
Methods inherited from Resource
#initialize, #lock, lock, #unlock, #xhtml
Methods included from Rackful::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_rackful, #to_struct
Constructor Details
This class inherits a constructor from EPIC::Resource
Instance Method Details
- (void) do_POST(request, response)
Handles an HTTP/1.1 PUT request.
45 46 47 48 49 50 51 52 53 |
# File 'src/epic_handles.rb', line 45 def do_POST request, response generator_name = request.GET['generator'] || EPIC::DEFAULT_GENERATOR unless generator = request.resource_factory["/generators/#{generator_name}"] raise Rackful::HTTP400BadRequest, "No such generator: '#{generator_name}'" end pid_suffix = escape_path( generator.generate( request ) ) handle = request.resource_factory["/handles/#{prefix}/#{pid_suffix}"] handle.do_PUT( request, response ) end |
- (void) each
TODO: better implementation (server-side data retention) for streaming responses.
31 32 33 34 35 36 37 38 |
# File 'src/epic_handles.rb', line 31 def each start_position = self.prefix.size + 1 DB.instance.each_handle do |handle| yield Rackful::Path.new( self.path + escape_path(handle[start_position .. -1]) ) end # end end |
- (void) prefix
24 25 26 |
# File 'src/epic_handles.rb', line 24 def prefix @epic_handles_prefix ||= File::basename(path.unslashify).to_path.unescape end |