dcsimg
https and basic authentication in j2me
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chen_Shu
Posted On:   Tuesday, February 19, 2002 12:12 PM

400 Bad Request I have problem to fetch a web page which requires https and basic authentication using j2mewtk. I don't have the problem when I use https or basic authentication seperately. The code looks like this: byte[] b = (login + ":" + password).getBytes(); String authString = Base64.encode(b, 0, b.length); HttpConnection c = (HttpConnection) Connector.open("https://mycompany.com/index.html"); c.setRequestProperty("authorization", "Basic " + authString); InputStream ins = c.openInputStream(); // read data The content I got back is Bad Request Your browser sent a request   More>>
400 Bad Request

I have problem to fetch a web page which requires https and basic authentication using j2mewtk. I don't have the problem when I use https or basic authentication seperately. The code looks like this:

			
byte[] b = (login + ":" + password).getBytes();
String authString = Base64.encode(b, 0, b.length);
HttpConnection c = (HttpConnection) Connector.open("https://mycompany.com/index.html");
c.setRequestProperty("authorization", "Basic " + authString);
InputStream ins = c.openInputStream();
// read data


The content I got back is

			




Bad Request


Your browser sent a request that this server could not understand.

client sent HTTP/1.1 request without hostname (see RFC2068 section 9, and 14.23): /index.html





Can anybody tell me where goes wrong?


Thanks for any help!

-chen

   <<Less
About | Sitemap | Contact