On Fri, 2012-05-25 at 09:28 -0700, anr wrote:
> scenario is end user speaking in the mobile device the audio stream should be
> flushed to the speech engine to process as it comes.
> Can you help me out by pointing to the examples how to achieve the steps you
> have mentioned.
> 
> Thanks for all the help.

static class MyEntitySerializer extends EntitySerializer {

    private ContentLengthStrategy lenStrategy;
    
    public MyEntitySerializer(ContentLengthStrategy lenStrategy) {
        super(lenStrategy);
        this.lenStrategy = lenStrategy;
    }

    @Override
    protected OutputStream doSerialize(
            SessionOutputBuffer outbuffer, 
            HttpMessage message) throws HttpException, IOException {
        long len = this.lenStrategy.determineLength(message);
        if (len == ContentLengthStrategy.CHUNKED) {
            // use largish buffer for output chunks
            return new ChunkedOutputStream(outbuffer, 10240);
        } else if (len == ContentLengthStrategy.IDENTITY) {
            return new IdentityOutputStream(outbuffer);
        } else {
            return new ContentLengthOutputStream(outbuffer, len);
        }
    }
    
}

static class MyHttpClientConnection extends DefaultHttpClientConnection
{

    public MyHttpClientConnection() {
        super();
    }

    @Override
    protected EntitySerializer createEntitySerializer() {
        return new MyEntitySerializer(new
StrictContentLengthStrategy());
    }
    
}

Hope this helps

Oleg

>  
> 
> 
> olegk wrote:
> > 
> > On Thu, 2012-05-24 at 15:13 -0700, anr wrote:
> >> 
> >> DEBUG org.apache.http.wire - >> "800[\r][\n]"
> >>  org.apache.http.wire - >> "800[\r][\n]"
> >> 
> >> CoreConnectionPNames.SOCKET_BUFFER_SIZE
> >> CoreConnectionPNames.MIN_CHUNK_LIMIT
> >> 
> >> How to change the transfer encoding chunk size when request is posted. I
> >> want to set different chunk sizes when we post a request.
> >> 
> >> Thanks
> > 
> > Per default HttpClient use 2048 byte cache for chunk coded output. So,
> > the chunks should be about 2048 bytes, unless one explicitly uses #flush
> > method to flush out smaller chunks.
> > 
> > There is currently no (easy) way of overriding the default size of the
> > chunk cache without creating a custom entity serializer and custom HTTP
> > connection class.
> > 
> > Oleg    
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
> > 
> > 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to