GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
added exceptions and rescues for 401 and 400 codes
automatthew (author)
Sat Oct 04 01:20:35 -0700 2008
commit  0bb83d534d4096eb3bc69355973749d06b986eed
tree    c5a8f980a605c76015c039ede92c05dcebd51eaf
parent  35aec621a19c6d4b2250919ef9707bb69336cd8d
...
7
8
9
 
 
10
11
12
...
56
57
58
 
 
 
 
 
59
60
61
...
7
8
9
10
11
12
13
14
...
58
59
60
61
62
63
64
65
66
67
68
0
@@ -7,6 +7,8 @@ module Waves
0
     # mappings. The Simple foundation registers a minimal handler, while the Default foundation registers
0
     # a slightly fleshier one.
0
     class NotFoundError < RuntimeError ; end
0
+ class Unauthorized < RuntimeError; end
0
+ class BadRequest < RuntimeError; end
0
 
0
     # Redirect exceptions are rescued by the Waves dispatcher and used to set the
0
     # response status and location.
0
@@ -56,6 +58,11 @@ module Waves
0
           rescue Dispatchers::Redirect => redirect
0
             response.status = redirect.status
0
             response.location = redirect.path
0
+ rescue Dispatchers::Unauthorized
0
+ response.status = 401
0
+ response['WWW-Authenticate'] = "Basic realm=Waves"
0
+ rescue Dispatchers::BadRequest
0
+ response.status = 400
0
           end
0
         end
0
         Waves::Logger.info "#{request.method}: #{request.url} handled in #{(t*1000).round} ms."

Comments

    No one has commented yet.