view Lib/IMPL/Web/QueryHandler/SecureCall.pm @ 104:196bf443b5e1

DOM::Schema RC0 inflators support, validation and some other things, Minor and major fixes almost for everything. A 'Source' property of the ValidationErrors generated from a NodeSet or a NodeList is subject to change in the future.
author wizard
date Tue, 11 May 2010 02:42:59 +0400
parents 964587c5183c
children
line wrap: on
line source

package IMPL::Web::QueryHandler::SecureCall;
use strict;
use base qw(IMPL::Web::QueryHandler);

use IMPL::Class::Property;
use IMPL::Exception;
use Carp;

BEGIN {
	public property namespace => prop_all;
}

__PACKAGE__->PassThroughArgs;

sub Process {
	my ($this,$action,$nextHandler) = @_;
	
	my $namespace = $this->namespace || $action->application->type;
	
	my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified");
	
	my $method = pop @target;
	$method =~ s/\.\w+$//;
	
	my $module = join '::',$namespace,@target;
	
	eval "require $module; 1;";
	carp $@ if $@;
	
	if(UNIVERSAL::can($module,'InvokeAction')) {
		$module->InvokeAction($method,$action);
	} else {
		die new IMPL::InvalidOperationException("Failed to invoke action",$ENV{PATH_INFO},$module,$method);
	}
}

1;