org.hawk.util
Class HttpUtil

java.lang.Object
  extended by org.hawk.util.HttpUtil

public class HttpUtil
extends java.lang.Object

An utility to communicate with the targetURL. Apart from sending post requests , this can also also upload file too.

See Also:
HttpModule

Constructor Summary
HttpUtil()
           
 
Method Summary
static java.lang.String createPostData(java.util.Map<java.lang.String,java.lang.String> hawkMap)
          This creates POST data from the input map passed in from hawk script.
static java.lang.String fetchAndSaveResult(java.net.HttpURLConnection conn)
          This reads the HttpsURLConnection and saves the response in a html file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtil

public HttpUtil()
Method Detail

createPostData

public static java.lang.String createPostData(java.util.Map<java.lang.String,java.lang.String> hawkMap)
                                       throws HawkException
This creates POST data from the input map passed in from hawk script. This checks for key parameters like targetURL, uploadFile , fileName and concurrent. The above inbuilt key words will be moved a inbuilt hawk structure in the next release after inheritance is implemented.

Parameters:
hawkMap - input map from the hawk script
Returns:
POST data
Throws:
HawkException

fetchAndSaveResult

public static java.lang.String fetchAndSaveResult(java.net.HttpURLConnection conn)
This reads the HttpsURLConnection and saves the response in a html file. This will be mainly used for debugging purpose.

Parameters:
conn - connection from which data is to be read.
Returns:
returns the response after saving it in result.html