Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3833d62f
Commit
3833d62f
authored
Jun 07, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Response WIP
parent
6c7672c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
94 deletions
+4
-94
Response.php
framework/yii/web/Response.php
+4
-94
No files found.
framework/yii/web/Response.php
View file @
3833d62f
...
...
@@ -158,105 +158,15 @@ class Response extends \yii\base\Response
return
$this
->
_headers
;
}
/**
* Returns the current cache control setting as a string like sent in a header.
* @return string the cache control setting, or null if there is no such header specified
*/
public
function
getCacheControl
()
{
return
$this
->
getHeaders
()
->
get
(
'Cache-Control'
);
}
/**
* Sets the current cache control setting to be sent
* @param string $value the cache control header value
*/
public
function
setCacheControl
(
$value
)
{
$this
->
getHeaders
()
->
set
(
'Cache-Control'
,
$value
);
}
/**
* Gets the ETag header to be sent
* @return string the ETag header, or false if none is set
*/
public
function
getEtag
()
{
return
$this
->
getHeaders
()
->
get
(
'ETag'
);
}
/**
* Sets the ETag header to be sent
* @param string $value the ETag header
*/
public
function
setEtag
(
$value
)
{
$this
->
getHeaders
()
->
set
(
'ETag'
,
$value
);
}
/**
* Gets the last modified header to send
* @return string the last modified header, or null if none is set
*/
public
function
getLastModified
()
{
return
$this
->
getHeaders
()
->
get
(
'Last-Modified'
);
}
/**
* Sets the last modified header to send
* @param integer $value the unix time of the last modified date
*/
public
function
setLastModified
(
$value
)
{
$this
->
getHeaders
()
->
set
(
'Last-Modified'
,
$value
);
}
/**
* Gets the content type header to send
* @return string the content type header, or null if none is set
*/
public
function
getContentType
()
{
return
$this
->
getHeaders
()
->
get
(
'Content-type'
);
}
/**
* Sets the content type header to send
* @param string $value the content type header
*/
public
function
setContentType
(
$value
)
{
$this
->
getHeaders
()
->
set
(
'Content-type'
,
$value
);
}
/**
* Gets the content disposition header to send
* @return string the content disposition, or null if none is set
*/
public
function
getContentDisposition
()
{
return
$this
->
getHeaders
()
->
get
(
'Content-Disposition'
);
}
/**
* Sets the content disposition header to send
* @param string $value the content disposition header
*/
public
function
setContentDisposition
(
$value
)
{
$this
->
getHeaders
()
->
set
(
'Content-Disposition'
,
$value
);
}
public
function
renderJson
(
$data
)
{
$this
->
setContentType
(
'application/json'
);
$this
->
getHeaders
()
->
set
(
'content-type'
,
'application/json'
);
$this
->
content
=
Json
::
encode
(
$data
);
}
public
function
renderJsonp
(
$
callbackName
,
$data
)
public
function
renderJsonp
(
$
data
,
$callbackName
)
{
$this
->
setContentType
(
'text/javascript'
);
$this
->
getHeaders
()
->
set
(
'content-type'
,
'text/javascript'
);
$data
=
Json
::
encode
(
$data
);
$this
->
content
=
"
$callbackName
(
$data
);"
;
}
...
...
@@ -452,7 +362,7 @@ class Response extends \yii\base\Response
}
if
(
!
isset
(
$options
[
'mimeType'
]))
{
if
((
$options
[
'mimeType'
]
=
C
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
if
((
$options
[
'mimeType'
]
=
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
$options
[
'mimeType'
]
=
'text/plain'
;
}
}
...
...
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