Hi,
On Wed Mar 04 06:29:28 2009, IFOMICHEV wrote:
Show quoted text> I'm not sure if it is a bug of Catalyst::Plugin::Server::XMLRPC or
> Catalyst::Plugin::SmartURI, but these two just don't work together.
> XMLRPC croaks with "Invalid XMLRPC request: No such method" on any
> XMLRPC-enabled method even if 'absolute' disposition for
> Catalyst::Plugin::SmartURI is selected.
this one was a real tricky one to track down. It's actually a bug in
C:P:SmartURI; the problem is that everytime ->uri is called, it
reinstantantiates the uri from $req->base.
This means any changes you make to it are lost the next time you access
->uri. And the way the XMLRPC server works is that it changes ->path
from the entrypoint (say /rpc) to point to the method (say, /hello).
When C:P:SmartURI is loaded, this change is lost, and therefor the
XMLRPC methods don't work, as it will try to find a method /rpc.
The below patch fixes this for ->uri, by using a URI cache. Other
methods in C:P:SmartURI would probably benefit from the same solution,
but I'll leave that up to the author. You can apply this patch now to
get around the problem you're experiencing as a work around.
I'm also moving this ticket to the C:P:SmartURI queue so the author can
pick it up.
Cheers,
--- /opt/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/SmartURI.pm
2009-03-04 18:47:02.000000000 +0100
+++ SmartURI.pm 2009-03-04 18:47:15.000000000 +0100
@@ -167,9 +167,12 @@
$c->prepare_uri($c->next::method(@_))
}
-{
+{
package Catalyst::Request::SmartURI;
- use base 'Catalyst::Request';
+ use base 'Catalyst::Request';
+ use parent 'Class::Accessor::Fast';
+ __PACKAGE__->mk_accessors('__uri_cache');
+
sub uri_with {
my $req = shift;
@@ -180,13 +183,20 @@
sub uri {
my $req = shift;
+ $req->__uri_cache( {} ) unless $req->__uri_cache;
+
my $uri_class = $context ? $context->uri_class : $conf_uri_class;
- $uri_class->new(
- $req->next::method(@_),
- ($req->{base} ? { reference => $req->base } : ())
- )
+ my $rv = $req->next::method(@_);
+
+ return $req->__uri_cache->{$req.$rv} ||=
+ $uri_class->new(
+ $rv,
+ ($req->{base} ? { reference => $req->base } : ())
+ );
}
+
+
sub referer {
my $req = shift;