[pve-devel] r5072 - pve-common/trunk
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri Aug 27 11:38:10 CEST 2010
Author: dietmar
Date: 2010-08-27 09:38:10 +0000 (Fri, 27 Aug 2010)
New Revision: 5072
Modified:
pve-common/trunk/ChangeLog
pve-common/trunk/RESTHandler.pm
Log:
(find_handler): return matched path template as 3rd argument
Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog 2010-08-27 07:24:56 UTC (rev 5071)
+++ pve-common/trunk/ChangeLog 2010-08-27 09:38:10 UTC (rev 5072)
@@ -2,6 +2,7 @@
* RESTHandler.pm (cli_handler2): simplify code - allow to pass
optional parameters as arguments.
+ (find_handler): return matched path template as 3rd argument
2010-08-26 Proxmox Support Team <support at proxmox.com>
Modified: pve-common/trunk/RESTHandler.pm
===================================================================
--- pve-common/trunk/RESTHandler.pm 2010-08-27 07:24:56 UTC (rev 5071)
+++ pve-common/trunk/RESTHandler.pm 2010-08-27 09:38:10 UTC (rev 5072)
@@ -134,7 +134,7 @@
}
sub __find_handler_full {
- my ($class, $method, $stack, $uri_param) = @_;
+ my ($class, $method, $stack, $uri_param, $pathmatchref) = @_;
my $info;
eval {
@@ -144,6 +144,8 @@
return undef if !$info;
+ $$pathmatchref .= '/' . $info->{path};
+
if (my $subh = $info->{subclass}) {
my $matchlen = scalar(@{$info->{match_re}});
@@ -163,10 +165,10 @@
$stack = [ join ('/', @$stack) ] if scalar(@$stack) > 1;
}
- return $subh->__find_handler_full($method, $stack, $uri_param);
+ return $subh->__find_handler_full($method, $stack, $uri_param, $pathmatchref);
}
- return ($class, $info);
+ return ($class, $info, $$pathmatchref);
};
sub find_handler {
@@ -174,7 +176,8 @@
my $stack = [ grep { length($_) > 0 } split('\/+' , $path)]; # skip empty fragments
- return $class->__find_handler_full($method, $stack, $uri_param);
+ my $pathmatch = '';
+ return $class->__find_handler_full($method, $stack, $uri_param, \$pathmatch);
}
sub handle {
More information about the pve-devel
mailing list