net.livesite.http
Class HttpConnection

java.lang.Object
  extended by net.livesite.http.HttpConnection
Direct Known Subclasses:
HttpDownload

public class HttpConnection
extends Object

This class establishes an http connection. It can only post right now.


Constructor Summary
HttpConnection(String urlStr)
           
HttpConnection(URL url)
           
 
Method Summary
 String doGet()
          doGet This method will issue a get to the server.
 String doNotify()
          doNotify This method will issue a get to the server.
 String doPost(String strBody)
          This method posts the form defined by the body string.
 String doPost(String strBody, boolean bReadResponseBody)
          doPost This method posts the form defined by the body string.
 HttpURLConnection getConnection()
           
 String getMimeType()
           
 String getPassword()
           
 int getResponseCode()
           
 String getResponseMessage()
           
 String getUsername()
           
protected  String readInputStream(InputStream is)
           
 void setMimeType(String strMimeType)
           
 void setPassword(String password)
           
 void setUsername(String username)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpConnection

public HttpConnection(String urlStr)
               throws IOException
Throws:
IOException

HttpConnection

public HttpConnection(URL url)
               throws IOException
Throws:
IOException
Method Detail

setMimeType

public void setMimeType(String strMimeType)

getMimeType

public String getMimeType()

doPost

public String doPost(String strBody)
              throws Exception
This method posts the form defined by the body string. Fill this with the name of the fields and the values. All values will be converted to strings. This version does not return the response body from the server. null is always returned.

Throws:
Exception

doPost

public String doPost(String strBody,
                     boolean bReadResponseBody)
              throws Exception
doPost This method posts the form defined by the body string. If bReadResponseBody is true then the return value is the body of the resonse from the server. If false the return value is null.

Throws:
Exception

doGet

public String doGet()
             throws IOException,
                    Exception
doGet This method will issue a get to the server. It takes no input, but does reply with the server output string.

Throws:
IOException
Exception

doNotify

public String doNotify()
                throws IOException,
                       Exception
doNotify This method will issue a get to the server. It takes no input and does not read the output.

Throws:
IOException
Exception

readInputStream

protected String readInputStream(InputStream is)
                          throws Exception
Throws:
Exception

getConnection

public HttpURLConnection getConnection()

getResponseCode

public int getResponseCode()
                    throws IOException
Throws:
IOException

getResponseMessage

public String getResponseMessage()

toString

public String toString()
Overrides:
toString in class Object

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

getUsername

public String getUsername()

setUsername

public void setUsername(String username)