diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index b54b23a34e633335c2ba9c4382dc281c511ae511..6628c4514d9c5d473c4840d6b01a52470a363f48 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -66,9 +66,12 @@ class JSONResponse extends Response {
 	 * Sets values in the data json array
 	 * @param array|object $data an array or object which will be transformed
 	 *                             to JSON
+	 * @return JSONResponse Reference to this object
 	 */
 	public function setData($data){
 		$this->data = $data;
+
+		return $this;
 	}
 
 
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index d223621d4fdf3d127c606b252131f09f8fda0a5c..45402d9b3b3290e860dea4166d8e1257f53687e1 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -80,6 +80,7 @@ class Response {
 			$this->addHeader('Cache-Control', 'no-cache, must-revalidate');
 		}
 
+		return $this;
 	}
 
 
@@ -88,6 +89,7 @@ class Response {
 	 * function
 	 * @param string $name The name of the HTTP header
 	 * @param string $value The value, null will delete it
+	 * @return Response Reference to this object
 	 */
 	public function addHeader($name, $value) {
 		if(is_null($value)) {
@@ -95,6 +97,8 @@ class Response {
 		} else {
 			$this->headers[$name] = $value;
 		}
+
+		return $this;
 	}
 
 
@@ -130,9 +134,12 @@ class Response {
 	/**
 	* Set response status
 	* @param int $status a HTTP status code, see also the STATUS constants
+	* @return Response Reference to this object
 	*/
 	public function setStatus($status) {
 		$this->status = $status;
+
+		return $this;
 	}
 
 
@@ -165,18 +172,24 @@ class Response {
 	/**
 	 * Set the ETag
 	 * @param string $ETag
+	 * @return Response Reference to this object
 	 */
 	public function setETag($ETag) {
 		$this->ETag = $ETag;
+
+		return $this;
 	}
 
 
 	/**
 	 * Set "last modified" date
 	 * @param \DateTime $lastModified
+	 * @return Response Reference to this object
 	 */
 	public function setLastModified($lastModified) {
 		$this->lastModified = $lastModified;
+
+		return $this;
 	}
 
 
diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php
index 2200a38beca93d4c60307e1071ca7f5146a39f89..f5baf788ada27d34d454eda3572fcf4ece9d93fa 100644
--- a/lib/public/appframework/http/templateresponse.php
+++ b/lib/public/appframework/http/templateresponse.php
@@ -74,9 +74,12 @@ class TemplateResponse extends Response {
 	 * Sets template parameters
 	 * @param array $params an array with key => value structure which sets template
 	 *                      variables
+	 * @return TemplateResponse Reference to this object
 	 */
 	public function setParams(array $params){
 		$this->params = $params;
+
+		return $this;
 	}
 
 
@@ -104,9 +107,12 @@ class TemplateResponse extends Response {
 	 *                         settings header and footer, user renders the normal
 	 *                         normal page including footer and header and blank
 	 *                         just renders the plain template
+	 * @return TemplateResponse Reference to this object
 	 */
 	public function renderAs($renderAs){
 		$this->renderAs = $renderAs;
+
+		return $this;
 	}
 
 
diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php
index 534c54cbcee726f473c1b55d59162d95b20e01bb..b9b7c7d63823e18b077375d4ef171f9192c05fd6 100644
--- a/tests/lib/appframework/http/JSONResponseTest.php
+++ b/tests/lib/appframework/http/JSONResponseTest.php
@@ -28,6 +28,7 @@ namespace OC\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http;
 
 //require_once(__DIR__ . "/../classloader.php");
 
@@ -95,4 +96,13 @@ class JSONResponseTest extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals($code, $response->getStatus());
 	}
 
+	public function testChainability() {
+		$params = array('hi', 'yo');
+		$this->json->setData($params)
+			->setStatus(Http::STATUS_NOT_FOUND);
+
+		$this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus());
+		$this->assertEquals(array('hi', 'yo'), $this->json->getData());
+	}
+
 }
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 063ab8b5d33bc8e591fb855ec520aca4c1412610..27350725d79a76921e65acf9a5043fce713eca6d 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -117,5 +117,25 @@ class ResponseTest extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
 	}
 
+	public function testChainability() {
+		$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
+		$lastModified->setTimestamp(1);
+
+		$this->childResponse->setEtag('hi')
+			->setStatus(Http::STATUS_NOT_FOUND)
+			->setLastModified($lastModified)
+			->cacheFor(33)
+			->addHeader('hello', 'world');
+
+		$headers = $this->childResponse->getHeaders();
+
+		$this->assertEquals('world', $headers['hello']);
+		$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus());
+		$this->assertEquals('hi', $this->childResponse->getEtag());
+		$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
+		$this->assertEquals('max-age=33, must-revalidate',
+			$headers['Cache-Control']);
+
+	}
 
 }
diff --git a/tests/lib/appframework/http/TemplateResponseTest.php b/tests/lib/appframework/http/TemplateResponseTest.php
index a583d9da14f538797557dc3a9034148e75b713a0..0b158edff6f9392460dbd14ce15c24137abba2b0 100644
--- a/tests/lib/appframework/http/TemplateResponseTest.php
+++ b/tests/lib/appframework/http/TemplateResponseTest.php
@@ -25,6 +25,7 @@
 namespace OC\AppFramework\Http;
 
 use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Http;
 
 
 class TemplateResponseTest extends \PHPUnit_Framework_TestCase {
@@ -98,4 +99,13 @@ class TemplateResponseTest extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals($render, $this->tpl->getRenderAs());
 	}
 
+	public function testChainability() {
+		$params = array('hi' => 'yo');
+		$this->tpl->setParams($params)
+			->setStatus(Http::STATUS_NOT_FOUND);
+
+		$this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus());
+		$this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams());
+	}
+
 }