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的更多相关文章

  1. Response.Redirect引起的性能问题分析

    现象: 最近做的一个系统通过单点登录(SSO) 技术验证用户登录.用户在SSO 系统上通过验证后,跳转到该系统的不同模块.而跳转的时间一直维持子啊几分钟左右. 分析步骤: 在问题复现时抓取Hang d ...

  2. windows charles response 乱码解决办法

    使用windows 版本的charles来做代理,发现服务端返回的response会出现中文乱码的情况, 查看软件设置,遗憾的是并没有关于编码的选项. 好在charles windows版本安装目录下 ...

  3. 谈一谈Http Request 与 Http Response

    写在前面的话:今天来总结一下http相关的request和response,就从以下几个问题入手吧. ======正文开始======== 1.什么是HTTP Request 与HTTP Respon ...

  4. ashx中Response.ContentType的常用类型

    ashx中Response.ContentType的常用类型: text/plaintext/htmltext/xmlapplication/jsonimage/GIFapplication/x-cd ...

  5. 一个由Response.Redirect 引起的性能问题的分析

    现象: 某系统通过单点登录(SSO) 技术验证用户登录.用户在SSO 系统上通过验证后,跳转到某系统的主页上面.而跳转的时间很长,约1分钟以上. 分析步骤: 在问题复现时抓取Hang dump 进行分 ...

  6. request 对象和 response 对象

    Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象 HttpServletResponse HttpServletR ...

  7. 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. ...

  8. response和request的区别以及常见问题解决

    request是请求,即客服端发来的请求 response是响应,是服务器做出的响应 --------------------------------------------------------- ...

  9. Webform(五)——内置对象(Response、Request)和Repeater中的数据增删改

    一.内置对象 (一)Response对象 1.简介:response 对象在ASP中负责将信息传递给用户.Response对象用于动态响应客户端请求,并将动态生成的响应结果返回到客户端浏览器中,使用R ...

  10. Hemodynamic response function (HRF) - FAQ

    Source: MIT - Mindhive What is the 'canonical' HRF? The very simplest design matrix for a given expe ...

随机推荐

  1. 29、activity横竖屏切换细节问题

    1 import android.app.Activity; import android.content.Intent; import android.os.Bundle; import andro ...

  2. 面向对象基础3(class0523)

    怎么实现多态2-接口 接口是定义一种能力,规定子类能干什么和抽象类有些相似,解决类的单根继承.接口可以实现多继承 案例 鸟-麻雀sparrow,鸵鸟ostrich,企鹅penguin,鹦鹉parrot ...

  3. bzoj 2588 Spoj 10628. Count on a tree(主席树)

    Description 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始 ...

  4. 系统虚拟化学习笔记——PCI设备

    内容摘自<系统虚拟化:原理与实现> PCI 总线架构 PCI总线是典型的树结构.把北桥中host-PCI桥看做根,总线中其他PCI-PCI桥,PCI-ISA桥(ISA总线转PCI总线桥)等 ...

  5. 浏览器中显示视频,flash等的代码处理

    window.flashView=function(flash_url){ var html=''; html+='<div id="obj_flash_div">'; ...

  6. Java实现在访问者模式中使用反射

    集合类型在面向对象编程中很常用,这也带来一些代码相关的问题.比如,“怎么操作集合中不同类型的对象?” 一种做法就是遍历集合中的每个元素,然后根据它的类型而做具体的操作.这会很复杂,尤其当你不知道集合中 ...

  7. Android实例-如何将文件打包到安装文件(XE8+小米2)

    结果: 1.文件名支持英文字母.数字,不支持中文,大小写敏感. 2.文件最好放在根目录下,或是子目录下,如果放在根目外,根目录改名后,找不到文件. 3.打开Project->Deployment ...

  8. 转载ASP.NET 状态管理Application,Session,Cookie和ViewState用法

    转载原地址 http://www.cnblogs.com/cuishao1985/archive/2009/09/24/1573403.html ASP.NET状态管理 APPlication,Ses ...

  9. 楔子(xiē zǐ)

    戏曲.小说的引子.一般放在篇首,用以点明.补充正文,或者说引出正文或是为正文做铺垫.指旧小说的引子,通常放在小说故事开始之前,起引出或补充正文的作用.这不过是个楔子,下面还有正文.——<儒林外史 ...

  10. android widget的中文文档

    下文是我翻译于 App Widgets的文章,如果有不当之处请大家指出 app widget是一种嵌入在其他应用(例如主屏幕)和并且能偶接受间接性更新的小应用,你可以自己提供app widget pr ...