com.moneydance.util
Class HTTPCommunicator

java.lang.Object
  extended by com.moneydance.util.HTTPCommunicator

public class HTTPCommunicator
extends java.lang.Object

An incredibly simple method for retrieving a page via HTTP. $Author: sreilly $ $Date: 2001/01/31 19:31:16 $ $Revision: 1.1 $ ------------------------------------------------------------------------ $Log: HTTPCommunicator.java,v $ Revision 1.1 2001/01/31 19:31:16 sreilly Moved *everything* to com.moneydance package, and rearranged a couple of the packages in the process. Revision 1.7 2000/07/04 23:00:22 tomster Now instantiable instead of everything being static methods. Better factoring on helper classes. Revision 1.6 2000/06/30 05:44:39 tomster Remove dependency on com.moneydance.apps.md.controller.Main Revision 1.5 2000/04/21 20:13:02 sreilly started revamping all graph stuff Revision 1.4 1999/02/12 21:22:48 sreilly added copyright and removed references to artistic license Revision 1.3 1998/12/14 14:50:02 sreilly Fixed original 2.0b5 bugs and added french translation Revision 1.2 1998/12/09 03:01:34 sreilly Reminders mostly implemented and working, including homepage summary of reminders. Revision 1.1.1.1 1998/08/13 13:58:57 sreilly Initial Moneydance checkin


Constructor Summary
HTTPCommunicator()
          Create a new HTTPCommunicator; use a default user-agent string.
HTTPCommunicator(java.lang.String agent)
          Create a new HTTPCommunicator; set the user-agent string to the one provided.
 
Method Summary
 java.lang.String getAgent()
          Returns a user-agent string, e.g.
 java.lang.String getPageForRef(java.lang.String pageURL)
          This method will take a url (as a string) as an input and return the body of the page that is returned.
 java.lang.String getPageForRef(java.lang.String hostname, int port, java.lang.String uri)
          This method will take a url (as a string) as an input and return the body of the page that is returned.
static void main(java.lang.String[] args)
          main method to serve as simple tester.
 void setUserAgent(java.lang.String s)
          Set user agent string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPCommunicator

public HTTPCommunicator()
Create a new HTTPCommunicator; use a default user-agent string.


HTTPCommunicator

public HTTPCommunicator(java.lang.String agent)
Create a new HTTPCommunicator; set the user-agent string to the one provided.

Method Detail

setUserAgent

public void setUserAgent(java.lang.String s)
Set user agent string


getAgent

public java.lang.String getAgent()
Returns a user-agent string, e.g. "Moneydance 3.0 (OS/2; Intel; 4.0)"


getPageForRef

public java.lang.String getPageForRef(java.lang.String pageURL)
                               throws java.net.MalformedURLException,
                                      java.io.IOException
This method will take a url (as a string) as an input and return the body of the page that is returned. There is no fancy stuff (yet).

Throws:
java.net.MalformedURLException
java.io.IOException

getPageForRef

public java.lang.String getPageForRef(java.lang.String hostname,
                                      int port,
                                      java.lang.String uri)
                               throws java.io.IOException
This method will take a url (as a string) as an input and return the body of the page that is returned. There is no fancy stuff (yet). This method does not return any headers for the page; it eats them.

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
main method to serve as simple tester. arg0 is the URL to download.