Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have write the code below for sending GET request to server, but server response is "Bad Request", what should I do?
Java
String request = "GET "+ url.getFile() +" HTTP/1.1\r\n"+
                         "Host: "+url.getHost()+"\r\n"+
                         "Connection: Keep Alive\r\n"+
                         "\r\n";
        OutStream.write(request.getBytes());
        OutStream.flush();
Posted
Comments
Richard MacCutchan 19-Feb-14 11:57am    
Check the actual text of the request sent to the server. The response suggests that some part of it is invalid.
Member 10290317 21-Feb-14 10:38am    
how can i check?
Richard MacCutchan 21-Feb-14 13:57pm    
Step through the code with your debugger, or print out the string before sending to the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900