You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Collard, David L (Dave)" <da...@alcatel-lucent.com> on 2011/09/21 16:07:27 UTC
CXF Servlet support of HTTP Byte Range
Does/Can CXF servlet support/be configured to support
HTTP Byte Ranges?
>From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
14.35 Range
14.35.1 Byte Ranges
Thanks,
-- Thor
Re: CXF Servlet support of HTTP Byte Range
Posted by Sergey Beryozkin <sb...@gmail.com>.
Sorry, CC-ing to users again,
I've refactored a default BinaryDataProvider:
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
see handleRangeRequest. Will add the rev link to a subsequent JIRA.
I think we can get ranges supported there easily enough, we have a range
value ready to be parsed and then we just copy a range of bytes and set
the response headers if needed...
Can you please consider updating that section with some initial code and
I will then apply a patch ?
Thanks, Sergey
On 27/09/11 22:21, Sergey Beryozkin wrote:
> Or simply return a (ByteArray) InputStream representing a specific
> range. But the complexity of dealing with the ranges would be hidden
> ideally...
> Sergey
> On 27/09/11 22:05, Sergey Beryozkin wrote:
>> Actually, the really simple option to start is to return
>> JAX-RS StreamingOutput from a resource method and have "@Context
>> HttpHeaders headers;" injected or even have a range header passed in as
>> a parameter to this method which will be further passed to
>> StreamingOutputImpl...
>>
>> Cheers, Sergey
>>
>> On 27/09/11 22:02, Sergey Beryozkin wrote:
>>> Hi
>>>
>>> It has to be CXFNonSpringJaxrsServlet:
>>>
>>> http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring
>>>
>>>
>>>
>>>
>>> I'm also modifying a bit the existing input stream provider, will let
>>> you know when it's ready
>>>
>>> Cheers, Sergey
>>>> This page:
>>>>
>>>> http://cxf.apache.org/docs/jax-rs-basics.html
>>>>
>>>> Says:
>>>>
>>>> One can easily register a provider either from Spring configuration or
>>>> programmatically:
>>>>
>>>> And gives a Spring example, but doesn’t show it ‘programmatically’. How
>>>> do I register
>>>>
>>>> the provider if not using spring?
>>>>
>>>> I tried adding this to my web.xml:
>>>>
>>>> <servlet>
>>>>
>>>> <servlet-name>CXFServlet</servlet-name>
>>>>
>>>> <servlet-class>
>>>>
>>>> org.apache.cxf.transport.servlet.CXFServlet
>>>>
>>>> </servlet-class>
>>>>
>>>> *<**init-param**>***
>>>>
>>>> *<**param-name**>**jaxrs.providers**</**param-name**>***
>>>>
>>>> *<**param-value**>**com.alcatel_lucent.lvc.ThorThingyWriter**</**param-value**>***
>>>>
>>>>
>>>>
>>>>
>>>> *</**init-param**>*****
>>>>
>>>> </servlet>
>>>>
>>>> But isWriteable on ThorThingyWriter is still never called.
>>>>
>>>> Thanks
>>>>
>>>> -- DC
>>>>
>>>> -----Original Message-----
>>>>
>>>> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
>>>>
>>>> Sent: Wednesday, September 21, 2011 11:39 AM
>>>>
>>>> To: users@cxf.apache.org
>>>>
>>>> Subject: Re: CXF Servlet support of HTTP Byte Range
>>>>
>>>> That can be easier implemented in a custom MessageBodyWriter which
>>>>
>>>> operates on InputStream. Or may be even in the StreamingOutputImpl.
>>>>
>>>> Perhaps it would make sense to ship such a MessageBodyWriter...
>>>>
>>>> Cheers, Sergey
>>>>
>>>> On 21/09/11 15:43, Collard, David L (Dave) wrote:
>>>>
>>>>> ehcache could be used to cache the complete response, then
>>>>
>>>>> hand out byte ranges as requested. But I think this would
>>>>
>>>>> best be done in the CXF servlet implementation.
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>> -----Original Message-----
>>>>
>>>>> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
>>>>
>>>>> Sent: Wednesday, September 21, 2011 10:39 AM
>>>>
>>>>> To: users@cxf.apache.org
>>>>
>>>>> Subject: Re: CXF Servlet support of HTTP Byte Range
>>>>
>>>>>
>>>>
>>>>> Though I guess the correlation is not actually needed for the concrete
>>>>
>>>>> impls. What about encache or similar, can they do it ?
>>>>
>>>>>
>>>>
>>>>> Cheers, Sergey
>>>>
>>>>> On 21/09/11 15:36, Sergey Beryozkin wrote:
>>>>
>>>>> > Hi
>>>>
>>>>> >
>>>>
>>>>> > On 21/09/11 15:07, Collard, David L (Dave) wrote:
>>>>
>>>>> >> Does/Can CXF servlet support/be configured to support
>>>>
>>>>> >> HTTP Byte Ranges?
>>>>
>>>>> >>
>>>>
>>>>> >> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>>>>
>>>>> >> 14.35 Range
>>>>
>>>>> >> 14.35.1 Byte Ranges
>>>>
>>>>> >>
>>>>
>>>>> >
>>>>
>>>>> > I'm wondering if it is what the actual origin server may/should
>>>>> support,
>>>>
>>>>> > say Tomcat or Apache ?
>>>>
>>>>> >
>>>>
>>>>> > We don't support at the CXF level, I'm not even sure how the
>>>>> correlation
>>>>
>>>>> > between multiple range requests is achieved, using cookies ?
>>>>
>>>>> > Cheers, Sergey
>>>>
>>>>> >
>>>>
>>>>> >>
>>>>
>>>>> >> Thanks,
>>>>
>>>>> >>
>>>>
>>>>> >> -- Thor
>>>>
>>>>> >>
>>>>
>>>>> >
>>>>
>>>>>
>>>>
>>>
>>
>
Re: CXF Servlet support of HTTP Byte Range
Posted by Sergey Beryozkin <sb...@gmail.com>.
That can be easier implemented in a custom MessageBodyWriter which
operates on InputStream. Or may be even in the StreamingOutputImpl.
Perhaps it would make sense to ship such a MessageBodyWriter...
Cheers, Sergey
On 21/09/11 15:43, Collard, David L (Dave) wrote:
> ehcache could be used to cache the complete response, then
> hand out byte ranges as requested. But I think this would
> best be done in the CXF servlet implementation.
>
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Wednesday, September 21, 2011 10:39 AM
> To: users@cxf.apache.org
> Subject: Re: CXF Servlet support of HTTP Byte Range
>
> Though I guess the correlation is not actually needed for the concrete
> impls. What about encache or similar, can they do it ?
>
> Cheers, Sergey
> On 21/09/11 15:36, Sergey Beryozkin wrote:
>> Hi
>>
>> On 21/09/11 15:07, Collard, David L (Dave) wrote:
>>> Does/Can CXF servlet support/be configured to support
>>> HTTP Byte Ranges?
>>>
>>> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>>> 14.35 Range
>>> 14.35.1 Byte Ranges
>>>
>>
>> I'm wondering if it is what the actual origin server may/should support,
>> say Tomcat or Apache ?
>>
>> We don't support at the CXF level, I'm not even sure how the correlation
>> between multiple range requests is achieved, using cookies ?
>> Cheers, Sergey
>>
>>>
>>> Thanks,
>>>
>>> -- Thor
>>>
>>
>
RE: CXF Servlet support of HTTP Byte Range
Posted by "Collard, David L (Dave)" <da...@alcatel-lucent.com>.
ehcache could be used to cache the complete response, then
hand out byte ranges as requested. But I think this would
best be done in the CXF servlet implementation.
-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
Sent: Wednesday, September 21, 2011 10:39 AM
To: users@cxf.apache.org
Subject: Re: CXF Servlet support of HTTP Byte Range
Though I guess the correlation is not actually needed for the concrete
impls. What about encache or similar, can they do it ?
Cheers, Sergey
On 21/09/11 15:36, Sergey Beryozkin wrote:
> Hi
>
> On 21/09/11 15:07, Collard, David L (Dave) wrote:
>> Does/Can CXF servlet support/be configured to support
>> HTTP Byte Ranges?
>>
>> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>> 14.35 Range
>> 14.35.1 Byte Ranges
>>
>
> I'm wondering if it is what the actual origin server may/should support,
> say Tomcat or Apache ?
>
> We don't support at the CXF level, I'm not even sure how the correlation
> between multiple range requests is achieved, using cookies ?
> Cheers, Sergey
>
>>
>> Thanks,
>>
>> -- Thor
>>
>
Re: CXF Servlet support of HTTP Byte Range
Posted by Sergey Beryozkin <sb...@gmail.com>.
Though I guess the correlation is not actually needed for the concrete
impls. What about encache or similar, can they do it ?
Cheers, Sergey
On 21/09/11 15:36, Sergey Beryozkin wrote:
> Hi
>
> On 21/09/11 15:07, Collard, David L (Dave) wrote:
>> Does/Can CXF servlet support/be configured to support
>> HTTP Byte Ranges?
>>
>> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>> 14.35 Range
>> 14.35.1 Byte Ranges
>>
>
> I'm wondering if it is what the actual origin server may/should support,
> say Tomcat or Apache ?
>
> We don't support at the CXF level, I'm not even sure how the correlation
> between multiple range requests is achieved, using cookies ?
> Cheers, Sergey
>
>>
>> Thanks,
>>
>> -- Thor
>>
>
RE: CXF Servlet support of HTTP Byte Range
Posted by "Collard, David L (Dave)" <da...@alcatel-lucent.com>.
I'm not sure yet... Tomcat default servlet supports it, so if you ask
for a file directly thru tomcat it works. Mobile devices expect this
supported for video. I don't think there is any correlation, each http
request specifies a set of ranges. It looks like I will have to add support myself, I just thought maybe CXF could support it somehow for me already.
-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
Sent: Wednesday, September 21, 2011 10:37 AM
To: users@cxf.apache.org
Subject: Re: CXF Servlet support of HTTP Byte Range
Hi
On 21/09/11 15:07, Collard, David L (Dave) wrote:
> Does/Can CXF servlet support/be configured to support
> HTTP Byte Ranges?
>
> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
> 14.35 Range
> 14.35.1 Byte Ranges
>
I'm wondering if it is what the actual origin server may/should support,
say Tomcat or Apache ?
We don't support at the CXF level, I'm not even sure how the correlation
between multiple range requests is achieved, using cookies ?
Cheers, Sergey
>
> Thanks,
>
> -- Thor
>
Re: CXF Servlet support of HTTP Byte Range
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 21/09/11 15:07, Collard, David L (Dave) wrote:
> Does/Can CXF servlet support/be configured to support
> HTTP Byte Ranges?
>
> From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
> 14.35 Range
> 14.35.1 Byte Ranges
>
I'm wondering if it is what the actual origin server may/should support,
say Tomcat or Apache ?
We don't support at the CXF level, I'm not even sure how the correlation
between multiple range requests is achieved, using cookies ?
Cheers, Sergey
>
> Thanks,
>
> -- Thor
>