[ 
https://issues.apache.org/jira/browse/SLING-6046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15803983#comment-15803983
 ] 

Felix Meschberger commented on SLING-6046:
------------------------------------------

Proposing following patch with a threshold size of 100KB which I think is 
reasonable to fully download.

We can also change this threshold but there is not point in making it 
configurable, at least not for now, I think.

{code}
### Eclipse Workspace Patch 1.0
#P org.apache.sling.servlets.get
Index: 
src/main/java/org/apache/sling/servlets/get/impl/helpers/StreamRendererServlet.java
===================================================================
--- 
src/main/java/org/apache/sling/servlets/get/impl/helpers/StreamRendererServlet.java
 (Revision 1777535)
+++ 
src/main/java/org/apache/sling/servlets/get/impl/helpers/StreamRendererServlet.java
 (Arbeitskopie)
@@ -73,6 +73,17 @@
      */
     private static final String mimeSeparation = "SLING_MIME_BOUNDARY";
 
+    // size threshold for sending an Accept-Ranges header back in the response 
(100KB)
+    private static final int ACCEPT_RANGES_THRESHOLD = 100 * 1024 * 1024;
+
+    // Accept-Ranges header name
+    private static final String ACCEPT_RANGES_HEADER = "Accept-Ranges";
+
+    // Accept-Ranges header value
+    private static final String ACCEPT_RANGES_BYTES = "bytes";
+
+
+
     /**
      * Full range marker.
      */
@@ -393,6 +404,11 @@
         if (encoding != null) {
             response.setCharacterEncoding(encoding);
         }
+
+        // announce support for ranges if we know the size to be larger than 
100KB
+        if (meta.getContentLength() > ACCEPT_RANGES_THRESHOLD) {
+            response.setHeader(ACCEPT_RANGES_HEADER, ACCEPT_RANGES_BYTES);
+        }
     }
 
     /**
{code}

> While Streaming Video to IE 11, StreamRendererServlet do not use Partial 
> Content Response [code 206]
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SLING-6046
>                 URL: https://issues.apache.org/jira/browse/SLING-6046
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Get 2.1.18
>            Reporter: Ashok Kumar
>             Fix For: Servlets Get 2.1.20
>
>         Attachments: Accept-Range Respone Header from S3.png, 
> NetworkDataS3VideoFromIE11.xml, S3video.html, StreamRendererServlet.java.patch
>
>
> Since IE 11 expects "Accept-Ranges" [0] response header to start making 
> requests with Range header, so sling lack in streaming of video content for 
> IE end users. We can add Accept-Ranges = bytes header to response , either 
> selectively only for video/mp4 mimetype ( video tag on IE looks for mp4 )  or 
> always.
> Without support of partial content response (206) for IE users, all large 
> video files are being downloaded in single chunk and user need to wait for 
> long to see video content playing. 
> [0] http://stackoverflow.com/questions/25654422/http-pseudo-streaming-in-ie11 
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to