net.anotheria.net.http.client
Class SimpleHttpClient

java.lang.Object
  extended by net.anotheria.net.http.client.SimpleHttpClient

public class SimpleHttpClient
extends Object

Very simple utility class to communicate with web server via HTTP protocol. Provides just a few low level method to send request to a serve and get response from it.

Author:
denis

Constructor Summary
SimpleHttpClient()
           
 
Method Summary
static void main(String[] args)
           
 String sendPostRequest(String url, String postData)
          Packs string data to the post HTTP request and sends it on the Web Server by specific URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleHttpClient

public SimpleHttpClient()
Method Detail

sendPostRequest

public String sendPostRequest(String url,
                              String postData)
                       throws Exception
Packs string data to the post HTTP request and sends it on the Web Server by specific URL. Can be helpful when already prepared JSON, YAML or any other text format request has to be sent on a Server via HTTP Post.

Parameters:
url -
postData -
Returns:
text response from the Server
Throws:
Exception - delegates to using class exceptions handling.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2010-2013 anotheria.net. All Rights Reserved.