68811625b4d3c76b4227d315a44e95fb8556da48
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / MVC / Web / AbstractRequestHandler.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * A request handler which can handle web requests.
30 *
31 */
32 abstract class Tx_Extbase_MVC_Web_AbstractRequestHandler implements Tx_Extbase_MVC_RequestHandlerInterface {
33
34 /**
35 * @var Tx_Extbase_Object_ObjectManagerInterface
36 */
37 protected $objectManager;
38
39 /**
40 * Back reference to the parent content object
41 * This has to be public as it is set directly from TYPO3
42 *
43 * @var tslib_cObj
44 */
45 protected $cObj;
46
47 /**
48 * @var Tx_Extbase_MVC_Dispatcher
49 */
50 protected $dispatcher;
51
52 /**
53 * @var Tx_Extbase_MVC_Web_RequestBuilder
54 */
55 protected $requestBuilder;
56
57 /**
58 * @var Tx_Extbase_MVC_Controller_FlashMessages
59 */
60 protected $flashMessages;
61
62 /**
63 * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
64 * @return void
65 */
66 public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
67 $this->objectManager = $objectManager;
68 }
69
70 /**
71 * @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
72 * @return void
73 */
74 public function injectFlashMessages(Tx_Extbase_MVC_Controller_FlashMessages $flashMessages) {
75 $this->flashMessages = $flashMessages;
76 }
77
78 /**
79 * @param Tx_Extbase_MVC_Dispatcher $dispatcher
80 * @return void
81 */
82 public function injectDispatcher(Tx_Extbase_MVC_Dispatcher $dispatcher) {
83 $this->dispatcher = $dispatcher;
84 }
85
86 /**
87 * @param Tx_Extbase_MVC_Web_RequestBuilder $requestBuilder
88 * @return void
89 */
90 public function injectRequestBuilder(Tx_Extbase_MVC_Web_RequestBuilder $requestBuilder) {
91 $this->requestBuilder = $requestBuilder;
92 }
93
94 /**
95 * Sets the content object
96 *
97 * @param tslib_cObj $cObj
98 * @return void
99 */
100 public function setContentObject(tslib_cObj $cObj = NULL) {
101 $this->cObj = $cObj;
102 }
103
104 /**
105 * This request handler can handle any web request.
106 *
107 * @return boolean If the request is a web request, TRUE otherwise FALSE
108 */
109 public function canHandleRequest() {
110 return TRUE;
111 }
112
113 /**
114 * Returns the priority - how eager the handler is to actually handle the
115 * request.
116 *
117 * @return integer The priority of the request handler.
118 */
119 public function getPriority() {
120 return 100;
121 }
122
123 }
124 ?>