dapper
Class Util

java.lang.Object
  extended by dapper.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static java.lang.String httpPost(java.lang.String host, java.lang.String path, java.util.Map<java.lang.String,java.lang.String> data, java.lang.String encoding)
          Performs an HTTP POST to a server on port 80
static java.lang.String httpPost(java.lang.String host, java.lang.String path, java.util.Map<java.lang.String,java.lang.String> data, java.lang.String encoding, int port)
          Performs an HTTP POST to a server on a specific port
static java.lang.String join(java.lang.String separator, java.util.List list)
          Convenience function to create a new string from multiple strings
static java.lang.String urlGetContents(java.net.URL url)
          Returns the contents, properly encoded, of the page at url
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

urlGetContents

public static java.lang.String urlGetContents(java.net.URL url)
                                       throws java.io.IOException
Returns the contents, properly encoded, of the page at url

Parameters:
url - The URL to fetch
Returns:
The contents of the page
Throws:
java.io.IOException

httpPost

public static java.lang.String httpPost(java.lang.String host,
                                        java.lang.String path,
                                        java.util.Map<java.lang.String,java.lang.String> data,
                                        java.lang.String encoding)
                                 throws java.io.IOException
Performs an HTTP POST to a server on port 80

Parameters:
host - The hostname of the remote web server
path - The path portion of the URL
data - A map where the keys are the POST variable names, the values are the values for those variables
Returns:
The data resulting from the POST request
Throws:
java.io.IOException

httpPost

public static java.lang.String httpPost(java.lang.String host,
                                        java.lang.String path,
                                        java.util.Map<java.lang.String,java.lang.String> data,
                                        java.lang.String encoding,
                                        int port)
                                 throws java.io.IOException
Performs an HTTP POST to a server on a specific port

Parameters:
host - The hostname of the remote web server
path - The path portion of the URL
data - A map where the keys are the POST variable names, the values are the values for those variables
Returns:
The data resulting from the POST request
Throws:
java.io.IOException

join

public static java.lang.String join(java.lang.String separator,
                                    java.util.List list)
Convenience function to create a new string from multiple strings

Parameters:
separator -
list -
Returns:
The joined string