hi,
Thanks Ken !
Some where I had assumed that problem.
But one thing i want to share that as you said I should use httpcore
directly, I have built my application with having "httpcore-4.0.1.jar" and
"httpclient-4.0.1.jar" both.
so can you tell how can i use the Httpcore-4.0.1.I will try and If I found
something then I get back to you.
Thanks and regards-
Udit
Ken Krugler wrote:
>
> Hi Udit,
>
> I believe the problem is that technically the subdomain
> ("donotdelete_httpclient", in your case) can't have underscores.
>
> So the URI class will return null for the hostname.
>
> The same thing would happen if you had a subdomain that started with a
> "-", for example "-angelcries.blogspot.com"
>
> In HttpClient 3.x, there was a custom URI class that was more lenient,
> but in 4.x the standard Java URI class is used.
>
> Even though these are technically invalid hostnames, most (all?) DNS
> servers will resolve them properly, which is why the URL works in a
> browser, but fails with HttpClient 4.
>
> I believe Oleg's standard response is that you should use HttpCore
> directly if you need to work with non-standard hostnames.
>
> -- Ken
>
> On Jun 9, 2010, at 6:18am, Udit Bhatnagar wrote:
>
>>
>> Hi,
>>
>> I am using httpclient4.0.1.jar for get request in my code.earlier i
>> was
>> using commons-httpclient-3.1.jar for the same.
>>
>> For httpclient4.0.1.jar
>> ====================================================
>> My code block is as follows :
>>
>> conn = new DefaultHttpClient();
>> HttpHost host = new HttpHost("s3.amazonaws.com",80);
>> HttpGet request = new HttpGet();
>>
>> request.setURI(new
>> java.net.URI("https://donotdelete_httpclient.s3.amazonaws.com/4F265439.jpg?AWSAccessKeyId=AKIAINHDRCMKC5GUSNFA&Expires=1276089613&Signature=Xxm%2FmOttPqs0F0jvx%2Fv%2FTQCJPsg%3D
>>
>> "));
>> request.setParams(params);
>>
>> HttpResponse response = conn.execute(request);
>> response.setParams(params);
>>
>>
>> While Executing this request (red marked line)I am getting an
>> exception as
>> "Host name may not be null"(illegal argument exception) and If i run
>> this
>> URI on browser then it is running fine.
>>
>> =====================================================
>> For commons-httpclient-3.1.jar
>>
>> My code block for same URI is as follows :
>>
>> HttpClient httpClient = new HttpClient();
>> HostConfiguration secureHostConfig = new HostConfiguration();
>>
>> GetMethod method = null;
>> method = new
>> GetMethod(https://donotdelete_httpclient.s3.amazonaws.com/4F265439.jpg?AWSAccessKeyId=AKIAINHDRCMKC5GUSNFA&Expires=1276089613&Signature=Xxm%2FmOttPqs0F0jvx%2Fv%2FTQCJPsg%3D
>>
>> );
>>
>> statusCode = httpClient.executeMethod(secureHostConfig, method);
>>
>> For this code block it is running fine.
>> =======================================================
>>
>>
>> Can any one help me what I am missing out as I want to upgrade
>> commons-httpclient-3.1 to httpclient4.0.1.
>>
>> Thanks and regards to your responses.
>>
>> Regards-
>>
>> Udit
>> --
>> View this message in context:
>> http://old.nabble.com/GET-request-using-httpclient4.0.1-tp28830292p28830292.html
>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> --------------------------------------------
> Ken Krugler
> +1 530-210-6378
> http://bixolabs.com
> e l a s t i c w e b m i n i n g
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://old.nabble.com/GET-request-using-httpclient4.0.1-tp28830292p28838591.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]