HttpURLConnection SetChunkedStreamingMode() Example

Started by VelMurugan, Dec 23, 2008, 05:14 AM

previous topic - next topic
Go Down

VelMurugan

HttpURLConnection SetChunkedStreamingMode() Example

This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance.

HttpURLConnectionclass SetChunkedStreamingMode() method example. This example shows you how to use SetChunkedStreamingMode() method.This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance.

Here is the code:-

Code: [Select]

/*
* @Program that is used to enable streaming of a HTTP request body without
    internal buffering, when the content length is not known in advance.
* SetChunkedStreamingMode.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/

import java.net.*;

public class SetChunkedStreamingMode {
public static void main(String[] args) throws Exception {
        URL url = new URL("http://192.168.10.211:8080");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        //enable streaming of a HTTP request body without internal buffering
        connection.setChunkedStreamingMode(1);
        System.out.println("HTTP request body without internal buffering is set");
}
}


Output of the program:-

HTTP request body without internal buffering is set

Source : codingdiary

Eric Goff

According to documentation, setChunkedStreamingMode's parameter is a "chunklen"
and is not a boolean type parameter.

So using "1" sounds like it is trying to send chunks "one" byte at a time.

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server