97
|
1 package IMPL::Web::QueryHandler::SecureCall;
|
|
2 use strict;
|
|
3 use base qw(IMPL::Web::QueryHandler);
|
|
4
|
|
5 use IMPL::Class::Property;
|
|
6 use IMPL::Exception;
|
|
7 use Carp;
|
|
8
|
|
9 BEGIN {
|
|
10 public property namespace => prop_all;
|
|
11 }
|
|
12
|
|
13 __PACKAGE__->PassThroughArgs;
|
|
14
|
|
15 sub Process {
|
|
16 my ($this,$action,$nextHandler) = @_;
|
|
17
|
|
18 my $namespace = $this->namespace || $action->application->type;
|
|
19
|
|
20 my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified");
|
|
21
|
|
22 my $method = pop @target;
|
|
23 $method =~ s/\.\w+$//;
|
|
24
|
|
25 my $module = join '::',$namespace,@target;
|
|
26
|
|
27 eval "require $module; 1;";
|
|
28 carp $@ if $@;
|
|
29
|
|
30 if(UNIVERSAL::can($module,'InvokeAction')) {
|
|
31 $module->InvokeAction($method,$action);
|
|
32 } else {
|
|
33 die new IMPL::InvalidOperationException("Failed to invoke action",$ENV{PATH_INFO},$module,$method);
|
|
34 }
|
|
35 }
|
|
36
|
|
37 1; |