I have an Android app that need to set a requestproperty in a connection. Here is my code: URL url = new URL(sUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty('cookie', cookievalue); connection.connect(); When I call the setRequestProperty method it launch the exception: java.lang.IllegalStateException: Cannot set request property after connection is made Is there a way to create the connection to the file without using the url.openConnection()? ![]() SetRequestProperty in java. Ask Question 2. The documentation here says that setRequestProperty sets the general request property. So suppose I have the following code snippet showing the usage of setRequestProperty as follows. Java httpurlconnection urlconnection. This Java tutorial describes how to connect to a URL using Basic authentication. AVAJAVA Web Tutorials Total Categories: 24, Total Tutorials: 508. It Base64 encodes the resulting string. It makes a URL connection to a web site and sets the 'Authorization' request property to be 'Basic '. It reads the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2019
Categories |