Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Apache HttpCLient -> Getting the server message based on status code

here is how we get status.
        int status = client.executeMethod(method);

Now how to get the server message based on status using client object??

Regards
Sudhakar

0
sudhakar_koundinya
Asked:
sudhakar_koundinya
  • 2
1 Solution
 
ramazanyichCommented:
if (statusCode != HttpStatus.SC_OK) {
        System.err.println("Method failed: " + method.getStatusLine());
      }

      // Read the response body.
      byte[] responseBody = method.getResponseBody();
0
 
ramazanyichCommented:
Check tutorial for HttpClient for usage guidelines:
http://jakarta.apache.org/commons/httpclient/tutorial.html
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now