HttpURLConnection GetResponseMessage() Example

Gets the HTTP response message, if any, returned along with the response code from a server.


HttpURLConnectionclass GetResponseMessage() method example. This example shows you how to use GetResponseMessage() method.This method Gets the HTTP response message, if any, returned along with the response code from a server.

Here is the code:-
/* 
 * @Program that Gets the HTTP response message,returned along with the response
    code from a server.
 * GetResponseMessage.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class GetResponseMessage {

    public static void main(String[] argsthrows Exception {
        URL url = new URL("http://192.168.10.211:8080");
        HttpURLConnection connection = (HttpURLConnectionurl.openConnection();
        String s=connection.getResponseMessage();
        System.out.println("Response message returned is : "+s);
    }
}

Output of the program:-
 Response message returned is : OK

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US