Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
229
Merge Requests
229
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
da00dcc3
Commit
da00dcc3
authored
Mar 31, 2012
by
Crell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to the new JsonResponse object from Symfony.
parent
edcc5bd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
core/lib/Drupal/Core/ExceptionController.php
core/lib/Drupal/Core/ExceptionController.php
+5
-11
No files found.
core/lib/Drupal/Core/ExceptionController.php
View file @
da00dcc3
...
...
@@ -10,6 +10,7 @@
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpKernel\HttpKernelInterface
;
use
Symfony\Component\EventDispatcher\EventDispatcher
;
...
...
@@ -41,7 +42,7 @@ class ExceptionController {
/**
* Constructor
*
*
* @param HttpKernelInterface $kernel
* The kernel that spawned this controller, so that it can be reused
* for subrequests.
...
...
@@ -169,13 +170,6 @@ public function on404Html(FlattenException $exception, Request $request) {
return
$response
;
}
protected
function
createJsonResponse
()
{
$response
=
new
Response
();
$response
->
headers
->
set
(
'Content-Type'
,
'application/json; charset=utf-8'
);
return
$response
;
}
/**
* Processes an AccessDenied exception into an HTTP 403 response.
*
...
...
@@ -183,7 +177,7 @@ protected function createJsonResponse() {
* The Event to process.
*/
public
function
on403Json
(
FlattenException
$exception
,
Request
$request
)
{
$response
=
$this
->
create
JsonResponse
();
$response
=
new
JsonResponse
();
$response
->
setStatusCode
(
403
,
'Access Denied'
);
return
$response
;
}
...
...
@@ -195,7 +189,7 @@ public function on403Json(FlattenException $exception, Request $request) {
* The Event to process.
*/
public
function
on404Json
(
FlattenException
$exception
,
Request
$request
)
{
$response
=
$this
->
create
JsonResponse
();
$response
=
new
JsonResponse
();
$response
->
setStatusCode
(
404
,
'Not Found'
);
return
$response
;
}
...
...
@@ -207,7 +201,7 @@ public function on404Json(FlattenException $exception, Request $request) {
* The Event to process.
*/
public
function
on405Json
(
FlattenException
$exception
,
Request
$request
)
{
$response
=
$this
->
create
JsonResponse
();
$response
=
new
JsonResponse
();
$response
->
setStatusCode
(
405
,
'Method Not Allowed'
);
return
$response
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment