Revision b8388d68
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/Dispatcher.pm | ||
---|---|---|
23 | 23 |
use Encode; |
24 | 24 |
use English qw(-no_match_vars); |
25 | 25 |
use File::Basename; |
26 |
use List::MoreUtils qw(all); |
|
26 |
use List::MoreUtils qw(apply all);
|
|
27 | 27 |
use List::Util qw(first); |
28 | 28 |
use SL::ArchiveZipFixes; |
29 | 29 |
use SL::Auth; |
... | ... | |
240 | 240 |
$::lxdebug->log_request($routing_type, $script_name, $action); |
241 | 241 |
|
242 | 242 |
$::request->type(lc($routing{request_type} || 'html')); |
243 |
$::request->routing_type($routing{type}); |
|
244 |
$::request->controller(apply { s{.*/|\.pl$}{}g } $routing{controller}); |
|
243 | 245 |
|
244 | 246 |
if ($routing_type eq 'old') { |
245 | 247 |
$::form->{action} = lc $::form->{action}; |
... | ... | |
250 | 252 |
|
251 | 253 |
$::form->{script} = $script . $suffix; |
252 | 254 |
|
255 |
my $actual_action = $::locale->findsub($routing{action}); |
|
256 |
$actual_action = apply { s{^action_}{} } first { m{^action_} && $::form->{$_} } keys %{ $::form } if $actual_action eq 'dispatcher'; |
|
257 |
|
|
258 |
$::request->action($actual_action); |
|
259 |
|
|
253 | 260 |
} else { |
254 | 261 |
_require_controller($script_name); |
255 | 262 |
$::form->{script} = "controller.pl"; |
263 |
$::request->action($routing{action}); |
|
256 | 264 |
} |
257 | 265 |
|
258 | 266 |
eval { |
... | ... | |
324 | 332 |
$self->{request}->Finish; |
325 | 333 |
} |
326 | 334 |
|
327 |
$::lxdebug->end_request(routing_type => $routing_type, script_name => $script_name, action => $action);
|
|
335 |
$::lxdebug->end_request; |
|
328 | 336 |
|
329 | 337 |
# cleanup |
330 | 338 |
$::auth->save_session; |
SL/LXDebug.pm | ||
---|---|---|
296 | 296 |
} |
297 | 297 |
|
298 | 298 |
sub end_request { |
299 |
my ($self, %params) = @_;
|
|
299 |
my ($self) = @_; |
|
300 | 300 |
return 1 unless want_request_timer(); |
301 | 301 |
|
302 |
$self->_write("time", sprintf('%f (%s/%s)', $self->get_request_time, $params{script_name}, $params{action}));
|
|
302 |
$self->_write("time", $::request ? sprintf('%f (%s/%s)', $self->get_request_time, $::request->controller, $::request->action) : sprintf('%f', $self->get_request_time));
|
|
303 | 303 |
|
304 | 304 |
$self->{calldepth} = 0; |
305 | 305 |
} |
SL/Request.pm | ||
---|---|---|
18 | 18 |
|
19 | 19 |
use Rose::Object::MakeMethods::Generic |
20 | 20 |
( |
21 |
scalar => [ qw(applying_database_upgrades) ], |
|
21 |
scalar => [ qw(applying_database_upgrades routing_type controller action) ],
|
|
22 | 22 |
'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax type) ], |
23 | 23 |
); |
24 | 24 |
|
... | ... | |
538 | 538 |
|
539 | 539 |
Returns the requested content type (either C<html>, C<js> or C<json>). |
540 | 540 |
|
541 |
=item C<controller> |
|
542 |
|
|
543 |
Returns the name of the current controller. This is either the base |
|
544 |
name of a script in C<bin/mozilla> (e.g. C<oe>; for the old routing |
|
545 |
type) or the base name of one of the packages in C<SL/Controller> |
|
546 |
(e.g. C<BackgroundJob>; for the new controller routing type). |
|
547 |
|
|
548 |
=item C<action> |
|
549 |
|
|
550 |
Returns the name of the current action. |
|
551 |
|
|
552 |
=item C<routing_type> |
|
553 |
|
|
554 |
Returns the routing type. This depends on the requested controller. It |
|
555 |
can be either C<old> for one of the scripts in C<bin/mozilla> or |
|
556 |
C<controller> for one of the new controllers in C<SL/Controller>. |
|
557 |
|
|
541 | 558 |
=item C<layout> |
542 | 559 |
|
543 | 560 |
Set and retrieve the layout object for the current request. Must be an instance |
Auch abrufbar als: Unified diff
Dispatcher: aktuellen Controller, Action, Routing-Typ in Request-Objekt speichern