annotate Lib/IMPL/Web/QueryHandler/PageFormat.pm @ 89:3d1f584aea60

small fix in the activator and secure cookie
author wizard
date Wed, 21 Apr 2010 17:39:45 +0400
parents 9d24db321029
children 964587c5183c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
1 package IMPL::Web::QueryHandler::PageFormat;
64
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
2 use base qw(IMPL::Web::QueryHandler IMPL::Object::Autofill);
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
3
c64bd1bf727d Web application
wizard
parents:
diff changeset
4 __PACKAGE__->PassThroughArgs;
c64bd1bf727d Web application
wizard
parents:
diff changeset
5
c64bd1bf727d Web application
wizard
parents:
diff changeset
6 use IMPL::Class::Property;
77
9d24db321029 Refactoring Web::TT
wizard
parents: 65
diff changeset
7 use IMPL::Web::TT::Document;
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
8 use File::Spec;
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
9 use Error qw(:try);
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
10
64
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
11 BEGIN {
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
12 public property templatesCharset => prop_all;
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
13 public property templatesBase => prop_all;
64
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
14 }
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
15
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
16 sub CTOR {
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
17 my ($this) = @_;
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
18
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
19 $this->templatesCharset('utf-8') unless $this->templatesCharset;
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
20 $this->templatesBase('.') unless $this->templatesBase;
64
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
21 }
259cd3df6e53 Doc generation
wizard
parents: 63
diff changeset
22
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
23 sub Process {
c64bd1bf727d Web application
wizard
parents:
diff changeset
24 my ($this,$action,$nextHandler) = @_;
c64bd1bf727d Web application
wizard
parents:
diff changeset
25
77
9d24db321029 Refactoring Web::TT
wizard
parents: 65
diff changeset
26 my $doc = new IMPL::Web::TT::Document();
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
27
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
28 try {
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
29 my @path = split /\//, $ENV{PATH_TRANSLATED};
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
30
77
9d24db321029 Refactoring Web::TT
wizard
parents: 65
diff changeset
31 $doc->LoadFile ( File::Spec->catfile($this->templatesBase,@path), $this->templatesCharset );
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
32
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
33 $action->response->contentType('text/html');
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
34 my $hOut = $action->response->streamBody;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
35
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
36 print $hOut $doc->Render();
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
37 } finally {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
38 $doc->Dispose;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
39 };
62
c64bd1bf727d Web application
wizard
parents:
diff changeset
40 }
c64bd1bf727d Web application
wizard
parents:
diff changeset
41
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
42 1;
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
43
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
44 __END__
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
45
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
46 =pod
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
47
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
48 =head1 NAME
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
49
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
50 C<IMPL::Web::QueryHandler::PageFormat> - Выдача результатов в виде HTML страницы, построенной из шаблона.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
51
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
52 =head1 SYNOPSIS
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
53
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
54 В файле конфигурации приложения
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
55
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
56 =begin code xml
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
57
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
58 <handlersQuery type="IMPL::Object::List">
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
59 <item type="IMPL::Web::QueryHandler::PageFormat">
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
60 <charsetTemplates>utf-8</charsetTemplates>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
61 </item>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
62 </handlersQuery>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
63
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
64 =end code xml
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
65
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
66 Программно
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
67
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
68 =begin code
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
69
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
70 my $app = new IMPL::Web::Application();
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
71 $app->handlersQuery->Add(
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
72 new IMPL::Web::QueryHandler::PageFormat( charsetTemplates=> 'utf-8' );
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
73 );
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
74
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
75 =end
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
76
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
77 =head1 DESCRIPTION
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
78
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
79 Обработчик запроса для веб приложения. Загружает шаблон, путь к котрому берется
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
80 из C<ENV{PATH_INFO}> относительно пути из свойства C<templatesBase>.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
81
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
82 Наследуется от C<IMPL::Web::QueryHandler> для реализации функционала
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
83 обработчика запроса и переопределяет метод C<Process>.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
84
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
85 C<Serializable>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
86
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
87 =head1 MEMBERS
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
88
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
89 =over
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
90
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
91 =item C<CTOR(%props)>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
92
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
93 Создает новый экземпляр и заполняет свойства.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
94
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
95 =item C<[get,set] templatesCharset>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
96
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
97 Кодировка шаблонов. По умолчанию utf-8.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
98
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
99 =item C<[get,set] templatesBase>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
100
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
101 Каталог относительно которого ищется шаблон.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
102
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
103 =item C<[override] Process($action,$nextHandler)>
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
104
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
105 Метод, переопределяющий C<IMPL::Web::QueryHandler->Process> и которому передается управление
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
106 для выполнения действий.
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
107
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
108 =back
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
109
2840c4c85db8 Application configuration improvements
wizard
parents: 64
diff changeset
110 =cut