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 ...
随机推荐
- 【转】Android中的颜色设置
原文网址:http://www.cnblogs.com/bluestorm/p/3644669.html 1.在android中经常看到设置的颜色为八位的十六进制的颜色值,例如: 1 2 3 publ ...
- Android中Toast的用法简介
转自:http://www.cnblogs.com/GnagWang/archive/2010/11/26/1888762.html Toast是Android中用来显示显示信息的一种机制,和Dial ...
- Path类型的扩展方法 z
写了一个基于System.IO.Path类型方法的扩展类型,用于快速对文件系统路径进行操作.如下图: 其中有许多方法就是直接调用Path类型的静态方法.比如AppendPath方法内部会直接调用Pat ...
- 2、Android应用程序基本特性
1. apk是android应用程序安装格式,.dex是Android二进制执行文件格式. 2.Android操作系统是基于Linux的多用户操作系统,每一个应用程序都是使用的不同的用户. 3. 默认 ...
- Velocity是如何工作的
当在一个应用程序或者servlet中使用Velocity的时候,你要做如下几个工作: 初始化Velocity.Velocity提供2种使用形式,不管是单一实例模式还是单独运行实例模式,初始化过程都只做 ...
- Nitrous挂VPN
- 浅谈reverse_iterator的base()函数
非原创,原文链接:http://blog.csdn.net/shuchao/article/details/3705252 调用reverse_iterator的base成员函数可以产生"对 ...
- 你真的知道HTML吗?
经过几次面试当中,被问及到最基础的东西,没想到回答不上来,有点蛋痛,今天特地的复习了一下!! 内容: 1.Doctype(文档类型)的作用是什么?有多少文档类型? 2.浏览器标准模式和怪异模式之间的区 ...
- sqlserver 出现 因为文件组 'PRIMARY' 已满 的解决办法 有可能是磁盘剩余空间不足 导致的
一般虚拟主机提供商是通过限制数据库文件的大小来实现提供定制的数据库空间的.当你把从虚拟数据库空间备份下来的文件恢复到自己的服务器上时,这个限制还是存在的.找到数据库文件 给增加个数据文件就好了 解决办 ...
- Hadoop MapReduce概念学习系列之JobTracker、ResourceManager、Task Tracker、NodeManager(二十一)
Tracker是跟踪者,跟踪器.JobTracker是项目经理.在hadoop2*的0.23版本之后,改叫RM了.ResourceManager.TaskTracker是小组长.它手下,还有具体搬砖的 ...