incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1021690 - /sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java
Date Tue, 12 Oct 2010 09:05:40 GMT
Author: fmeschbe
Date: Tue Oct 12 09:05:40 2010
New Revision: 1021690

URL: http://svn.apache.org/viewvc?rev=1021690&view=rev
Log:
SLING-1841 Send cache control headers to prevent caching the result
and set content type to prevent Firefox from trying to parse the result
if requesting with an XHR request

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java?rev=1021690&r1=1021689&r2=1021690&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java
(original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationHandler.java
Tue Oct 12 09:05:40 2010
@@ -284,6 +284,19 @@ public abstract class AbstractAuthentica
     public static void sendValid(final HttpServletResponse response) {
         try {
             response.setStatus(HttpServletResponse.SC_OK);
+
+            // expressely tell we have no content but set content type
+            // to prevent firefox from trying to parse the response
+            // (SLING-1841)
+            response.setContentType("text/plain");
+            response.setContentLength(0);
+
+            // prevent the client from aggressively caching the response
+            // (SLING-1841)
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.addHeader("Cache-Control", "no-store");
+
             response.flushBuffer();
         } catch (IOException ioe) {
             // TODO: log.error("Failed to send 200/OK response", ioe);



Mime
View raw message