Make webpage response final
This commit is contained in:
committed by
epriestley
parent
b4473d5998
commit
9c76964aa7
@@ -52,6 +52,7 @@ phutil_register_library_map(array(
|
|||||||
'AphrontFormToggleButtonsControl' => 'view/form/control/AphrontFormToggleButtonsControl.php',
|
'AphrontFormToggleButtonsControl' => 'view/form/control/AphrontFormToggleButtonsControl.php',
|
||||||
'AphrontFormTokenizerControl' => 'view/form/control/AphrontFormTokenizerControl.php',
|
'AphrontFormTokenizerControl' => 'view/form/control/AphrontFormTokenizerControl.php',
|
||||||
'AphrontFormView' => 'view/form/AphrontFormView.php',
|
'AphrontFormView' => 'view/form/AphrontFormView.php',
|
||||||
|
'AphrontHTMLResponse' => 'aphront/response/AphrontHTMLResponse.php',
|
||||||
'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php',
|
'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php',
|
||||||
'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php',
|
'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php',
|
||||||
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
|
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
|
||||||
@@ -1317,8 +1318,8 @@ phutil_register_library_map(array(
|
|||||||
array(
|
array(
|
||||||
'Aphront304Response' => 'AphrontResponse',
|
'Aphront304Response' => 'AphrontResponse',
|
||||||
'Aphront400Response' => 'AphrontResponse',
|
'Aphront400Response' => 'AphrontResponse',
|
||||||
'Aphront403Response' => 'AphrontWebpageResponse',
|
'Aphront403Response' => 'AphrontHTMLResponse',
|
||||||
'Aphront404Response' => 'AphrontWebpageResponse',
|
'Aphront404Response' => 'AphrontHTMLResponse',
|
||||||
'AphrontAjaxResponse' => 'AphrontResponse',
|
'AphrontAjaxResponse' => 'AphrontResponse',
|
||||||
'AphrontAttachedFileView' => 'AphrontView',
|
'AphrontAttachedFileView' => 'AphrontView',
|
||||||
'AphrontCSRFException' => 'AphrontException',
|
'AphrontCSRFException' => 'AphrontException',
|
||||||
@@ -1355,6 +1356,7 @@ phutil_register_library_map(array(
|
|||||||
'AphrontFormToggleButtonsControl' => 'AphrontFormControl',
|
'AphrontFormToggleButtonsControl' => 'AphrontFormControl',
|
||||||
'AphrontFormTokenizerControl' => 'AphrontFormControl',
|
'AphrontFormTokenizerControl' => 'AphrontFormControl',
|
||||||
'AphrontFormView' => 'AphrontView',
|
'AphrontFormView' => 'AphrontView',
|
||||||
|
'AphrontHTMLResponse' => 'AphrontResponse',
|
||||||
'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase',
|
'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase',
|
||||||
'AphrontHeadsupActionListView' => 'AphrontView',
|
'AphrontHeadsupActionListView' => 'AphrontView',
|
||||||
'AphrontHeadsupActionView' => 'AphrontView',
|
'AphrontHeadsupActionView' => 'AphrontView',
|
||||||
@@ -1386,7 +1388,7 @@ phutil_register_library_map(array(
|
|||||||
'AphrontTokenizerTemplateView' => 'AphrontView',
|
'AphrontTokenizerTemplateView' => 'AphrontView',
|
||||||
'AphrontTypeaheadTemplateView' => 'AphrontView',
|
'AphrontTypeaheadTemplateView' => 'AphrontView',
|
||||||
'AphrontUsageException' => 'AphrontException',
|
'AphrontUsageException' => 'AphrontException',
|
||||||
'AphrontWebpageResponse' => 'AphrontResponse',
|
'AphrontWebpageResponse' => 'AphrontHTMLResponse',
|
||||||
'CelerityPhabricatorResourceController' => 'CelerityResourceController',
|
'CelerityPhabricatorResourceController' => 'CelerityResourceController',
|
||||||
'CelerityResourceController' => 'PhabricatorController',
|
'CelerityResourceController' => 'PhabricatorController',
|
||||||
'CelerityResourceGraph' => 'AbstractDirectedGraph',
|
'CelerityResourceGraph' => 'AbstractDirectedGraph',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* @group aphront
|
* @group aphront
|
||||||
*/
|
*/
|
||||||
final class Aphront403Response extends AphrontWebpageResponse {
|
final class Aphront403Response extends AphrontHTMLResponse {
|
||||||
|
|
||||||
private $forbiddenText;
|
private $forbiddenText;
|
||||||
public function setForbiddenText($text) {
|
public function setForbiddenText($text) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* @group aphront
|
* @group aphront
|
||||||
*/
|
*/
|
||||||
final class Aphront404Response extends AphrontWebpageResponse {
|
final class Aphront404Response extends AphrontHTMLResponse {
|
||||||
|
|
||||||
public function getHTTPResponseCode() {
|
public function getHTTPResponseCode() {
|
||||||
return 404;
|
return 404;
|
||||||
|
|||||||
16
src/aphront/response/AphrontHTMLResponse.php
Normal file
16
src/aphront/response/AphrontHTMLResponse.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group aphront
|
||||||
|
*/
|
||||||
|
abstract class AphrontHTMLResponse extends AphrontResponse {
|
||||||
|
|
||||||
|
public function getHeaders() {
|
||||||
|
$headers = array(
|
||||||
|
array('Content-Type', 'text/html; charset=UTF-8'),
|
||||||
|
);
|
||||||
|
$headers = array_merge(parent::getHeaders(), $headers);
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Should be final, but isn't because of Aphront403Response / 404Response.
|
|
||||||
*
|
|
||||||
* @group aphront
|
* @group aphront
|
||||||
*/
|
*/
|
||||||
class AphrontWebpageResponse extends AphrontResponse {
|
final class AphrontWebpageResponse extends AphrontHTMLResponse {
|
||||||
|
|
||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
@@ -18,12 +16,4 @@ class AphrontWebpageResponse extends AphrontResponse {
|
|||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeaders() {
|
|
||||||
$headers = array(
|
|
||||||
array('Content-Type', 'text/html; charset=UTF-8'),
|
|
||||||
);
|
|
||||||
$headers = array_merge(parent::getHeaders(), $headers);
|
|
||||||
return $headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user