Hi, response.setHeader() method behaves like put method of Hashtable class. But there can be smart mechanism for some specific HTTP headers. For instance: "Content-Type" makes duplicate record:
Test-Case:
Controller: ---------------------------------------------------------
public static void helloText() { try { response.setHeader("Content-Type", "text/html; charset=utf-8"); response.out.write("<b>hello</b>".getBytes()); } catch (Exception e) { } }
Request: --------------------------------------------------------- GET /Application/helloText HTTP/1.1 Host: localhost:9000 Connection: close
Response: --------------------------------------------------------- HTTP/1.1 200 OK Cache-Control: no-cache Connection: close Content-Length: 12 Content-Type: text/html; charset=utf-8 Content-Type: text/html Date: Mon, 11 Jan 2010 19:36:39 GMT Server: Play! Framework;dev Set-Cookie: PLAY_ERRORS=; Path=/ Set-Cookie: PLAY_FLASH=; Path=/ Set-Cookie: PLAY_SESSION=067234602de391c9b44852504c609fe78bc5ffbe-%00___ID%3A51dbcbef-cbae-4001-a639-e76f1d6e68df%00; Path=/
known malfunction: Apache mod_proxy deletes the second Content-Type header. So we can see the files as plain text.
Hi, setHeader( ) method behaves like put method of Hashtable class.
response.
But there can be smart mechanism for some specific HTTP headers. For instance:
"Content-Type" makes duplicate record:
Test-Case:
Controller: ------- ------- ------- ------- ------- ------- ------- -
-------
public static void helloText() { setHeader( "Content- Type", "text/html; charset=utf-8"); out.write( "<b>hello< /b>".getBytes( ));
try {
response.
response.
} catch (Exception e) {
}
}
Request: ------- ------- ------- ------- ------- ------- ------- - helloText HTTP/1.1
-------
GET /Application/
Host: localhost:9000
Connection: close
Response: ------- ------- ------- ------- ------- ------- ------- - 067234602de391c 9b44852504c609f e78bc5ffbe- %00___ID% 3A51dbcbef- cbae-4001- a639-e76f1d6e68 df%00; Path=/
-------
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: close
Content-Length: 12
Content-Type: text/html; charset=utf-8
Content-Type: text/html
Date: Mon, 11 Jan 2010 19:36:39 GMT
Server: Play! Framework;dev
Set-Cookie: PLAY_ERRORS=; Path=/
Set-Cookie: PLAY_FLASH=; Path=/
Set-Cookie: PLAY_SESSION=
known malfunction:
Apache mod_proxy deletes the second Content-Type header. So we can see the files as plain text.