title: HTTP authentication in J2ME
body: <p>I'm trying to create a J2ME app, which talks to webserver using <code><a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/io/HttpConnection.html" rel="noreferrer">HttpConnection</a></code> connector. </p>
  
  <p>When I am talking to the WebServer, I have to authenticate using Basic HTTP auth, which normally goes like</p>
  
  <p><code><a href="http://username:password@website.com/rest/api/method" rel="noreferrer">http://username:password@website.com/rest/api/method</a></code></p>
  
  <p>But in J2ME, when I construct a url of this form, it doesn't work. </p>
  
  <p>I also tried adding request property, 
  <code>
      hc = (HttpConnection) Connector.open(url);
      hc.setRequestProperty("User", "alagu");
      hc.setRequestProperty("pass", "mypassword");
  </code></p>
  
  <p>but didn't work. </p>
  
  <p>Has anyone done j2me based HTTP auth before? Thanks in advance.</p>