Q:

Submitting a form using java that requires authentication

I am trying to submit a form in a website using java. I know a little about the HttpUrlConnection class and have used it to submit forms in websites that does not require authentication. But, now I want to submit a form inside a website that requires authentication. 
I have googled a little and found that the HttpUrlConnection supports this with two types of authentication, namely basic and digest. The problem is I do not know which type of authentication my target website uses. I know that it uses Ldap for authentication. Could someone please provide some kind of sample code with which to submit a form in a website that requires authentication. 
Thanks in advance.

A:

Whatever method of authentication your target website uses is not a concern for you, until you know how does the website authenticates your client. If it just accepts a username and password while making a request then just send it that way.
This is the reason why most of the famous target websites have API's provided.

