Response
Response
This improved Response API, able to simplify the Framework's Response management. Practically, is now possible to do in a Controller Method:
// Create a Response instance with string content
return Response::make(json_encode($user));
// Create a Response instance with a given status
return Response::make('Not Found', 404);
// Create a Response with some custom headers
return Response::make(json_encode($user), 200, array('header' => 'value'));
// Create a response instance with JSON
return Response::json($data, 200, array('header' => 'value'));
// Create a 404 response with data (will be directly obtained a shiny themed Error Page)
return Response::error('404', array('message' => 'Not Found'));
It is also possible to use those Response instance in the Route Filters, case when the given Response will be sent to the browser and the further processing will be skipped.
To note that Response class was moved to Core considering as being now a vital part of Framework, for its properly work, and not an (optional) Helper.
The new Response API permit further simplifications on Routing. For example, the command Response::error()is quite capable to display a themed/templated Error Page, without the help of an additional "Error Controller" or other "callbacks".
Response的更多相关文章
- Response.Redirect引起的性能问题分析
现象: 最近做的一个系统通过单点登录(SSO) 技术验证用户登录.用户在SSO 系统上通过验证后,跳转到该系统的不同模块.而跳转的时间一直维持子啊几分钟左右. 分析步骤: 在问题复现时抓取Hang d ...
- windows charles response 乱码解决办法
使用windows 版本的charles来做代理,发现服务端返回的response会出现中文乱码的情况, 查看软件设置,遗憾的是并没有关于编码的选项. 好在charles windows版本安装目录下 ...
- 谈一谈Http Request 与 Http Response
写在前面的话:今天来总结一下http相关的request和response,就从以下几个问题入手吧. ======正文开始======== 1.什么是HTTP Request 与HTTP Respon ...
- ashx中Response.ContentType的常用类型
ashx中Response.ContentType的常用类型: text/plaintext/htmltext/xmlapplication/jsonimage/GIFapplication/x-cd ...
- 一个由Response.Redirect 引起的性能问题的分析
现象: 某系统通过单点登录(SSO) 技术验证用户登录.用户在SSO 系统上通过验证后,跳转到某系统的主页上面.而跳转的时间很长,约1分钟以上. 分析步骤: 在问题复现时抓取Hang dump 进行分 ...
- request 对象和 response 对象
Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象 HttpServletResponse HttpServletR ...
- C#、JAVA操作Hadoop(HDFS、Map/Reduce)真实过程概述。组件、源码下载。无法解决:Response status code does not indicate success: 500。
一.Hadoop环境配置概述 三台虚拟机,操作系统为:Ubuntu 16.04. Hadoop版本:2.7.2 NameNode:192.168.72.132 DataNode:192.168.72. ...
- response和request的区别以及常见问题解决
request是请求,即客服端发来的请求 response是响应,是服务器做出的响应 --------------------------------------------------------- ...
- Webform(五)——内置对象(Response、Request)和Repeater中的数据增删改
一.内置对象 (一)Response对象 1.简介:response 对象在ASP中负责将信息传递给用户.Response对象用于动态响应客户端请求,并将动态生成的响应结果返回到客户端浏览器中,使用R ...
- Hemodynamic response function (HRF) - FAQ
Source: MIT - Mindhive What is the 'canonical' HRF? The very simplest design matrix for a given expe ...
随机推荐
- java jvm学习笔记十(策略和保护域)
欢迎转载请说明出处:http://blog.csdn.net/yfqnihao/article/details/8271415 前面一节,我们做了一个简单的实验,来说明什么是策略文件,在文章的最后,也 ...
- 55人班37人进清华北大的金牌教师之32条教育建言! z
他带的一个55人的班,37人考进清华.北大,10人进入剑桥大学.耶鲁大学.牛津大学等世界名校并获全额奖学金,其他考入复旦.南开等大学.不仅 如此,校足球冠军.校运动会总冠军.校网页设计大赛总冠军等6项 ...
- docker专题(2):docker常用管理命令(上)
http://segmentfault.com/a/1190000000751601 本文只记录docker命令在大部分情境下的使用,如果想了解每一个选项的细节,请参考官方文档,这里只作为自己以后的备 ...
- 刷票 变 IP
刷票 变 IP
- C++&OpenCV中读取灰度图像到数组的两种
如标题所言,此处是对于灰度图像而言 ///method 1 read the image data one by one for (int row = 0, i = 0;row < imgDst ...
- HW6.3
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW5.30
public class Solution { public static void main(String[] args) { for(int i = 3; i <= 1000; i++) i ...
- leetcode@ [72/115] Edit Distance & Distinct Subsequences (Dynamic Programming)
https://leetcode.com/problems/edit-distance/ Given two words word1 and word2, find the minimum numbe ...
- setResult()设置无效,onActivityResult没有被调用
情况1 呃,被坑了几个小时,后来发现,在调用setResult的时候,requestCode随便传了个Activity的RESULT_OK,而这个常量的值是-1,导致onActivityResult没 ...
- 集合框架-Map练习-记录字母出现的次数
/* * 练习: * 字符串"abcb453 sddbs343bsjvAJBBDVBs21768723",获取该字符串中,每一个字母出现的次数. * 要求打印结果是:a(2)b ...